Skip to content

Commit

Permalink
improve status message
Browse files Browse the repository at this point in the history
  • Loading branch information
mercurykd authored Jul 12, 2023
1 parent 0a451be commit d93ca3f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions SQLTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,12 @@ def promptNext():

promptNext()

@staticmethod
def changeStatus(text):
views = Window().views()
for view in views:
view.set_status('db', 'db:' + ST.conn.name + ' (' + text + ')')

@staticmethod
def loadConnectionData(callback=None):
# clear the list of identifiers (in case connection is changed)
Expand All @@ -394,13 +400,10 @@ def loadConnectionData(callback=None):
if not ST.conn:
return

views = Window().views()
for view in views:
view.set_status('db', 'db: ' + ST.conn.name + ' ')

def afterAllDataHasLoaded():
ST.completion = Completion(ST.tables, ST.columns, ST.functions, settings=settingsStore)
logger.info('completions loaded')
ST.changeStatus('ok {}/{}/{}'.format(len(ST.tables), len(ST.columns), len(ST.functions)))
if (callback):
callback()

Expand All @@ -409,6 +412,7 @@ def tablesCallback(tables):
nonlocal objectsLoaded
objectsLoaded += 1
logger.info('loaded tables : "{0}"'.format(tables))
ST.changeStatus('load tables')
if objectsLoaded == 3:
afterAllDataHasLoaded()

Expand All @@ -417,6 +421,7 @@ def columnsCallback(columns):
nonlocal objectsLoaded
objectsLoaded += 1
logger.info('loaded columns : "{0}"'.format(columns))
ST.changeStatus('load columns')
if objectsLoaded == 3:
afterAllDataHasLoaded()

Expand All @@ -425,6 +430,7 @@ def functionsCallback(functions):
nonlocal objectsLoaded
objectsLoaded += 1
logger.info('loaded functions: "{0}"'.format(functions))
ST.changeStatus('load functions')
if objectsLoaded == 3:
logger.info('all objects loaded')
afterAllDataHasLoaded()
Expand Down

0 comments on commit d93ca3f

Please sign in to comment.