mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-01-18 16:40:41 -06:00
Fixed #44.
This commit is contained in:
parent
66686c786d
commit
d521146562
@ -5,7 +5,7 @@ import widgetUtils
|
||||
class textLimited(widgetUtils.BaseDialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(textLimited, self).__init__(parent=None, *args, **kwargs)
|
||||
|
||||
self.shift=False
|
||||
def createTextArea(self, message="", text=""):
|
||||
self.panel = wx.Panel(self)
|
||||
self.label = wx.StaticText(self.panel, -1, message)
|
||||
@ -16,6 +16,8 @@ class textLimited(widgetUtils.BaseDialog):
|
||||
# dc.SetFont(font)
|
||||
# x, y = dc.GetTextExtent("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
||||
# self.text.SetSize((x, y))
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.on_enter)
|
||||
self.Bind(wx.EVT_CHAR_HOOK, self.handle_keys)
|
||||
self.text.SetFocus()
|
||||
self.textBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.textBox.Add(self.label, 0, wx.ALL, 5)
|
||||
@ -44,6 +46,16 @@ class textLimited(widgetUtils.BaseDialog):
|
||||
def onSelect(self, ev):
|
||||
self.text.SelectAll()
|
||||
|
||||
def on_enter(self,event):
|
||||
if self.shift==False and hasattr(self,'okButton'):
|
||||
return wx.PostEvent(self.okButton.GetEventHandler(),wx.PyCommandEvent(wx.EVT_BUTTON.typeId,wx.ID_OK))
|
||||
else:
|
||||
return self.text.WriteText('\n')
|
||||
|
||||
def handle_keys(self,event):
|
||||
self.shift=event.ShiftDown()
|
||||
event.Skip()
|
||||
|
||||
def set_cursor_at_end(self):
|
||||
self.text.SetInsertionPoint(len(self.text.GetValue()))
|
||||
|
||||
@ -90,8 +102,6 @@ class tweet(textLimited):
|
||||
self.mainBox.Add(self.ok_cancelSizer)
|
||||
selectId = wx.NewId()
|
||||
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.on_enter)
|
||||
self.Bind(wx.EVT_CHAR_HOOK, self.handle_keys)
|
||||
self.accel_tbl = wx.AcceleratorTable([
|
||||
(wx.ACCEL_CTRL, ord('A'), selectId),
|
||||
])
|
||||
@ -110,16 +120,8 @@ class tweet(textLimited):
|
||||
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
||||
return None
|
||||
return open(openFileDialog.GetPath(), "rb")
|
||||
def handle_keys(self,event):
|
||||
self.shift=event.ShiftDown()
|
||||
event.Skip()
|
||||
def on_enter(self,event):
|
||||
if self.shift==False:
|
||||
return wx.PostEvent(self.okButton.GetEventHandler(),wx.PyCommandEvent(wx.EVT_BUTTON.typeId,wx.ID_OK))
|
||||
else:
|
||||
return text.WriteText('\n')
|
||||
|
||||
|
||||
|
||||
class retweet(tweet):
|
||||
def createControls(self, title, message, text):
|
||||
self.mainBox = wx.BoxSizer(wx.VERTICAL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user