diff --git a/doc/changelog.md b/doc/changelog.md index 651f215f..e20517a4 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -2,6 +2,7 @@ ## changes in this version +* Fixed autocomplete users feature. ([#367,](https://github.com/manuelcortez/TWBlue/issues/367)) * Fixed error when displaying an URL at the end of a line, when the tweet or direct message contained multiple lines. Now the URL should be displayed correctly. ([#305,](https://github.com/manuelcortez/TWBlue/issues/305) [#272,](https://github.com/manuelcortez/TWBlue/issues/272)) * TWBlue has been migrated completely to Python 3 (currently, the software builds with Python 3.8). * TWBlue should be restarted gracefully. Before, the application was alerting users of not being closed properly every time the application restarted by itself. diff --git a/src/extra/autocompletionUsers/completion.py b/src/extra/autocompletionUsers/completion.py index 562788cb..25875d8c 100644 --- a/src/extra/autocompletionUsers/completion.py +++ b/src/extra/autocompletionUsers/completion.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import unicode_literals -from builtins import object import output from . import storage from . import wx_menu diff --git a/src/extra/autocompletionUsers/manage.py b/src/extra/autocompletionUsers/manage.py index ba3a224c..ae7dd957 100644 --- a/src/extra/autocompletionUsers/manage.py +++ b/src/extra/autocompletionUsers/manage.py @@ -1,11 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import unicode_literals -# -*- coding: utf-8 -*- -from builtins import object -from . import storage import widgetUtils -from . import wx_manage +from . import storage, wx_manage from wxUI import commonMessageDialogs class autocompletionManage(object): @@ -32,11 +27,11 @@ class autocompletionManage(object): if usr == False: return try: - data = self.session.twitter.twitter.show_user(screen_name=usr) + data = self.session.twitter.twitter.get_user(screen_name=usr) except: self.dialog.show_invalid_user_error() return - self.database.set_user(data["screen_name"], data["name"], 0) + self.database.set_user(data.screen_name, data.name, 0) self.update_list() def remove_user(self, ev): diff --git a/src/extra/autocompletionUsers/settings.py b/src/extra/autocompletionUsers/settings.py index d14ba62b..283c217c 100644 --- a/src/extra/autocompletionUsers/settings.py +++ b/src/extra/autocompletionUsers/settings.py @@ -1,13 +1,9 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import unicode_literals -# -*- coding: utf-8 -*- -from builtins import object -from . import storage import widgetUtils +import output from . import wx_settings from . import manage -import output +from . import storage from mysc.thread_utils import call_threaded class autocompletionSettings(object): @@ -30,14 +26,14 @@ class autocompletionSettings(object): database = storage.storage(self.buffer.session.session_id) if self.dialog.get("followers_buffer") == True: buffer = self.window.search_buffer("followers", self.config["twitter"]["user_name"]) - for i in buffer.session.db[buffer.name]["items"]: - database.set_user(i["screen_name"], i["name"], 1) + for i in buffer.session.db[buffer.name]: + database.set_user(i.screen_name, i.name, 1) else: database.remove_by_buffer(1) if self.dialog.get("friends_buffer") == True: buffer = self.window.search_buffer("friends", self.config["twitter"]["user_name"]) - for i in buffer.session.db[buffer.name]["items"]: - database.set_user(i["screen_name"], i["name"], 2) + for i in buffer.session.db[buffer.name]: + database.set_user(i.screen_name, i.name, 2) else: database.remove_by_buffer(2) wx_settings.show_success_dialog() @@ -52,12 +48,12 @@ def execute_at_startup(window, buffer, config): if config["mysc"]["save_followers_in_autocompletion_db"] == True and config["other_buffers"]["show_followers"] == True: buffer = window.search_buffer("followers", config["twitter"]["user_name"]) for i in buffer.session.db[buffer.name]: - database.set_user(i["screen_name"], i["name"], 1) + database.set_user(i.screen_name, i.name, 1) else: database.remove_by_buffer(1) if config["mysc"]["save_friends_in_autocompletion_db"] == True and config["other_buffers"]["show_friends"] == True: buffer = window.search_buffer("friends", config["twitter"]["user_name"]) for i in buffer.session.db[buffer.name]: - database.set_user(i["screen_name"], i["name"], 2) + 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/extra/autocompletionUsers/storage.py b/src/extra/autocompletionUsers/storage.py index 9a34ef68..4d5df88f 100644 --- a/src/extra/autocompletionUsers/storage.py +++ b/src/extra/autocompletionUsers/storage.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals -from builtins import object import os, sqlite3, paths class storage(object): diff --git a/src/extra/autocompletionUsers/wx_manage.py b/src/extra/autocompletionUsers/wx_manage.py index dad0d0dd..3db4de67 100644 --- a/src/extra/autocompletionUsers/wx_manage.py +++ b/src/extra/autocompletionUsers/wx_manage.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals import wx import widgetUtils from multiplatform_widgets import widgets import application + class autocompletionManageDialog(widgetUtils.BaseDialog): def __init__(self): super(autocompletionManageDialog, self).__init__(parent=None, id=-1, title=_(u"Manage Autocompletion database")) diff --git a/src/extra/autocompletionUsers/wx_menu.py b/src/extra/autocompletionUsers/wx_menu.py index bf94e7f0..55d81458 100644 --- a/src/extra/autocompletionUsers/wx_menu.py +++ b/src/extra/autocompletionUsers/wx_menu.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals import wx class menu(wx.Menu): diff --git a/src/extra/autocompletionUsers/wx_settings.py b/src/extra/autocompletionUsers/wx_settings.py index e5520d4f..068decf6 100644 --- a/src/extra/autocompletionUsers/wx_settings.py +++ b/src/extra/autocompletionUsers/wx_settings.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals import wx import widgetUtils import application