mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-01-19 00:40:42 -06:00
Autocompletion now works in the actions dialogue
This commit is contained in:
parent
3f82a51ef9
commit
313e725ff2
@ -1,10 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from wxUI.dialogs import userActions
|
|
||||||
from pubsub import pub
|
|
||||||
import re
|
import re
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import output
|
import output
|
||||||
|
from wxUI.dialogs import userActions
|
||||||
|
from pubsub import pub
|
||||||
from twython import TwythonError
|
from twython import TwythonError
|
||||||
|
from extra import autocompletionUsers
|
||||||
|
|
||||||
class userActionsController(object):
|
class userActionsController(object):
|
||||||
def __init__(self, buffer, users=[], default="follow"):
|
def __init__(self, buffer, users=[], default="follow"):
|
||||||
@ -12,9 +13,14 @@ class userActionsController(object):
|
|||||||
self.buffer = buffer
|
self.buffer = buffer
|
||||||
self.session = buffer.session
|
self.session = buffer.session
|
||||||
self.dialog = userActions.UserActionsDialog(users, default)
|
self.dialog = userActions.UserActionsDialog(users, default)
|
||||||
|
widgetUtils.connect_event(self.dialog.autocompletion, widgetUtils.BUTTON_PRESSED, self.autocomplete_users)
|
||||||
if self.dialog.get_response() == widgetUtils.OK:
|
if self.dialog.get_response() == widgetUtils.OK:
|
||||||
self.process_action()
|
self.process_action()
|
||||||
|
|
||||||
|
def autocomplete_users(self, *args, **kwargs):
|
||||||
|
c = autocompletionUsers.completion.autocompletionUsers(self.dialog, self.session.session_id)
|
||||||
|
c.show_menu("dm")
|
||||||
|
|
||||||
def process_action(self):
|
def process_action(self):
|
||||||
action = self.dialog.get_action()
|
action = self.dialog.get_action()
|
||||||
user = self.dialog.get_user()
|
user = self.dialog.get_user()
|
||||||
|
@ -10,8 +10,10 @@ class UserActionsDialog(wx.Dialog):
|
|||||||
userLabel = wx.StaticText(panel, -1, _(u"User"))
|
userLabel = wx.StaticText(panel, -1, _(u"User"))
|
||||||
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
|
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
|
||||||
self.cb.SetFocus()
|
self.cb.SetFocus()
|
||||||
|
self.autocompletion = wx.Button(panel, -1, _(u"&Autocomplete users"))
|
||||||
userSizer.Add(userLabel, 0, wx.ALL, 5)
|
userSizer.Add(userLabel, 0, wx.ALL, 5)
|
||||||
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
||||||
|
userSizer.Add(self.autocompletion, 0, wx.ALL, 5)
|
||||||
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
label2 = wx.StaticText(panel, -1, _(u"Action"))
|
label2 = wx.StaticText(panel, -1, _(u"Action"))
|
||||||
self.follow = wx.RadioButton(panel, -1, _(u"Follow"), style=wx.RB_GROUP)
|
self.follow = wx.RadioButton(panel, -1, _(u"Follow"), style=wx.RB_GROUP)
|
||||||
@ -79,3 +81,9 @@ class UserActionsDialog(wx.Dialog):
|
|||||||
|
|
||||||
def get_user(self):
|
def get_user(self):
|
||||||
return self.cb.GetValue()
|
return self.cb.GetValue()
|
||||||
|
|
||||||
|
def get_position(self):
|
||||||
|
return self.cb.GetPosition()
|
||||||
|
|
||||||
|
def popup_menu(self, menu):
|
||||||
|
self.PopupMenu(menu, self.cb.GetPosition())
|
||||||
|
@ -10,8 +10,10 @@ class selectUserDialog(wx.Dialog):
|
|||||||
userLabel = wx.StaticText(panel, -1, _(u"User"))
|
userLabel = wx.StaticText(panel, -1, _(u"User"))
|
||||||
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
|
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
|
||||||
self.cb.SetFocus()
|
self.cb.SetFocus()
|
||||||
|
self.autocompletion = wx.Button(panel, -1, _(u"&Autocomplete users"))
|
||||||
userSizer.Add(userLabel, 0, wx.ALL, 5)
|
userSizer.Add(userLabel, 0, wx.ALL, 5)
|
||||||
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
||||||
|
userSizer.Add(self.autocompletion, 0, wx.ALL, 5)
|
||||||
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
label2 = wx.StaticText(panel, -1, _(u"Buffer type"))
|
label2 = wx.StaticText(panel, -1, _(u"Buffer type"))
|
||||||
self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
|
self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
|
||||||
@ -49,3 +51,9 @@ class selectUserDialog(wx.Dialog):
|
|||||||
|
|
||||||
def get_user(self):
|
def get_user(self):
|
||||||
return self.cb.GetValue()
|
return self.cb.GetValue()
|
||||||
|
|
||||||
|
def get_position(self):
|
||||||
|
return self.cb.GetPosition()
|
||||||
|
|
||||||
|
def popup_menu(self, menu):
|
||||||
|
self.PopupMenu(menu, self.cb.GetPosition())
|
||||||
|
@ -26,8 +26,10 @@ class selectUserDialog(baseDialog.BaseWXDialog):
|
|||||||
userSizer = wx.BoxSizer()
|
userSizer = wx.BoxSizer()
|
||||||
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0], size=wx.DefaultSize)
|
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0], size=wx.DefaultSize)
|
||||||
self.cb.SetFocus()
|
self.cb.SetFocus()
|
||||||
|
self.autocompletion = wx.Button(panel, -1, _(u"&Autocomplete users"))
|
||||||
userSizer.Add(wx.StaticText(panel, -1, _(u"User")), 0, wx.ALL, 5)
|
userSizer.Add(wx.StaticText(panel, -1, _(u"User")), 0, wx.ALL, 5)
|
||||||
userSizer.Add(self.cb)
|
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
||||||
|
userSizer.Add(self.autocompletion, 0, wx.ALL, 5)
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
||||||
ok.SetDefault()
|
ok.SetDefault()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user