Show total characters used in the title bar for tweets and messages

This commit is contained in:
Manuel Cortez 2014-11-07 13:29:44 -06:00
parent 19a0a69d8c
commit 76a2b0b1ac
3 changed files with 55 additions and 6 deletions

View File

@ -217,7 +217,7 @@ class basePanel(wx.Panel):
self.onResponse(ev)
else:
user = self.db.settings[self.name_buffer][self.list.get_selected()]["user"]["screen_name"]
dlg = gui.dialogs.message.dm(_("Direct message to %s") % (user,), "", "", self)
dlg = gui.dialogs.message.dm(_("Direct message to %s") % (user,), _(u"New direct message"), "", self)
if dlg.ShowModal() == wx.ID_OK:
call_threaded(self.twitter.api_call, call_name="send_direct_message", _sound="dm_sent.ogg", text=dlg.text.GetValue(), screen_name=dlg.cb.GetValue())
# dlg.Destroy()
@ -240,7 +240,7 @@ class basePanel(wx.Panel):
ask = wx.MessageDialog(self.parent, _(u"Would you like to add a comment to this tweet?"), _("Retweet"), wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
response = ask.ShowModal()
if response == wx.ID_YES:
dlg = gui.dialogs.message.retweet(_(u"Add your comment to the tweet"), "", u"“@%s: %s" % (self.db.settings[self.name_buffer][self.list.get_selected()]["user"]["screen_name"], self.db.settings[self.name_buffer][self.list.get_selected()]["text"]), self)
dlg = gui.dialogs.message.retweet(_(u"Add your comment to the tweet"), _(u"Retweet"), u"“@%s: %s" % (self.db.settings[self.name_buffer][self.list.get_selected()]["user"]["screen_name"], self.db.settings[self.name_buffer][self.list.get_selected()]["text"]), self)
if dlg.ShowModal() == wx.ID_OK:
if dlg.image == None:
call_threaded(self.twitter.api_call, call_name="update_status", _sound="retweet_send.ogg", status=dlg.text.GetValue(), in_reply_to_status_id=dlg.in_reply_to)
@ -256,7 +256,7 @@ class basePanel(wx.Panel):
def onResponse(self, ev):
if self.name_buffer == "sent": return
dlg = gui.dialogs.message.reply(_(u"Reply to %s") % (self.db.settings[self.name_buffer][self.list.get_selected()]["user"]["screen_name"]), "", u"@%s " % (self.db.settings[self.name_buffer][self.list.get_selected()]["user"]["screen_name"]), self)
dlg = gui.dialogs.message.reply(_(u"Reply to %s") % (self.db.settings[self.name_buffer][self.list.get_selected()]["user"]["screen_name"]), _(u"Reply"), u"@%s " % (self.db.settings[self.name_buffer][self.list.get_selected()]["user"]["screen_name"]), self)
if dlg.ShowModal() == wx.ID_OK:
if dlg.image == None:
call_threaded(self.twitter.api_call, call_name="update_status", _sound="reply_send.ogg", in_reply_to_status_id=dlg.in_reply_to, status=dlg.text.GetValue())

View File

@ -39,11 +39,12 @@ class textLimited(wx.Dialog):
wx.Dialog.__init__(self, parent)
self.twitter = parent.twitter
self.parent = parent
self.SetTitle(_(u"New tweet"))
self.title = title
self.SetTitle(_(u"%s - %s of 140 characters") % (self.title, str(len(text))))
self.panel = wx.Panel(self)
def createTextArea(self, message, text):
self.label = wx.StaticText(self.panel, -1, str(len(text)))
self.label = wx.StaticText(self.panel, -1, message)
self.text = wx.TextCtrl(self.panel, -1, text)
font = self.text.GetFont()
dc = wx.WindowDC(self.text)
@ -139,7 +140,7 @@ class textLimited(wx.Dialog):
self.text.SetFocus()
def onTimer(self, ev):
self.label.SetLabel(str(len(self.text.GetValue())))
self.SetTitle(_(u"%s - %s of 140 characters") % (self.title, str(len(self.text.GetValue()))))
if len(self.text.GetValue()) > 1:
self.shortenButton.Enable()
self.unshortenButton.Enable()

View File

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
############################################################
# Copyright (c) 2014 Manuel Eduardo Cortéz Vallejo <manuel@manuelcortez.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
import wx
class trendingTopicsDialog(wx.Dialog):
def __init__(self):
super(searchDialog, self).__init__(None, -1)
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetTitle(_(u"Search on Twitter"))
label = wx.StaticText(panel, -1, _(u"Search"))
self.term = wx.TextCtrl(panel, -1,)
dc = wx.WindowDC(self.term)
dc.SetFont(self.term.GetFont())
self.term.SetSize(dc.GetTextExtent("0"*40))
sizer.Add(label, 0, wx.ALL, 5)
sizer.Add(self.term, 0, wx.ALL, 5)
self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
self.users = wx.RadioButton(panel, -1, _(u"Users"))
radioSizer = wx.BoxSizer(wx.HORIZONTAL)
radioSizer.Add(self.tweets, 0, wx.ALL, 5)
radioSizer.Add(self.users, 0, wx.ALL, 5)
sizer.Add(radioSizer, 0, wx.ALL, 5)
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
ok.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
btnsizer = wx.BoxSizer()
btnsizer.Add(ok, 0, wx.ALL, 5)
btnsizer.Add(cancel, 0, wx.ALL, 5)
sizer.Add(btnsizer, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())