Autocompletion for users has been implemented

This commit is contained in:
2014-11-25 12:30:00 -06:00
parent 0104b97df0
commit 3ec8ac31a5
11 changed files with 168 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ import webbrowser
import paths
import platform
from mysc import restart
from extra.autocompletionUsers import settings
log = original_logger.getLogger("configuration")
system = platform.system()
@@ -50,6 +51,8 @@ class general(wx.Panel):
langBox.Add(language, 0, wx.ALL, 5)
langBox.Add(self.language, 0, wx.ALL, 5)
sizer.Add(langBox, 0, wx.ALL, 5)
self.au = wx.Button(self, -1, u"Configure autocompltion")
# self.Bind(wx.EVT_BUTTON, self.autocompletion, au)
self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting TwBlue?"))
self.ask_at_exit.SetValue(config.main["general"]["ask_at_exit"])
sizer.Add(self.ask_at_exit, 0, wx.ALL, 5)
@@ -84,6 +87,7 @@ class general(wx.Panel):
sizer.Add(self.reverse_timelines, 0, wx.ALL, 5)
self.SetSizer(sizer)
class other_buffers(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
@@ -264,6 +268,7 @@ class configurationDialog(wx.Dialog):
self.general = general(notebook)
notebook.AddPage(self.general, _(u"General"))
self.general.SetFocus()
self.Bind(wx.EVT_BUTTON, self.autocompletion, self.general.au)
self.buffers = other_buffers(notebook)
notebook.AddPage(self.buffers, _(u"Show other buffers"))
self.ignored_clients = ignoredClients(notebook)
@@ -285,6 +290,9 @@ class configurationDialog(wx.Dialog):
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def autocompletion(self, ev):
configuration = settings.autocompletionSettings(self.parent)
def check_followers_change(self):
if self.buffers.followers.GetValue() != self.buffers.followers_value:
if self.buffers.followers.GetValue() == True:

View File

@@ -30,6 +30,7 @@ from twython import TwythonError
from extra import translator, AudioUploader
import platform
from extra.AudioUploader import transfer
from extra.autocompletionUsers import completion
if platform.system() != "Darwin":
from extra.AudioUploader import dropbox_transfer
from extra.SpellChecker import gui as spellCheckerGUI
@@ -183,6 +184,8 @@ class tweet(textLimited):
self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Send"), size=wx.DefaultSize)
self.okButton.Bind(wx.EVT_BUTTON, self.onSend)
self.okButton.SetDefault()
autocompletionButton = wx.Button(self.panel, -1, _(u"&Autocomplete users"))
self.Bind(wx.EVT_BUTTON, self.autocompletion, autocompletionButton)
cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"Close"), size=wx.DefaultSize)
cancelButton.Bind(wx.EVT_BUTTON, self.onCancel)
self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL)
@@ -202,8 +205,11 @@ class tweet(textLimited):
self.mainBox.Add(self.ok_cancelSizer)
selectId = wx.NewId()
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
# autocompletionId = wx.NewId()
# self.Bind(wx.EVT_MENU, self.autocompletion, id=autocompletionId)
self.accel_tbl = wx.AcceleratorTable([
(wx.ACCEL_CTRL, ord('A'), selectId),
#(wx.ACCEL_ALT, ord('A'), autocompletionId),
])
self.SetAcceleratorTable(self.accel_tbl)
self.panel.SetSizer(self.mainBox)
@@ -215,6 +221,10 @@ class tweet(textLimited):
self.onTimer(wx.EVT_CHAR_HOOK)
self.SetClientSize(self.mainBox.CalcMin())
def autocompletion(self, event=None):
c = completion.autocompletionUsers(self)
c.show_menu()
def onUpload_image(self, ev):
if self.upload_image.GetLabel() == _(u"Discard image"):
self.image = None