mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-18 06:06:06 -04:00
Changed how replies works in TWBlue
This commit is contained in:
@@ -5,6 +5,7 @@ import widgetUtils
|
||||
class textLimited(widgetUtils.BaseDialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(textLimited, self).__init__(parent=None, *args, **kwargs)
|
||||
|
||||
def createTextArea(self, message="", text=""):
|
||||
if not hasattr(self, "panel"):
|
||||
self.panel = wx.Panel(self)
|
||||
@@ -106,11 +107,10 @@ class tweet(textLimited):
|
||||
self.SetAcceleratorTable(self.accel_tbl)
|
||||
self.panel.SetSizer(self.mainBox)
|
||||
|
||||
def __init__(self, title, message, text):
|
||||
def __init__(self, title, message, text, *args, **kwargs):
|
||||
super(tweet, self).__init__()
|
||||
self.shift=False
|
||||
self.createControls(message, title, text)
|
||||
# self.onTimer(wx.EVT_CHAR_HOOK)
|
||||
self.SetClientSize(self.mainBox.CalcMin())
|
||||
|
||||
def get_image(self):
|
||||
@@ -166,7 +166,7 @@ class retweet(tweet):
|
||||
self.SetAcceleratorTable(self.accel_tbl)
|
||||
self.panel.SetSizer(self.mainBox)
|
||||
|
||||
def __init__(self, title, message, text):
|
||||
def __init__(self, title, message, text, *args, **kwargs):
|
||||
super(tweet, self).__init__()
|
||||
self.createControls(message, title, text)
|
||||
# self.onTimer(wx.EVT_CHAR_HOOK)
|
||||
@@ -218,7 +218,7 @@ class dm(textLimited):
|
||||
self.panel.SetSizer(self.mainBox)
|
||||
self.SetClientSize(self.mainBox.CalcMin())
|
||||
|
||||
def __init__(self, title, message, users):
|
||||
def __init__(self, title, message, users, *args, **kwargs):
|
||||
super(dm, self).__init__()
|
||||
self.createControls(message, title, users)
|
||||
# self.onTimer(wx.EVT_CHAR_HOOK)
|
||||
@@ -230,22 +230,77 @@ class dm(textLimited):
|
||||
def set_user(self, user):
|
||||
return self.cb.SetValue(user)
|
||||
|
||||
class reply(tweet):
|
||||
def __init__(self, title, message, text):
|
||||
super(reply, self).__init__(message, title, text)
|
||||
self.text.SetInsertionPoint(len(self.text.GetValue()))
|
||||
self.mentionAll = wx.CheckBox(self, -1, _(u"&Mention to all"), size=wx.DefaultSize)
|
||||
class reply(textLimited):
|
||||
|
||||
def get_image(self):
|
||||
openFileDialog = wx.FileDialog(self, _(u"Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
||||
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
||||
return None
|
||||
return open(openFileDialog.GetPath(), "rb")
|
||||
|
||||
def createControls(self, title, message, text):
|
||||
self.mainBox = wx.BoxSizer(wx.VERTICAL)
|
||||
self.createTextArea(message, text)
|
||||
self.mainBox.Add(self.textBox, 0, wx.ALL, 5)
|
||||
self.usersbox = wx.BoxSizer(wx.VERTICAL)
|
||||
self.mentionAll = wx.CheckBox(self.panel, -1, _(u"&Mention to all"), size=wx.DefaultSize)
|
||||
self.mentionAll.Disable()
|
||||
self.buttonsBox1.Add(self.mentionAll, 0, wx.ALL, 5)
|
||||
self.buttonsBox1.Layout()
|
||||
self.mainBox.Layout()
|
||||
self.usersbox.Add(self.mentionAll, 0, wx.ALL, 5)
|
||||
self.checkboxes = []
|
||||
for i in self.users:
|
||||
user_checkbox = wx.CheckBox(self.panel, -1, "@"+i, size=wx.DefaultSize)
|
||||
self.checkboxes.append(user_checkbox)
|
||||
self.usersbox.Add(self.checkboxes[-1], 0, wx.ALL, 5)
|
||||
self.mainBox.Add(self.usersbox, 0, wx.ALL, 10)
|
||||
self.long_tweet = wx.CheckBox(self.panel, -1, _(u"&Long tweet"))
|
||||
self.long_tweet.SetValue(True)
|
||||
self.upload_image = wx.Button(self.panel, -1, _(u"&Upload image..."), size=wx.DefaultSize)
|
||||
self.spellcheck = wx.Button(self.panel, -1, _("Check &spelling..."), size=wx.DefaultSize)
|
||||
self.attach = wx.Button(self.panel, -1, _(u"&Attach audio..."), size=wx.DefaultSize)
|
||||
self.shortenButton = wx.Button(self.panel, -1, _(u"Sh&orten URL"), size=wx.DefaultSize)
|
||||
self.unshortenButton = wx.Button(self.panel, -1, _(u"&Expand URL"), size=wx.DefaultSize)
|
||||
self.shortenButton.Disable()
|
||||
self.unshortenButton.Disable()
|
||||
self.translateButton = wx.Button(self.panel, -1, _(u"&Translate..."), size=wx.DefaultSize)
|
||||
self.autocompletionButton = wx.Button(self.panel, -1, _(u"Auto&complete users"))
|
||||
self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Sen&d"), size=wx.DefaultSize)
|
||||
self.okButton.SetDefault()
|
||||
cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize)
|
||||
self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.buttonsBox1.Add(self.upload_image, 0, wx.ALL, 10)
|
||||
self.buttonsBox1.Add(self.spellcheck, 0, wx.ALL, 10)
|
||||
self.buttonsBox1.Add(self.attach, 0, wx.ALL, 10)
|
||||
self.mainBox.Add(self.buttonsBox1, 0, wx.ALL, 10)
|
||||
self.buttonsBox2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.buttonsBox2.Add(self.shortenButton, 0, wx.ALL, 10)
|
||||
self.buttonsBox2.Add(self.unshortenButton, 0, wx.ALL, 10)
|
||||
self.buttonsBox2.Add(self.translateButton, 0, wx.ALL, 10)
|
||||
self.mainBox.Add(self.buttonsBox2, 0, wx.ALL, 10)
|
||||
self.ok_cancelSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.ok_cancelSizer.Add(self.autocompletionButton, 0, wx.ALL, 10)
|
||||
self.ok_cancelSizer.Add(self.okButton, 0, wx.ALL, 10)
|
||||
self.ok_cancelSizer.Add(cancelButton, 0, wx.ALL, 10)
|
||||
self.mainBox.Add(self.ok_cancelSizer, 0, wx.ALL, 10)
|
||||
selectId = wx.NewId()
|
||||
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
|
||||
self.accel_tbl = wx.AcceleratorTable([
|
||||
(wx.ACCEL_CTRL, ord('A'), selectId),
|
||||
])
|
||||
self.SetAcceleratorTable(self.accel_tbl)
|
||||
self.panel.SetSizer(self.mainBox)
|
||||
|
||||
def __init__(self, title, message, text, users=[], *args, **kwargs):
|
||||
self.users = users
|
||||
super(reply, self).__init__()
|
||||
self.shift=False
|
||||
self.createControls(message, title, text)
|
||||
self.SetClientSize(self.mainBox.CalcMin())
|
||||
|
||||
class viewTweet(widgetUtils.BaseDialog):
|
||||
def set_title(self, lenght):
|
||||
self.SetTitle(_(u"Tweet - %i characters ") % (lenght,))
|
||||
|
||||
def __init__(self, text, rt_count, favs_count,source):
|
||||
def __init__(self, text, rt_count, favs_count,source, *args, **kwargs):
|
||||
super(viewTweet, self).__init__(None, size=(850,850))
|
||||
panel = wx.Panel(self)
|
||||
label = wx.StaticText(panel, -1, _(u"Tweet"))
|
||||
@@ -337,7 +392,7 @@ class viewTweet(widgetUtils.BaseDialog):
|
||||
|
||||
class viewNonTweet(widgetUtils.BaseDialog):
|
||||
|
||||
def __init__(self, text):
|
||||
def __init__(self, text, *args, **kwargs):
|
||||
super(viewNonTweet, self).__init__(None, size=(850,850))
|
||||
self.SetTitle(_(u"View"))
|
||||
panel = wx.Panel(self)
|
||||
|
Reference in New Issue
Block a user