mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-01-19 00:40:42 -06:00
Fixed #44.
This commit is contained in:
parent
66686c786d
commit
d521146562
@ -5,7 +5,7 @@ import widgetUtils
|
|||||||
class textLimited(widgetUtils.BaseDialog):
|
class textLimited(widgetUtils.BaseDialog):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(textLimited, self).__init__(parent=None, *args, **kwargs)
|
super(textLimited, self).__init__(parent=None, *args, **kwargs)
|
||||||
|
self.shift=False
|
||||||
def createTextArea(self, message="", text=""):
|
def createTextArea(self, message="", text=""):
|
||||||
self.panel = wx.Panel(self)
|
self.panel = wx.Panel(self)
|
||||||
self.label = wx.StaticText(self.panel, -1, message)
|
self.label = wx.StaticText(self.panel, -1, message)
|
||||||
@ -16,6 +16,8 @@ class textLimited(widgetUtils.BaseDialog):
|
|||||||
# dc.SetFont(font)
|
# dc.SetFont(font)
|
||||||
# x, y = dc.GetTextExtent("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
# x, y = dc.GetTextExtent("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
||||||
# self.text.SetSize((x, y))
|
# 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.text.SetFocus()
|
||||||
self.textBox = wx.BoxSizer(wx.HORIZONTAL)
|
self.textBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
self.textBox.Add(self.label, 0, wx.ALL, 5)
|
self.textBox.Add(self.label, 0, wx.ALL, 5)
|
||||||
@ -44,6 +46,16 @@ class textLimited(widgetUtils.BaseDialog):
|
|||||||
def onSelect(self, ev):
|
def onSelect(self, ev):
|
||||||
self.text.SelectAll()
|
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):
|
def set_cursor_at_end(self):
|
||||||
self.text.SetInsertionPoint(len(self.text.GetValue()))
|
self.text.SetInsertionPoint(len(self.text.GetValue()))
|
||||||
|
|
||||||
@ -90,8 +102,6 @@ class tweet(textLimited):
|
|||||||
self.mainBox.Add(self.ok_cancelSizer)
|
self.mainBox.Add(self.ok_cancelSizer)
|
||||||
selectId = wx.NewId()
|
selectId = wx.NewId()
|
||||||
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
|
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([
|
self.accel_tbl = wx.AcceleratorTable([
|
||||||
(wx.ACCEL_CTRL, ord('A'), selectId),
|
(wx.ACCEL_CTRL, ord('A'), selectId),
|
||||||
])
|
])
|
||||||
@ -110,14 +120,6 @@ class tweet(textLimited):
|
|||||||
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
||||||
return None
|
return None
|
||||||
return open(openFileDialog.GetPath(), "rb")
|
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):
|
class retweet(tweet):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user