Fixed issue in autocomplete users feature. closes #367

This commit is contained in:
Manuel Cortez 2021-02-04 12:30:20 -06:00
parent cba7c39a0e
commit 9cb6eafbbc
8 changed files with 13 additions and 28 deletions

View File

@ -2,6 +2,7 @@
## changes in this version ## 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)) * 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 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. * TWBlue should be restarted gracefully. Before, the application was alerting users of not being closed properly every time the application restarted by itself.

View File

@ -1,7 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import object
import output import output
from . import storage from . import storage
from . import wx_menu from . import wx_menu

View File

@ -1,11 +1,6 @@
# -*- coding: utf-8 -*- # -*- 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 widgetUtils
from . import wx_manage from . import storage, wx_manage
from wxUI import commonMessageDialogs from wxUI import commonMessageDialogs
class autocompletionManage(object): class autocompletionManage(object):
@ -32,11 +27,11 @@ class autocompletionManage(object):
if usr == False: if usr == False:
return return
try: try:
data = self.session.twitter.twitter.show_user(screen_name=usr) data = self.session.twitter.twitter.get_user(screen_name=usr)
except: except:
self.dialog.show_invalid_user_error() self.dialog.show_invalid_user_error()
return return
self.database.set_user(data["screen_name"], data["name"], 0) self.database.set_user(data.screen_name, data.name, 0)
self.update_list() self.update_list()
def remove_user(self, ev): def remove_user(self, ev):

View File

@ -1,13 +1,9 @@
# -*- coding: utf-8 -*- # -*- 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 widgetUtils
import output
from . import wx_settings from . import wx_settings
from . import manage from . import manage
import output from . import storage
from mysc.thread_utils import call_threaded from mysc.thread_utils import call_threaded
class autocompletionSettings(object): class autocompletionSettings(object):
@ -30,14 +26,14 @@ class autocompletionSettings(object):
database = storage.storage(self.buffer.session.session_id) database = storage.storage(self.buffer.session.session_id)
if self.dialog.get("followers_buffer") == True: if self.dialog.get("followers_buffer") == True:
buffer = self.window.search_buffer("followers", self.config["twitter"]["user_name"]) buffer = self.window.search_buffer("followers", self.config["twitter"]["user_name"])
for i in buffer.session.db[buffer.name]["items"]: 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: else:
database.remove_by_buffer(1) database.remove_by_buffer(1)
if self.dialog.get("friends_buffer") == True: if self.dialog.get("friends_buffer") == True:
buffer = self.window.search_buffer("friends", self.config["twitter"]["user_name"]) buffer = self.window.search_buffer("friends", self.config["twitter"]["user_name"])
for i in buffer.session.db[buffer.name]["items"]: 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: else:
database.remove_by_buffer(2) database.remove_by_buffer(2)
wx_settings.show_success_dialog() 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: 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"]) buffer = window.search_buffer("followers", config["twitter"]["user_name"])
for i in buffer.session.db[buffer.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: else:
database.remove_by_buffer(1) database.remove_by_buffer(1)
if config["mysc"]["save_friends_in_autocompletion_db"] == True and config["other_buffers"]["show_friends"] == True: 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"]) buffer = window.search_buffer("friends", config["twitter"]["user_name"])
for i in buffer.session.db[buffer.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: else:
database.remove_by_buffer(2) database.remove_by_buffer(2)

View File

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
import os, sqlite3, paths import os, sqlite3, paths
class storage(object): class storage(object):

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wx import wx
import widgetUtils import widgetUtils
from multiplatform_widgets import widgets from multiplatform_widgets import widgets
import application import application
class autocompletionManageDialog(widgetUtils.BaseDialog): class autocompletionManageDialog(widgetUtils.BaseDialog):
def __init__(self): def __init__(self):
super(autocompletionManageDialog, self).__init__(parent=None, id=-1, title=_(u"Manage Autocompletion database")) super(autocompletionManageDialog, self).__init__(parent=None, id=-1, title=_(u"Manage Autocompletion database"))

View File

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wx import wx
class menu(wx.Menu): class menu(wx.Menu):

View File

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wx import wx
import widgetUtils import widgetUtils
import application import application