mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Update code on autocompletion users module to use WX methods from controls in the new Tweet GUI'S
This commit is contained in:
parent
f0456af656
commit
2b6efef831
@ -10,9 +10,9 @@ class autocompletionUsers(object):
|
|||||||
self.db = storage.storage(session_id)
|
self.db = storage.storage(session_id)
|
||||||
|
|
||||||
def show_menu(self, mode="tweet"):
|
def show_menu(self, mode="tweet"):
|
||||||
position = self.window.get_position()
|
position = self.window.text.GetInsertionPoint()
|
||||||
if mode == "tweet":
|
if mode == "tweet":
|
||||||
text = self.window.get_text()
|
text = self.window.text.GetValue()
|
||||||
text = text[:position]
|
text = text[:position]
|
||||||
try:
|
try:
|
||||||
pattern = text.split()[-1]
|
pattern = text.split()[-1]
|
||||||
@ -24,14 +24,14 @@ class autocompletionUsers(object):
|
|||||||
users = self.db.get_users(pattern[1:])
|
users = self.db.get_users(pattern[1:])
|
||||||
if len(users) > 0:
|
if len(users) > 0:
|
||||||
menu.append_options(users)
|
menu.append_options(users)
|
||||||
self.window.popup_menu(menu)
|
self.window.PopupMenu(menu, self.window.text.GetPosition())
|
||||||
menu.destroy()
|
menu.destroy()
|
||||||
else:
|
else:
|
||||||
output.speak(_(u"There are no results in your users database"))
|
output.speak(_(u"There are no results in your users database"))
|
||||||
else:
|
else:
|
||||||
output.speak(_(u"Autocompletion only works for users."))
|
output.speak(_(u"Autocompletion only works for users."))
|
||||||
elif mode == "dm":
|
elif mode == "dm":
|
||||||
text = self.window.get_user()
|
text = self.window.cb.GetValue()
|
||||||
try:
|
try:
|
||||||
pattern = text.split()[-1]
|
pattern = text.split()[-1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@ -41,7 +41,7 @@ class autocompletionUsers(object):
|
|||||||
users = self.db.get_users(pattern)
|
users = self.db.get_users(pattern)
|
||||||
if len(users) > 0:
|
if len(users) > 0:
|
||||||
menu.append_options(users)
|
menu.append_options(users)
|
||||||
self.window.popup_menu(menu)
|
self.window.PopupMenu(menu, self.window.text.GetPosition())
|
||||||
menu.destroy()
|
menu.destroy()
|
||||||
else:
|
else:
|
||||||
output.speak(_(u"There are no results in your users database"))
|
output.speak(_(u"There are no results in your users database"))
|
||||||
|
Loading…
Reference in New Issue
Block a user