From a13536233e60c6d5c1936f416fcd13de2eb8b1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Fri, 5 Dec 2014 16:23:54 -0600 Subject: [PATCH] Improvements on autocomplete, now it updates its database at startup --- src/extra/autocompletionUsers/settings.py | 16 +++++++++++++++- src/gui/main.py | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/extra/autocompletionUsers/settings.py b/src/extra/autocompletionUsers/settings.py index cd19be8b..92cf4257 100644 --- a/src/extra/autocompletionUsers/settings.py +++ b/src/extra/autocompletionUsers/settings.py @@ -35,4 +35,18 @@ class autocompletionSettings(object): database.remove_by_buffer(2) wx_settings.show_success_dialog() self.dialog.Destroy() - \ No newline at end of file + +def execute_at_startup(window): + database = storage.storage() + if config.main["mysc"]["save_followers_in_autocompletion_db"] == True: + buffer = window.search_buffer("people", "followers") + for i in buffer.db.settings[buffer.name_buffer]: + database.set_user(i["screen_name"], i["name"], 1) + else: + database.remove_by_buffer(1) + if config.main["mysc"]["save_friends_in_autocompletion_db"] == True: + buffer = window.search_buffer("people", "friends") + for i in buffer.db.settings[buffer.name_buffer]: + database.set_user(i["screen_name"], i["name"], 2) + else: + database.remove_by_buffer(2) \ No newline at end of file diff --git a/src/gui/main.py b/src/gui/main.py index 174627a3..c42a159c 100644 --- a/src/gui/main.py +++ b/src/gui/main.py @@ -34,6 +34,7 @@ import urllib2 import sysTrayIcon import switchModule import languageHandler +from extra.autocompletionUsers import settings as autocompletionUsersSettings import pygeocoder from pygeolib import GeocoderError from sessionmanager import manager @@ -355,6 +356,7 @@ class mainFrame(wx.Frame): self.check_streams.start() # If all it's done, then play a nice sound saying that all it's OK. sound.player.play("ready.ogg") + autocompletionUsersSettings.execute_at_startup(window=self) def remove_list(self, id): for i in range(0, self.nb.GetPageCount()):