Improvements on autocomplete, now it updates its database at startup

This commit is contained in:
Manuel Cortez 2014-12-05 16:23:54 -06:00
parent bc2d448464
commit a13536233e
2 changed files with 17 additions and 1 deletions

View File

@ -35,4 +35,18 @@ class autocompletionSettings(object):
database.remove_by_buffer(2) database.remove_by_buffer(2)
wx_settings.show_success_dialog() wx_settings.show_success_dialog()
self.dialog.Destroy() self.dialog.Destroy()
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)

View File

@ -34,6 +34,7 @@ import urllib2
import sysTrayIcon import sysTrayIcon
import switchModule import switchModule
import languageHandler import languageHandler
from extra.autocompletionUsers import settings as autocompletionUsersSettings
import pygeocoder import pygeocoder
from pygeolib import GeocoderError from pygeolib import GeocoderError
from sessionmanager import manager from sessionmanager import manager
@ -355,6 +356,7 @@ class mainFrame(wx.Frame):
self.check_streams.start() self.check_streams.start()
# If all it's done, then play a nice sound saying that all it's OK. # If all it's done, then play a nice sound saying that all it's OK.
sound.player.play("ready.ogg") sound.player.play("ready.ogg")
autocompletionUsersSettings.execute_at_startup(window=self)
def remove_list(self, id): def remove_list(self, id):
for i in range(0, self.nb.GetPageCount()): for i in range(0, self.nb.GetPageCount()):