mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-05-12 02:11:44 -04:00
Initial cleanup after automated refactoring.
This commit is contained in:
parent
9677d996d1
commit
8a05cd5600
@ -8,7 +8,7 @@ log = logging.getLogger("config")
|
||||
|
||||
MAINFILE = "twblue.conf"
|
||||
MAINSPEC = "app-configuration.defaults"
|
||||
proxyTypes=[u"http", u"https", u"socks4", u"socks5"]
|
||||
proxyTypes=["http", "https", "socks4", "socks5"]
|
||||
app = None
|
||||
keymap=None
|
||||
changed_keymap = False
|
||||
|
@ -21,7 +21,7 @@ class attach(object):
|
||||
imageInfo = {"type": "photo", "file": image, "description": description}
|
||||
log.debug("Image data to upload: %r" % (imageInfo,))
|
||||
self.attachments.append(imageInfo)
|
||||
info = [_(u"Photo"), description]
|
||||
info = [_("Photo"), description]
|
||||
self.dialog.attachments.insert_item(False, *info)
|
||||
self.dialog.remove.Enable(True)
|
||||
|
||||
|
@ -942,8 +942,8 @@ class Controller(object):
|
||||
x = tweet["coordinates"]["coordinates"][0]
|
||||
y = tweet["coordinates"]["coordinates"][1]
|
||||
address = geocoder.reverse_geocode(y, x)
|
||||
if event == None: output.speak(address[0].__str__().decode("utf-8"))
|
||||
else: self.view.show_address(address[0].__str__().decode("utf-8"))
|
||||
if event == None: output.speak(address[0].__str__())
|
||||
else: self.view.show_address(address[0].__str__())
|
||||
else:
|
||||
output.speak(_("There are no coordinates in this tweet"))
|
||||
except GeocoderError:
|
||||
|
@ -222,7 +222,7 @@ class viewTweet(basicTweet):
|
||||
rt_count = str(tweet["retweet_count"])
|
||||
favs_count = str(tweet["favorite_count"])
|
||||
# Gets the client from where this tweet was made.
|
||||
source = str(re.sub(r"(?s)<.*?>", "", tweet["source"].encode("utf-8")))
|
||||
source = str(re.sub(r"(?s)<.*?>", "", str(tweet["source"])))
|
||||
if text == "":
|
||||
if "message" in tweet:
|
||||
value = "message"
|
||||
@ -244,7 +244,7 @@ class viewTweet(basicTweet):
|
||||
for z in tweet["retweeted_status"]["extended_entities"]["media"]:
|
||||
if "ext_alt_text" in z and z["ext_alt_text"] != None:
|
||||
image_description.append(z["ext_alt_text"])
|
||||
self.message = message.viewTweet(text, rt_count, favs_count, source.decode("utf-8"))
|
||||
self.message = message.viewTweet(text, rt_count, favs_count, source)
|
||||
self.message.set_title(len(text))
|
||||
[self.message.set_image_description(i) for i in image_description]
|
||||
else:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import division
|
||||
|
||||
from builtins import str
|
||||
from past.utils import old_div
|
||||
from builtins import object
|
||||
@ -73,7 +73,7 @@ class globalSettingsController(object):
|
||||
self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"])
|
||||
self.dialog.set_value("general", "check_for_updates", config.app["app-settings"]["check_for_updates"])
|
||||
proxyTypes=config.proxyTypes
|
||||
self.dialog.create_proxy([_(u"Direct connection")]+proxyTypes)
|
||||
self.dialog.create_proxy([_("Direct connection")]+proxyTypes)
|
||||
if config.app["proxy"]["type"] not in proxyTypes:
|
||||
self.dialog.proxy.type.SetSelection(0)
|
||||
else:
|
||||
@ -138,11 +138,11 @@ class accountSettingsController(globalSettingsController):
|
||||
self.dialog.set_value("general", "reverse_timelines", self.config["general"]["reverse_timelines"])
|
||||
rt = self.config["general"]["retweet_mode"]
|
||||
if rt == "ask":
|
||||
self.dialog.set_value("general", "retweet_mode", _(u"Ask"))
|
||||
self.dialog.set_value("general", "retweet_mode", _("Ask"))
|
||||
elif rt == "direct":
|
||||
self.dialog.set_value("general", "retweet_mode", _(u"Retweet without comments"))
|
||||
self.dialog.set_value("general", "retweet_mode", _("Retweet without comments"))
|
||||
else:
|
||||
self.dialog.set_value("general", "retweet_mode", _(u"Retweet with comments"))
|
||||
self.dialog.set_value("general", "retweet_mode", _("Retweet with comments"))
|
||||
self.dialog.set_value("general", "persist_size", str(self.config["general"]["persist_size"]))
|
||||
self.dialog.create_other_buffers()
|
||||
buffer_values = self.get_buffers_list()
|
||||
@ -174,7 +174,7 @@ class accountSettingsController(globalSettingsController):
|
||||
language_index = OCRSpace.OcrLangs.index(self.config["mysc"]["ocr_language"])
|
||||
self.dialog.extras.ocr_lang.SetSelection(language_index)
|
||||
self.dialog.realize()
|
||||
self.dialog.set_title(_(u"Account settings for %s") % (self.user,))
|
||||
self.dialog.set_title(_("Account settings for %s") % (self.user,))
|
||||
self.response = self.dialog.get_response()
|
||||
|
||||
def save_configuration(self):
|
||||
@ -198,9 +198,9 @@ class accountSettingsController(globalSettingsController):
|
||||
self.needs_restart = True
|
||||
self.config["general"]["reverse_timelines"] = self.dialog.get_value("general", "reverse_timelines")
|
||||
rt = self.dialog.get_value("general", "retweet_mode")
|
||||
if rt == _(u"Ask"):
|
||||
if rt == _("Ask"):
|
||||
self.config["general"]["retweet_mode"] = "ask"
|
||||
elif rt == _(u"Retweet without comments"):
|
||||
elif rt == _("Retweet without comments"):
|
||||
self.config["general"]["retweet_mode"] = "direct"
|
||||
else:
|
||||
self.config["general"]["retweet_mode"] = "comment"
|
||||
@ -271,17 +271,17 @@ class accountSettingsController(globalSettingsController):
|
||||
|
||||
def get_buffers_list(self):
|
||||
all_buffers=OrderedDict()
|
||||
all_buffers['home']=_(u"Home")
|
||||
all_buffers['mentions']=_(u"Mentions")
|
||||
all_buffers['dm']=_(u"Direct Messages")
|
||||
all_buffers['sent_dm']=_(u"Sent direct messages")
|
||||
all_buffers['sent_tweets']=_(u"Sent tweets")
|
||||
all_buffers['favorites']=_(u"Likes")
|
||||
all_buffers['followers']=_(u"Followers")
|
||||
all_buffers['friends']=_(u"Friends")
|
||||
all_buffers['blocks']=_(u"Blocked users")
|
||||
all_buffers['muted']=_(u"Muted users")
|
||||
all_buffers['events']=_(u"Events")
|
||||
all_buffers['home']=_("Home")
|
||||
all_buffers['mentions']=_("Mentions")
|
||||
all_buffers['dm']=_("Direct Messages")
|
||||
all_buffers['sent_dm']=_("Sent direct messages")
|
||||
all_buffers['sent_tweets']=_("Sent tweets")
|
||||
all_buffers['favorites']=_("Likes")
|
||||
all_buffers['followers']=_("Followers")
|
||||
all_buffers['friends']=_("Friends")
|
||||
all_buffers['blocks']=_("Blocked users")
|
||||
all_buffers['muted']=_("Muted users")
|
||||
all_buffers['events']=_("Events")
|
||||
list_buffers = []
|
||||
hidden_buffers=[]
|
||||
for i in list(all_buffers.keys()):
|
||||
|
@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
############################################################
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import str
|
||||
from builtins import object
|
||||
import widgetUtils
|
||||
@ -53,7 +53,7 @@ class audioUploader(object):
|
||||
self.postprocess()
|
||||
log.debug("Uploading file %s to %s..." % (self.file, self.dialog.get("services")))
|
||||
self.uploaderDialog = wx_transfer_dialogs.UploadDialog(self.file)
|
||||
output.speak(_(u"Attaching..."))
|
||||
output.speak(_("Attaching..."))
|
||||
if self.dialog.get("services") == "SNDUp":
|
||||
base_url = "http://sndup.net/post.php"
|
||||
if len(self.config["sound"]["sndup_api_key"]) > 0:
|
||||
@ -70,12 +70,12 @@ class audioUploader(object):
|
||||
return services
|
||||
|
||||
def on_pause(self, *args, **kwargs):
|
||||
if self.dialog.get("pause") == _(u"Pause"):
|
||||
if self.dialog.get("pause") == _("Pause"):
|
||||
self.recording.pause()
|
||||
self.dialog.set("pause", _(u"&Resume"))
|
||||
elif self.dialog.get("pause") == _(u"Resume"):
|
||||
self.dialog.set("pause", _("&Resume"))
|
||||
elif self.dialog.get("pause") == _("Resume"):
|
||||
self.recording.play()
|
||||
self.dialog.set("pause", _(U"&Pause"))
|
||||
self.dialog.set("pause", _("&Pause"))
|
||||
|
||||
def on_record(self, *args, **kwargs):
|
||||
if self.recording != None:
|
||||
@ -90,19 +90,19 @@ class audioUploader(object):
|
||||
self.file = tempfile.mktemp(suffix='.wav')
|
||||
self.recording = sound.recording(self.file)
|
||||
self.recording.play()
|
||||
self.dialog.set("record", _(u"&Stop"))
|
||||
output.speak(_(u"Recording"))
|
||||
self.dialog.set("record", _("&Stop"))
|
||||
output.speak(_("Recording"))
|
||||
|
||||
def stop_recording(self):
|
||||
self.recording.stop()
|
||||
self.recording.free()
|
||||
output.speak(_(u"Stopped"))
|
||||
output.speak(_("Stopped"))
|
||||
self.recorded = True
|
||||
self.dialog.set("record", _(u"&Record"))
|
||||
self.dialog.set("record", _("&Record"))
|
||||
self.file_attached()
|
||||
|
||||
def file_attached(self):
|
||||
self.dialog.set("pause", _(u"&Pause"))
|
||||
self.dialog.set("pause", _("&Pause"))
|
||||
self.dialog.disable_control("record")
|
||||
self.dialog.enable_control("play")
|
||||
self.dialog.enable_control("discard")
|
||||
@ -123,7 +123,7 @@ class audioUploader(object):
|
||||
self.dialog.record.SetFocus()
|
||||
self.dialog.disable_control("discard")
|
||||
self.recording = None
|
||||
output.speak(_(u"Discarded"))
|
||||
output.speak(_("Discarded"))
|
||||
|
||||
def on_play(self, *args, **kwargs):
|
||||
if not self.playing:
|
||||
@ -132,30 +132,30 @@ class audioUploader(object):
|
||||
self._stop()
|
||||
|
||||
def _play(self):
|
||||
output.speak(_(u"Playing..."))
|
||||
output.speak(_("Playing..."))
|
||||
# try:
|
||||
self.playing = sound_lib.stream.FileStream(file=str(self.file), flags=sound_lib.stream.BASS_UNICODE)
|
||||
self.playing.play()
|
||||
self.dialog.set("play", _(u"&Stop"))
|
||||
self.dialog.set("play", _("&Stop"))
|
||||
try:
|
||||
while self.playing.is_playing:
|
||||
pass
|
||||
self.dialog.set("play", _(u"&Play"))
|
||||
self.dialog.set("play", _("&Play"))
|
||||
self.playing.free()
|
||||
self.playing = None
|
||||
except:
|
||||
pass
|
||||
|
||||
def _stop(self):
|
||||
output.speak(_(u"Stopped"))
|
||||
output.speak(_("Stopped"))
|
||||
self.playing.stop()
|
||||
self.playing.free()
|
||||
self.dialog.set("play", _(u"&Play"))
|
||||
self.dialog.set("play", _("&Play"))
|
||||
self.playing = None
|
||||
|
||||
def postprocess(self):
|
||||
if self.file.lower().endswith('.wav'):
|
||||
output.speak(_(u"Recoding audio..."))
|
||||
output.speak(_("Recoding audio..."))
|
||||
sound.recode_audio(self.file)
|
||||
self.wav_file = self.file
|
||||
self.file = '%s.ogg' % self.file[:-4]
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
|
||||
from builtins import object
|
||||
from past.utils import old_div
|
||||
import sys
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import division
|
||||
|
||||
from builtins import str
|
||||
from past.utils import old_div
|
||||
def convert_bytes(n):
|
||||
@ -27,19 +27,19 @@ def seconds_to_string(seconds, precision=0):
|
||||
sec_string = sec.__format__(sec_spec)
|
||||
string = ""
|
||||
if day == 1:
|
||||
string += _(u"%d day, ") % day
|
||||
string += _("%d day, ") % day
|
||||
elif day >= 2:
|
||||
string += _(u"%d days, ") % day
|
||||
string += _("%d days, ") % day
|
||||
if (hour == 1):
|
||||
string += _(u"%d hour, ") % hour
|
||||
string += _("%d hour, ") % hour
|
||||
elif (hour >= 2):
|
||||
string += _("%d hours, ") % hour
|
||||
if (min == 1):
|
||||
string += _(u"%d minute, ") % min
|
||||
string += _("%d minute, ") % min
|
||||
elif (min >= 2):
|
||||
string += _(u"%d minutes, ") % min
|
||||
string += _("%d minutes, ") % min
|
||||
if sec >= 0 and sec <= 2:
|
||||
string += _(u"%s second") % sec_string
|
||||
string += _("%s second") % sec_string
|
||||
else:
|
||||
string += _(u"%s seconds") % sec_string
|
||||
string += _("%s seconds") % sec_string
|
||||
return string
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from .utils import *
|
||||
import widgetUtils
|
||||
@ -11,28 +11,28 @@ class UploadDialog(widgetUtils.BaseDialog):
|
||||
self.pane = wx.Panel(self)
|
||||
self.progress_bar = wx.Gauge(parent=self.pane)
|
||||
fileBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
fileLabel = wx.StaticText(self.pane, -1, _(u"File"))
|
||||
fileLabel = wx.StaticText(self.pane, -1, _("File"))
|
||||
self.file = wx.TextCtrl(self.pane, -1, value=filename, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(200, 100))
|
||||
self.file.SetFocus()
|
||||
fileBox.Add(fileLabel)
|
||||
fileBox.Add(self.file)
|
||||
currentAmountBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
current_amount_label = wx.StaticText(self.pane, -1, _(u"Transferred"))
|
||||
current_amount_label = wx.StaticText(self.pane, -1, _("Transferred"))
|
||||
self.current_amount = wx.TextCtrl(self.pane, -1, value='0', style=wx.TE_READONLY|wx.TE_MULTILINE)
|
||||
currentAmountBox.Add(current_amount_label)
|
||||
currentAmountBox.Add(self.current_amount)
|
||||
totalSizeBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
total_size_label = wx.StaticText(self.pane, -1, _(u"Total file size"))
|
||||
total_size_label = wx.StaticText(self.pane, -1, _("Total file size"))
|
||||
self.total_size = wx.TextCtrl(self.pane, -1, value='0', style=wx.TE_READONLY|wx.TE_MULTILINE)
|
||||
totalSizeBox.Add(total_size_label)
|
||||
totalSizeBox.Add(self.total_size)
|
||||
speedBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
speedLabel = wx.StaticText(self.pane, -1, _(u"Transfer rate"))
|
||||
speedLabel = wx.StaticText(self.pane, -1, _("Transfer rate"))
|
||||
self.speed = wx.TextCtrl(self.pane, -1, style=wx.TE_READONLY|wx.TE_MULTILINE, value="0 Kb/s")
|
||||
speedBox.Add(speedLabel)
|
||||
speedBox.Add(self.speed)
|
||||
etaBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
etaLabel = wx.StaticText(self.pane, -1, _(u"Time left"))
|
||||
etaLabel = wx.StaticText(self.pane, -1, _("Time left"))
|
||||
self.eta = wx.TextCtrl(self.pane, -1, style=wx.TE_READONLY|wx.TE_MULTILINE, value="Unknown", size=(200, 100))
|
||||
etaBox.Add(etaLabel)
|
||||
etaBox.Add(self.eta)
|
||||
|
@ -25,29 +25,29 @@ log = logging.getLogger("extra.AudioUploader.wx_UI")
|
||||
class audioDialog(widgetUtils.BaseDialog):
|
||||
def __init__(self, services):
|
||||
log.debug("creating audio dialog.")
|
||||
super(audioDialog, self).__init__(None, -1, _(u"Attach audio"))
|
||||
super(audioDialog, self).__init__(None, -1, _("Attach audio"))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnSizer2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.play = wx.Button(panel, -1, _(u"&Play"))
|
||||
self.play = wx.Button(panel, -1, _("&Play"))
|
||||
self.play.Disable()
|
||||
self.pause = wx.Button(panel, -1, _(u"&Pause"))
|
||||
self.pause = wx.Button(panel, -1, _("&Pause"))
|
||||
self.pause.Disable()
|
||||
self.record = wx.Button(panel, -1, _(u"&Record"))
|
||||
self.record = wx.Button(panel, -1, _("&Record"))
|
||||
self.record.SetFocus()
|
||||
self.attach_exists = wx.Button(panel, -1, _(u"&Add an existing file"))
|
||||
self.discard = wx.Button(panel, -1, _(u"&Discard"))
|
||||
self.attach_exists = wx.Button(panel, -1, _("&Add an existing file"))
|
||||
self.discard = wx.Button(panel, -1, _("&Discard"))
|
||||
self.discard.Disable()
|
||||
label = wx.StaticText(panel, -1, _(u"Upload to"))
|
||||
label = wx.StaticText(panel, -1, _("Upload to"))
|
||||
self.services = wx.ComboBox(panel, -1, choices=services, value=services[0], style=wx.CB_READONLY)
|
||||
servicesBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
servicesBox.Add(label, 0, wx.ALL, 5)
|
||||
servicesBox.Add(self.services, 0, wx.ALL, 5)
|
||||
self.attach = wx.Button(panel, wx.ID_OK, _(u"Attach"))
|
||||
self.attach = wx.Button(panel, wx.ID_OK, _("Attach"))
|
||||
self.attach.Disable()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Cancel"))
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Cancel"))
|
||||
btnSizer.Add(self.play, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.pause, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.record, 0, wx.ALL, 5)
|
||||
@ -72,7 +72,7 @@ class audioDialog(widgetUtils.BaseDialog):
|
||||
getattr(self, control).Disable()
|
||||
|
||||
def get_file(self):
|
||||
openFileDialog = wx.FileDialog(self, _(u"Select the audio file to be uploaded"), "", "", _("Audio Files (*.mp3, *.ogg, *.wav)|*.mp3; *.ogg; *.wav"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
||||
openFileDialog = wx.FileDialog(self, _("Select the audio file to be uploaded"), "", "", _("Audio Files (*.mp3, *.ogg, *.wav)|*.mp3; *.ogg; *.wav"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
||||
if openFileDialog.ShowModal() == wx.ID_CANCEL:
|
||||
return False
|
||||
return openFileDialog.GetPath()
|
||||
|
@ -1,2 +1,2 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .soundsTutorial import soundsTutorial
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import object
|
||||
import platform
|
||||
import widgetUtils
|
||||
|
@ -1,30 +1,30 @@
|
||||
#-*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
#-*- coding: utf-8 -*-
|
||||
from . import reverse_sort
|
||||
import application
|
||||
actions = reverse_sort.reverse_sort([ ("audio", _(u"Audio tweet.")),
|
||||
("create_timeline", _(u"User timeline buffer created.")),
|
||||
("delete_timeline", _(u"Buffer destroied.")),
|
||||
("dm_received", _(u"Direct message received.")),
|
||||
("dm_sent", _(u"Direct message sent.")),
|
||||
("error", _(u"Error.")),
|
||||
("favourite", _(u"Tweet liked.")),
|
||||
("favourites_timeline_updated", _(u"Likes buffer updated.")),
|
||||
("geo", _(u"Geotweet.")),
|
||||
actions = reverse_sort.reverse_sort([ ("audio", _("Audio tweet.")),
|
||||
("create_timeline", _("User timeline buffer created.")),
|
||||
("delete_timeline", _("Buffer destroied.")),
|
||||
("dm_received", _("Direct message received.")),
|
||||
("dm_sent", _("Direct message sent.")),
|
||||
("error", _("Error.")),
|
||||
("favourite", _("Tweet liked.")),
|
||||
("favourites_timeline_updated", _("Likes buffer updated.")),
|
||||
("geo", _("Geotweet.")),
|
||||
("image", _("Tweet contains one or more images")),
|
||||
("limit", _(u"Boundary reached.")),
|
||||
("list_tweet", _(u"List updated.")),
|
||||
("max_length", _(u"Too many characters.")),
|
||||
("mention_received", _(u"Mention received.")),
|
||||
("new_event", _(u"New event.")),
|
||||
("ready", _(u"{0} is ready.").format(application.name,)),
|
||||
("reply_send", _(u"Mention sent.")),
|
||||
("retweet_send", _(u"Tweet retweeted.")),
|
||||
("search_updated", _(u"Search buffer updated.")),
|
||||
("tweet_received", _(u"Tweet received.")),
|
||||
("tweet_send", _(u"Tweet sent.")),
|
||||
("trends_updated", _(u"Trending topics buffer updated.")),
|
||||
("tweet_timeline", _(u"New tweet in user timeline buffer.")),
|
||||
("update_followers", _(u"New follower.")),
|
||||
("volume_changed", _(u"Volume changed."))])
|
||||
("limit", _("Boundary reached.")),
|
||||
("list_tweet", _("List updated.")),
|
||||
("max_length", _("Too many characters.")),
|
||||
("mention_received", _("Mention received.")),
|
||||
("new_event", _("New event.")),
|
||||
("ready", _("{0} is ready.").format(application.name,)),
|
||||
("reply_send", _("Mention sent.")),
|
||||
("retweet_send", _("Tweet retweeted.")),
|
||||
("search_updated", _("Search buffer updated.")),
|
||||
("tweet_received", _("Tweet received.")),
|
||||
("tweet_send", _("Tweet sent.")),
|
||||
("trends_updated", _("Trending topics buffer updated.")),
|
||||
("tweet_timeline", _("New tweet in user timeline buffer.")),
|
||||
("update_followers", _("New follower.")),
|
||||
("volume_changed", _("Volume changed."))])
|
||||
|
@ -5,16 +5,16 @@ import widgetUtils
|
||||
class soundsTutorialDialog(widgetUtils.BaseDialog):
|
||||
def __init__(self, actions):
|
||||
super(soundsTutorialDialog, self).__init__(None, -1)
|
||||
self.SetTitle(_(u"Sounds tutorial"))
|
||||
self.SetTitle(_("Sounds tutorial"))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
label = wx.StaticText(panel, -1, _(u"Press enter to listen to the sound for the selected event"))
|
||||
label = wx.StaticText(panel, -1, _("Press enter to listen to the sound for the selected event"))
|
||||
self.items = wx.ListBox(panel, 1, choices=actions, style=wx.LB_SINGLE)
|
||||
self.items.SetSelection(0)
|
||||
listBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
listBox.Add(label)
|
||||
listBox.Add(self.items)
|
||||
self.play = wx.Button(panel, 1, (u"Play"))
|
||||
self.play = wx.Button(panel, 1, ("Play"))
|
||||
self.play.SetDefault()
|
||||
close = wx.Button(panel, wx.ID_CANCEL)
|
||||
btnBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import spellchecker
|
||||
import platform
|
||||
if platform.system() == "Windows":
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import next
|
||||
from builtins import object
|
||||
import logging
|
||||
@ -45,8 +45,8 @@ class spellChecker(object):
|
||||
def check(self):
|
||||
try:
|
||||
next(self.checker)
|
||||
textToSay = _(u"Misspelled word: %s") % (self.checker.word,)
|
||||
context = u"... %s %s %s" % (self.checker.leading_context(10), self.checker.word, self.checker.trailing_context(10))
|
||||
textToSay = _("Misspelled word: %s") % (self.checker.word,)
|
||||
context = "... %s %s %s" % (self.checker.leading_context(10), self.checker.word, self.checker.trailing_context(10))
|
||||
self.dialog.set_title(textToSay)
|
||||
output.speak(textToSay)
|
||||
self.dialog.set_word_and_suggestions(word=self.checker.word, context=context, suggestions=self.checker.suggest())
|
||||
|
@ -23,25 +23,25 @@ class spellCheckerDialog(wx.Dialog):
|
||||
super(spellCheckerDialog, self).__init__(None, 1)
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
word = wx.StaticText(panel, -1, _(u"Misspelled word"))
|
||||
word = wx.StaticText(panel, -1, _("Misspelled word"))
|
||||
self.word = wx.TextCtrl(panel, -1)
|
||||
wordBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
wordBox.Add(word, 0, wx.ALL, 5)
|
||||
wordBox.Add(self.word, 0, wx.ALL, 5)
|
||||
context = wx.StaticText(panel, -1, _(u"Context"))
|
||||
context = wx.StaticText(panel, -1, _("Context"))
|
||||
self.context = wx.TextCtrl(panel, -1)
|
||||
contextBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
contextBox.Add(context, 0, wx.ALL, 5)
|
||||
contextBox.Add(self.context, 0, wx.ALL, 5)
|
||||
suggest = wx.StaticText(panel, -1, _(u"Suggestions"))
|
||||
suggest = wx.StaticText(panel, -1, _("Suggestions"))
|
||||
self.suggestions = wx.ListBox(panel, -1, choices=[], style=wx.LB_SINGLE)
|
||||
suggestionsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
suggestionsBox.Add(suggest, 0, wx.ALL, 5)
|
||||
suggestionsBox.Add(self.suggestions, 0, wx.ALL, 5)
|
||||
self.ignore = wx.Button(panel, -1, _(u"Ignore"))
|
||||
self.ignoreAll = wx.Button(panel, -1, _(u"Ignore all"))
|
||||
self.replace = wx.Button(panel, -1, _(u"Replace"))
|
||||
self.replaceAll = wx.Button(panel, -1, _(u"Replace all"))
|
||||
self.ignore = wx.Button(panel, -1, _("Ignore"))
|
||||
self.ignoreAll = wx.Button(panel, -1, _("Ignore all"))
|
||||
self.replace = wx.Button(panel, -1, _("Replace"))
|
||||
self.replaceAll = wx.Button(panel, -1, _("Replace all"))
|
||||
close = wx.Button(panel, wx.ID_CANCEL)
|
||||
btnBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnBox.Add(self.ignore, 0, wx.ALL, 5)
|
||||
@ -73,7 +73,7 @@ class spellCheckerDialog(wx.Dialog):
|
||||
return self.suggestions.GetStringSelection()
|
||||
|
||||
def dict_not_found_error():
|
||||
wx.MessageDialog(None, _(u"An error has occurred. There are no dictionaries available for the selected language in {0}").format(application.name,), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
wx.MessageDialog(None, _("An error has occurred. There are no dictionaries available for the selected language in {0}").format(application.name,), _("Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def finished():
|
||||
wx.MessageDialog(None, _(u"Spell check complete."), application.name, style=wx.OK).ShowModal()
|
||||
wx.MessageDialog(None, _("Spell check complete."), application.name, style=wx.OK).ShowModal()
|
||||
|
@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import completion, settings
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import object
|
||||
import output
|
||||
from . import storage
|
||||
@ -19,7 +19,7 @@ class autocompletionUsers(object):
|
||||
try:
|
||||
pattern = text.split()[-1]
|
||||
except IndexError:
|
||||
output.speak(_(u"You have to start writing"))
|
||||
output.speak(_("You have to start writing"))
|
||||
return
|
||||
if pattern.startswith("@") == True:
|
||||
menu = wx_menu.menu(self.window.text, pattern[1:], mode=mode)
|
||||
@ -29,15 +29,15 @@ class autocompletionUsers(object):
|
||||
self.window.popup_menu(menu)
|
||||
menu.destroy()
|
||||
else:
|
||||
output.speak(_(u"There are no results in your users database"))
|
||||
output.speak(_("There are no results in your users database"))
|
||||
else:
|
||||
output.speak(_(u"Autocompletion only works for users."))
|
||||
output.speak(_("Autocompletion only works for users."))
|
||||
elif mode == "dm":
|
||||
text = self.window.get_user()
|
||||
try:
|
||||
pattern = text.split()[-1]
|
||||
except IndexError:
|
||||
output.speak(_(u"You have to start writing"))
|
||||
output.speak(_("You have to start writing"))
|
||||
return
|
||||
menu = wx_menu.menu(self.window.cb, pattern, mode=mode)
|
||||
users = self.db.get_users(pattern)
|
||||
@ -46,4 +46,4 @@ class autocompletionUsers(object):
|
||||
self.window.popup_menu(menu)
|
||||
menu.destroy()
|
||||
else:
|
||||
output.speak(_(u"There are no results in your users database"))
|
||||
output.speak(_("There are no results in your users database"))
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from builtins import object
|
||||
from . import storage
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from builtins import object
|
||||
from . import storage
|
||||
@ -25,7 +25,7 @@ class autocompletionSettings(object):
|
||||
def add_users_to_database(self):
|
||||
self.config["mysc"]["save_friends_in_autocompletion_db"] = self.dialog.get("friends_buffer")
|
||||
self.config["mysc"]["save_followers_in_autocompletion_db"] = self.dialog.get("followers_buffer")
|
||||
output.speak(_(u"Updating database... You can close this window now. A message will tell you when the process finishes."))
|
||||
output.speak(_("Updating database... You can close this window now. A message will tell you when the process finishes."))
|
||||
database = storage.storage(self.buffer.session.session_id)
|
||||
if self.dialog.get("followers_buffer") == True:
|
||||
buffer = self.window.search_buffer("followers", self.config["twitter"]["user_name"])
|
||||
|
@ -5,15 +5,15 @@ from multiplatform_widgets import widgets
|
||||
import application
|
||||
class autocompletionManageDialog(widgetUtils.BaseDialog):
|
||||
def __init__(self):
|
||||
super(autocompletionManageDialog, self).__init__(parent=None, id=-1, title=_(u"Manage Autocompletion database"))
|
||||
super(autocompletionManageDialog, self).__init__(parent=None, id=-1, title=_("Manage Autocompletion database"))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
label = wx.StaticText(panel, -1, _(u"Editing {0} users database").format(application.name,))
|
||||
self.users = widgets.list(panel, _(u"Username"), _(u"Name"), style=wx.LC_REPORT)
|
||||
label = wx.StaticText(panel, -1, _("Editing {0} users database").format(application.name,))
|
||||
self.users = widgets.list(panel, _("Username"), _("Name"), style=wx.LC_REPORT)
|
||||
sizer.Add(label, 0, wx.ALL, 5)
|
||||
sizer.Add(self.users.list, 0, wx.ALL, 5)
|
||||
self.add = wx.Button(panel, -1, _(u"Add user"))
|
||||
self.remove = wx.Button(panel, -1, _(u"Remove user"))
|
||||
self.add = wx.Button(panel, -1, _("Add user"))
|
||||
self.remove = wx.Button(panel, -1, _("Remove user"))
|
||||
optionsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
optionsBox.Add(self.add, 0, wx.ALL, 5)
|
||||
optionsBox.Add(self.remove, 0, wx.ALL, 5)
|
||||
@ -34,10 +34,10 @@ class autocompletionManageDialog(widgetUtils.BaseDialog):
|
||||
|
||||
def get_user(self):
|
||||
usr = False
|
||||
userDlg = wx.TextEntryDialog(None, _(u"Twitter username"), _(u"Add user to database"))
|
||||
userDlg = wx.TextEntryDialog(None, _("Twitter username"), _("Add user to database"))
|
||||
if userDlg.ShowModal() == wx.ID_OK:
|
||||
usr = userDlg.GetValue()
|
||||
return usr
|
||||
|
||||
def show_invalid_user_error(self):
|
||||
wx.MessageDialog(None, _(u"The user does not exist"), _(u"Error!"), wx.ICON_ERROR).ShowModal()
|
||||
wx.MessageDialog(None, _("The user does not exist"), _("Error!"), wx.ICON_ERROR).ShowModal()
|
@ -5,14 +5,14 @@ import application
|
||||
|
||||
class autocompletionSettingsDialog(widgetUtils.BaseDialog):
|
||||
def __init__(self):
|
||||
super(autocompletionSettingsDialog, self).__init__(parent=None, id=-1, title=_(u"Autocomplete users' settings"))
|
||||
super(autocompletionSettingsDialog, self).__init__(parent=None, id=-1, title=_("Autocomplete users' settings"))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.followers_buffer = wx.CheckBox(panel, -1, _(u"Add users from followers buffer"))
|
||||
self.friends_buffer = wx.CheckBox(panel, -1, _(u"Add users from friends buffer"))
|
||||
self.followers_buffer = wx.CheckBox(panel, -1, _("Add users from followers buffer"))
|
||||
self.friends_buffer = wx.CheckBox(panel, -1, _("Add users from friends buffer"))
|
||||
sizer.Add(self.followers_buffer, 0, wx.ALL, 5)
|
||||
sizer.Add(self.friends_buffer, 0, wx.ALL, 5)
|
||||
self.viewList = wx.Button(panel, -1, _(u"Manage database..."))
|
||||
self.viewList = wx.Button(panel, -1, _("Manage database..."))
|
||||
sizer.Add(self.viewList, 0, wx.ALL, 5)
|
||||
ok = wx.Button(panel, wx.ID_OK)
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL)
|
||||
@ -24,4 +24,4 @@ class autocompletionSettingsDialog(widgetUtils.BaseDialog):
|
||||
self.SetClientSize(sizer.CalcMin())
|
||||
|
||||
def show_success_dialog():
|
||||
wx.MessageDialog(None, _(u"{0}'s database of users has been updated.").format(application.name,), _(u"Done"), wx.OK).ShowModal()
|
||||
wx.MessageDialog(None, _("{0}'s database of users has been updated.").format(application.name,), _("Done"), wx.OK).ShowModal()
|
@ -3,7 +3,7 @@
|
||||
from builtins import object
|
||||
import requests
|
||||
|
||||
translatable_langs = [_(u"Detect automatically"), _(u"Danish"), _(u"Dutch"), _(u"English"), _(u"Finnish"), _(u"French"), _(u"German"), _(u"Hungarian"), _(u"Korean"), _(u"Italian"), _(u"Japanese"), _(u"Polish"), _(u"Portuguese"), _(u"Russian"), _(u"Spanish"), _(u"Turkish")]
|
||||
translatable_langs = [_("Detect automatically"), _("Danish"), _("Dutch"), _("English"), _("Finnish"), _("French"), _("German"), _("Hungarian"), _("Korean"), _("Italian"), _("Japanese"), _("Polish"), _("Portuguese"), _("Russian"), _("Spanish"), _("Turkish")]
|
||||
short_langs = ["", "da", "du", "en", "fi", "fr", "de", "hu", "ko", "it", "ja", "pl", "pt", "ru", "es", "tr"]
|
||||
OcrLangs = ["", "dan", "dut", "eng", "fin", "fre", "ger", "hun", "kor", "ita", "jpn", "pol", "por", "rus", "spa", "tur"]
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import OCRSpace
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import translator
|
||||
import platform
|
||||
if platform.system() == "Windows":
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
""" This module contains some bugfixes for packages used in TWBlue."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import sys
|
||||
from . import fix_arrow # A few new locales for Three languages in arrow.
|
||||
from . import fix_urllib3_warnings # Avoiding some SSL warnings related to Twython.
|
||||
|
@ -5,7 +5,7 @@ import requests.sessions
|
||||
orig_session_init=requests.sessions.Session.__init__
|
||||
|
||||
def patched_where():
|
||||
return paths.app_path(u"cacert.pem")
|
||||
return paths.app_path("cacert.pem")
|
||||
|
||||
def fix(frozen):
|
||||
if frozen==True:
|
||||
|
@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
############################################################
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import object
|
||||
import keys
|
||||
import wx
|
||||
@ -29,9 +29,9 @@ from . import constants
|
||||
class reportBug(object):
|
||||
def __init__(self, user_name):
|
||||
self.user_name = user_name
|
||||
self.categories = [_(u"General")]
|
||||
self.reproducibilities = [_(u"always"), _(u"sometimes"), _(u"random"), _(u"have not tried"), _(u"unable to duplicate")]
|
||||
self.severities = [_(u"block"), _(u"crash"), _(u"major"), _(u"minor"), _(u"tweak"), _(u"text"), _(u"trivial"), _(u"feature")]
|
||||
self.categories = [_("General")]
|
||||
self.reproducibilities = [_("always"), _("sometimes"), _("random"), _("have not tried"), _("unable to duplicate")]
|
||||
self.severities = [_("block"), _("crash"), _("major"), _("minor"), _("tweak"), _("text"), _("trivial"), _("feature")]
|
||||
self.dialog = wx_ui.reportBugDialog(self.categories, self.reproducibilities, self.severities)
|
||||
widgetUtils.connect_event(self.dialog.ok, widgetUtils.BUTTON_PRESSED, self.send)
|
||||
self.dialog.get_response()
|
||||
|
@ -22,10 +22,10 @@ import application
|
||||
class reportBugDialog(widgetUtils.BaseDialog):
|
||||
def __init__(self, categories, reproducibilities, severities):
|
||||
super(reportBugDialog, self).__init__(parent=None, id=wx.NewId())
|
||||
self.SetTitle(_(u"Report an error"))
|
||||
self.SetTitle(_("Report an error"))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
categoryLabel = wx.StaticText(panel, -1, _(u"Select a category"), size=wx.DefaultSize)
|
||||
categoryLabel = wx.StaticText(panel, -1, _("Select a category"), size=wx.DefaultSize)
|
||||
self.category = wx.ComboBox(panel, -1, choices=categories, style=wx.CB_READONLY)
|
||||
self.category.SetSelection(0)
|
||||
categoryB = wx.BoxSizer(wx.HORIZONTAL)
|
||||
@ -33,7 +33,7 @@ class reportBugDialog(widgetUtils.BaseDialog):
|
||||
categoryB.Add(self.category, 0, wx.ALL, 5)
|
||||
self.category.SetFocus()
|
||||
sizer.Add(categoryB, 0, wx.ALL, 5)
|
||||
summaryLabel = wx.StaticText(panel, -1, _(u"Briefly describe what happened. You will be able to thoroughly explain it later"), size=wx.DefaultSize)
|
||||
summaryLabel = wx.StaticText(panel, -1, _("Briefly describe what happened. You will be able to thoroughly explain it later"), size=wx.DefaultSize)
|
||||
self.summary = wx.TextCtrl(panel, -1)
|
||||
dc = wx.WindowDC(self.summary)
|
||||
dc.SetFont(self.summary.GetFont())
|
||||
@ -42,7 +42,7 @@ class reportBugDialog(widgetUtils.BaseDialog):
|
||||
summaryB.Add(summaryLabel, 0, wx.ALL, 5)
|
||||
summaryB.Add(self.summary, 0, wx.ALL, 5)
|
||||
sizer.Add(summaryB, 0, wx.ALL, 5)
|
||||
descriptionLabel = wx.StaticText(panel, -1, _(u"Here, you can describe the bug in detail"), size=wx.DefaultSize)
|
||||
descriptionLabel = wx.StaticText(panel, -1, _("Here, you can describe the bug in detail"), size=wx.DefaultSize)
|
||||
self.description = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE)
|
||||
dc = wx.WindowDC(self.description)
|
||||
dc.SetFont(self.description.GetFont())
|
||||
@ -52,26 +52,26 @@ class reportBugDialog(widgetUtils.BaseDialog):
|
||||
descBox.Add(descriptionLabel, 0, wx.ALL, 5)
|
||||
descBox.Add(self.description, 0, wx.ALL, 5)
|
||||
sizer.Add(descBox, 0, wx.ALL, 5)
|
||||
reproducibilityLabel = wx.StaticText(panel, -1, _(u"how often does this bug happen?"), size=wx.DefaultSize)
|
||||
reproducibilityLabel = wx.StaticText(panel, -1, _("how often does this bug happen?"), size=wx.DefaultSize)
|
||||
self.reproducibility = wx.ComboBox(panel, -1, choices=reproducibilities, style=wx.CB_READONLY)
|
||||
self.reproducibility.SetSelection(3)
|
||||
reprB = wx.BoxSizer(wx.HORIZONTAL)
|
||||
reprB.Add(reproducibilityLabel, 0, wx.ALL, 5)
|
||||
reprB.Add(self.reproducibility, 0, wx.ALL, 5)
|
||||
sizer.Add(reprB, 0, wx.ALL, 5)
|
||||
severityLabel = wx.StaticText(panel, -1, _(u"Select the importance that you think this bug has"))
|
||||
severityLabel = wx.StaticText(panel, -1, _("Select the importance that you think this bug has"))
|
||||
self.severity = wx.ComboBox(panel, -1, choices=severities, style=wx.CB_READONLY)
|
||||
self.severity.SetSelection(3)
|
||||
severityB = wx.BoxSizer(wx.HORIZONTAL)
|
||||
severityB.Add(severityLabel, 0, wx.ALL, 5)
|
||||
severityB.Add(self.severity, 0, wx.ALL, 5)
|
||||
sizer.Add(severityB, 0, wx.ALL, 5)
|
||||
self.agree = wx.CheckBox(panel, -1, _(u"I know that the {0} bug system will get my Twitter username to contact me and fix the bug quickly").format(application.name,))
|
||||
self.agree = wx.CheckBox(panel, -1, _("I know that the {0} bug system will get my Twitter username to contact me and fix the bug quickly").format(application.name,))
|
||||
self.agree.SetValue(False)
|
||||
sizer.Add(self.agree, 0, wx.ALL, 5)
|
||||
self.ok = wx.Button(panel, wx.ID_OK, _(u"Send report"))
|
||||
self.ok = wx.Button(panel, wx.ID_OK, _("Send report"))
|
||||
self.ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Cancel"))
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _("Cancel"))
|
||||
btnBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnBox.Add(self.ok, 0, wx.ALL, 5)
|
||||
btnBox.Add(cancel, 0, wx.ALL, 5)
|
||||
@ -80,15 +80,15 @@ class reportBugDialog(widgetUtils.BaseDialog):
|
||||
self.SetClientSize(sizer.CalcMin())
|
||||
|
||||
def no_filled(self):
|
||||
wx.MessageDialog(self, _(u"You must fill out both fields"), _(u"Error"), wx.OK|wx.ICON_ERROR).ShowModal()
|
||||
wx.MessageDialog(self, _("You must fill out both fields"), _("Error"), wx.OK|wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def no_checkbox(self):
|
||||
wx.MessageDialog(self, _(u"You need to mark the checkbox to provide us your twitter username to contact you if it is necessary."), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
wx.MessageDialog(self, _("You need to mark the checkbox to provide us your twitter username to contact you if it is necessary."), _("Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def success(self, id):
|
||||
wx.MessageDialog(self, _(u"Thanks for reporting this bug! In future versions, you may be able to find it in the changes list. You've reported the bug number %i") % (id), _(u"reported"), wx.OK).ShowModal()
|
||||
wx.MessageDialog(self, _("Thanks for reporting this bug! In future versions, you may be able to find it in the changes list. You've reported the bug number %i") % (id), _("reported"), wx.OK).ShowModal()
|
||||
self.EndModal(wx.ID_OK)
|
||||
|
||||
def error(self):
|
||||
wx.MessageDialog(self, _(u"Something unexpected occurred while trying to report the bug. Please, try again later"), _(u"Error while reporting"), wx.ICON_ERROR|wx.OK).ShowModal()
|
||||
wx.MessageDialog(self, _("Something unexpected occurred while trying to report the bug. Please, try again later"), _("Error while reporting"), wx.ICON_ERROR|wx.OK).ShowModal()
|
||||
self.EndModal(wx.ID_CANCEL)
|
@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .main import KeyboardHandler, KeyboardHandlerError
|
||||
#from wx_handler import WXKeyboardHandler
|
||||
__all__ = ["KeyboardHandler", "KeyboardHandlerError", "WXKeyboardHandler", "WXPanelKeyboardHandler"]
|
||||
|
@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import platform
|
||||
if platform.system() == 'Linux':
|
||||
from .linux import LinuxKeyboardHandler as GlobalKeyboardHandler
|
||||
|
@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from builtins import chr
|
||||
|
@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import str
|
||||
from AppKit import *
|
||||
from PyObjCTools import AppHelper
|
||||
@ -53,6 +53,6 @@ class KeyboardCapturingNSApplication(NSApplication):
|
||||
def sendEvent_(self, theEvent):
|
||||
if theEvent.type() == NSSystemDefined and theEvent.subtype() == kEventHotKeyPressedSubtype:
|
||||
self.activateIgnoringOtherApps_(True)
|
||||
NSRunAlertPanel(u'Hot Key Pressed', u'Hot Key Pressed', None, None, None)
|
||||
NSRunAlertPanel('Hot Key Pressed', 'Hot Key Pressed', None, None, None)
|
||||
super(NSApplication, self).sendEvent_(theEvent)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import str
|
||||
import win32api
|
||||
import win32con
|
||||
|
@ -1,5 +1,5 @@
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
||||
from builtins import chr
|
||||
import functools
|
||||
import wx
|
||||
|
@ -1,2 +1,2 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .keystrokeEditor import KeystrokeEditor
|
@ -1,56 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
actions = {
|
||||
"up": _(u"Go up in the current buffer"),
|
||||
"down": _(u"Go down in the current buffer"),
|
||||
"left": _(u"Go to the previous buffer"),
|
||||
"right": _(u"Go to the next buffer"),
|
||||
"next_account": _(u"Focus the next session"),
|
||||
"previous_account": _(u"Focus the previous session"),
|
||||
"show_hide": _(u"Show or hide the GUI"),
|
||||
"post_tweet": _(u"New tweet"),
|
||||
"post_reply": _(u"Reply"),
|
||||
"post_retweet": _(u"Retweet"),
|
||||
"send_dm": _(u"Send direct message"),
|
||||
"add_to_favourites": _(u"Like a tweet"),
|
||||
"remove_from_favourites": _(u"Unlike a tweet"),
|
||||
"follow": _(u"Open the user actions dialogue"),
|
||||
"user_details": _(u"See user details"),
|
||||
"view_item": _(u"Show tweet"),
|
||||
"exit": _(u"Quit"),
|
||||
"open_timeline": _(u"Open user timeline"),
|
||||
"remove_buffer": _(u"Destroy buffer"),
|
||||
"interact": _(u"Interact with the currently focused tweet."),
|
||||
"url": _(u"Open URL"),
|
||||
"volume_up": _(u"Increase volume by 5%"),
|
||||
"volume_down": _(u"Decrease volume by 5%"),
|
||||
"go_home": _(u"Jump to the first element of a buffer"),
|
||||
"go_end": _(u"Jump to the last element of the current buffer"),
|
||||
"go_page_up": _(u"Jump 20 elements up in the current buffer"),
|
||||
"go_page_down": _(u"Jump 20 elements down in the current buffer"),
|
||||
"update_profile": _(u"Edit profile"),
|
||||
"delete": _(u"Delete a tweet or direct message"),
|
||||
"clear_buffer": _(u"Empty the current buffer"),
|
||||
"repeat_item": _(u"Repeat last item"),
|
||||
"copy_to_clipboard": _(u"Copy to clipboard"),
|
||||
"add_to_list": _(u"Add to list"),
|
||||
"remove_from_list": _(u"Remove from list"),
|
||||
"toggle_buffer_mute": _(u"Mute/unmute the active buffer"),
|
||||
"toggle_session_mute": _(u"Mute/unmute the current session"),
|
||||
"toggle_autoread": _(u"toggle the automatic reading of incoming tweets in the active buffer"),
|
||||
"search": _(u"Search on twitter"),
|
||||
"find": _(u"Find a string in the currently focused buffer"),
|
||||
"edit_keystrokes": _(u"Show the keystroke editor"),
|
||||
"view_user_lists": _(u"Show lists for a specified user"),
|
||||
"get_more_items": _(u"load previous items"),
|
||||
"reverse_geocode": _(u"Get geolocation"),
|
||||
"view_reverse_geocode": _(u"Display the tweet's geolocation in a dialog"),
|
||||
"get_trending_topics": _(u"Create a trending topics buffer"),
|
||||
"open_conversation": _(u"View conversation"),
|
||||
"check_for_updates": _(u"Check and download updates"),
|
||||
"lists_manager": _(u"Opens the list manager, which allows you to create, edit, delete and open lists in buffers."),
|
||||
"configuration": _(u"Opens the global settings dialogue"),
|
||||
"accountConfiguration": _(u"Opens the account settings dialogue"),
|
||||
"audio": _(u"Try to play an audio file"),
|
||||
"update_buffer": _(u"Updates the buffer and retrieves possible lost items there."),
|
||||
"ocr_image": _(u"Extracts the text from a picture and displays the result in a dialog."),
|
||||
"up": _("Go up in the current buffer"),
|
||||
"down": _("Go down in the current buffer"),
|
||||
"left": _("Go to the previous buffer"),
|
||||
"right": _("Go to the next buffer"),
|
||||
"next_account": _("Focus the next session"),
|
||||
"previous_account": _("Focus the previous session"),
|
||||
"show_hide": _("Show or hide the GUI"),
|
||||
"post_tweet": _("New tweet"),
|
||||
"post_reply": _("Reply"),
|
||||
"post_retweet": _("Retweet"),
|
||||
"send_dm": _("Send direct message"),
|
||||
"add_to_favourites": _("Like a tweet"),
|
||||
"remove_from_favourites": _("Unlike a tweet"),
|
||||
"follow": _("Open the user actions dialogue"),
|
||||
"user_details": _("See user details"),
|
||||
"view_item": _("Show tweet"),
|
||||
"exit": _("Quit"),
|
||||
"open_timeline": _("Open user timeline"),
|
||||
"remove_buffer": _("Destroy buffer"),
|
||||
"interact": _("Interact with the currently focused tweet."),
|
||||
"url": _("Open URL"),
|
||||
"volume_up": _("Increase volume by 5%"),
|
||||
"volume_down": _("Decrease volume by 5%"),
|
||||
"go_home": _("Jump to the first element of a buffer"),
|
||||
"go_end": _("Jump to the last element of the current buffer"),
|
||||
"go_page_up": _("Jump 20 elements up in the current buffer"),
|
||||
"go_page_down": _("Jump 20 elements down in the current buffer"),
|
||||
"update_profile": _("Edit profile"),
|
||||
"delete": _("Delete a tweet or direct message"),
|
||||
"clear_buffer": _("Empty the current buffer"),
|
||||
"repeat_item": _("Repeat last item"),
|
||||
"copy_to_clipboard": _("Copy to clipboard"),
|
||||
"add_to_list": _("Add to list"),
|
||||
"remove_from_list": _("Remove from list"),
|
||||
"toggle_buffer_mute": _("Mute/unmute the active buffer"),
|
||||
"toggle_session_mute": _("Mute/unmute the current session"),
|
||||
"toggle_autoread": _("toggle the automatic reading of incoming tweets in the active buffer"),
|
||||
"search": _("Search on twitter"),
|
||||
"find": _("Find a string in the currently focused buffer"),
|
||||
"edit_keystrokes": _("Show the keystroke editor"),
|
||||
"view_user_lists": _("Show lists for a specified user"),
|
||||
"get_more_items": _("load previous items"),
|
||||
"reverse_geocode": _("Get geolocation"),
|
||||
"view_reverse_geocode": _("Display the tweet's geolocation in a dialog"),
|
||||
"get_trending_topics": _("Create a trending topics buffer"),
|
||||
"open_conversation": _("View conversation"),
|
||||
"check_for_updates": _("Check and download updates"),
|
||||
"lists_manager": _("Opens the list manager, which allows you to create, edit, delete and open lists in buffers."),
|
||||
"configuration": _("Opens the global settings dialogue"),
|
||||
"accountConfiguration": _("Opens the account settings dialogue"),
|
||||
"audio": _("Try to play an audio file"),
|
||||
"update_buffer": _("Updates the buffer and retrieves possible lost items there."),
|
||||
"ocr_image": _("Extracts the text from a picture and displays the result in a dialog."),
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import object
|
||||
import widgetUtils
|
||||
import config
|
||||
|
@ -5,20 +5,20 @@ from wxUI.dialogs import baseDialog
|
||||
|
||||
class keystrokeEditorDialog(baseDialog.BaseWXDialog):
|
||||
def __init__(self):
|
||||
super(keystrokeEditorDialog, self).__init__(parent=None, id=-1, title=_(u"Keystroke editor"))
|
||||
super(keystrokeEditorDialog, self).__init__(parent=None, id=-1, title=_("Keystroke editor"))
|
||||
panel = wx.Panel(self)
|
||||
self.actions = []
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
keysText = wx.StaticText(panel, -1, _(u"Select a keystroke to edit"))
|
||||
self.keys = widgets.list(self, _(u"Action"), _(u"Keystroke"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(400, 450))
|
||||
keysText = wx.StaticText(panel, -1, _("Select a keystroke to edit"))
|
||||
self.keys = widgets.list(self, _("Action"), _("Keystroke"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(400, 450))
|
||||
self.keys.list.SetFocus()
|
||||
firstSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
firstSizer.Add(keysText, 0, wx.ALL, 5)
|
||||
firstSizer.Add(self.keys.list, 0, wx.ALL, 5)
|
||||
self.edit = wx.Button(panel, -1, _(u"Edit"))
|
||||
self.edit = wx.Button(panel, -1, _("Edit"))
|
||||
self.edit.SetDefault()
|
||||
self.execute = wx.Button(panel, -1, _(u"Execute action"))
|
||||
close = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
|
||||
self.execute = wx.Button(panel, -1, _("Execute action"))
|
||||
close = wx.Button(panel, wx.ID_CANCEL, _("Close"))
|
||||
secondSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
secondSizer.Add(self.edit, 0, wx.ALL, 5)
|
||||
secondSizer.Add(self.execute, 0, wx.ALL, 5)
|
||||
@ -45,24 +45,24 @@ class keystrokeEditorDialog(baseDialog.BaseWXDialog):
|
||||
|
||||
class editKeystrokeDialog(baseDialog.BaseWXDialog):
|
||||
def __init__(self):
|
||||
super(editKeystrokeDialog, self).__init__(parent=None, id=-1, title=_(u"Editing keystroke"))
|
||||
super(editKeystrokeDialog, self).__init__(parent=None, id=-1, title=_("Editing keystroke"))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.control = wx.CheckBox(panel, -1, _(u"Control"))
|
||||
self.alt = wx.CheckBox(panel, -1, _(u"Alt"))
|
||||
self.shift = wx.CheckBox(panel, -1, _(u"Shift"))
|
||||
self.win = wx.CheckBox(panel, -1, _(u"Windows"))
|
||||
self.control = wx.CheckBox(panel, -1, _("Control"))
|
||||
self.alt = wx.CheckBox(panel, -1, _("Alt"))
|
||||
self.shift = wx.CheckBox(panel, -1, _("Shift"))
|
||||
self.win = wx.CheckBox(panel, -1, _("Windows"))
|
||||
sizer1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
sizer1.Add(self.control)
|
||||
sizer1.Add(self.alt)
|
||||
sizer1.Add(self.shift)
|
||||
sizer1.Add(self.win)
|
||||
charLabel = wx.StaticText(panel, -1, _(u"Key"))
|
||||
charLabel = wx.StaticText(panel, -1, _("Key"))
|
||||
self.key = wx.TextCtrl(panel, -1)
|
||||
sizer2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
sizer2.Add(charLabel)
|
||||
sizer2.Add(self.key)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
||||
ok = wx.Button(panel, wx.ID_OK, _("OK"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL)
|
||||
sizer3 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
@ -75,7 +75,7 @@ class editKeystrokeDialog(baseDialog.BaseWXDialog):
|
||||
|
||||
|
||||
def no_win_message():
|
||||
return wx.MessageDialog(None, _(u"You need to use the Windows key"), _(u"Invalid keystroke"), wx.OK|wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("You need to use the Windows key"), _("Invalid keystroke"), wx.OK|wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def no_key():
|
||||
return wx.MessageDialog(None, _(u"You must provide a character for the keystroke"), _(u"Invalid keystroke"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("You must provide a character for the keystroke"), _("Invalid keystroke"), wx.ICON_ERROR).ShowModal()
|
@ -34,7 +34,7 @@ def localeNameToWindowsLCID(localeName):
|
||||
localeName=locale.normalize(localeName)
|
||||
if '.' in localeName:
|
||||
localeName=localeName.split('.')[0]
|
||||
LCList=[x[0] for x in locale.windows_locale.items() if x[1]==localeName]
|
||||
LCList=[x[0] for x in list(locale.windows_locale.items()) if x[1]==localeName]
|
||||
if len(LCList)>0:
|
||||
LCID=LCList[0]
|
||||
else:
|
||||
|
@ -7,7 +7,7 @@ import sys
|
||||
APP_LOG_FILE = 'debug.log'
|
||||
ERROR_LOG_FILE = "error.log"
|
||||
MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s"
|
||||
DATE_FORMAT = u"%d/%m/%Y %H:%M:%S"
|
||||
DATE_FORMAT = "%d/%m/%Y %H:%M:%S"
|
||||
|
||||
formatter = logging.Formatter(MESSAGE_FORMAT, datefmt=DATE_FORMAT)
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
############################################################
|
||||
from __future__ import print_function
|
||||
|
||||
from builtins import range
|
||||
import requests
|
||||
import keys
|
||||
@ -32,18 +32,18 @@ def get_twishort_uri(url):
|
||||
return False
|
||||
|
||||
def is_long(tweet):
|
||||
long = False
|
||||
longtw = False
|
||||
for url in range(0, len(tweet["entities"]["urls"])):
|
||||
try:
|
||||
if tweet["entities"]["urls"][url] != None and "twishort.com" in tweet["entities"]["urls"][url]["expanded_url"]:
|
||||
long = get_twishort_uri(tweet["entities"]["urls"][url]["expanded_url"])
|
||||
longtw = get_twishort_uri(tweet["entities"]["urls"][url]["expanded_url"])
|
||||
except IndexError:
|
||||
pass
|
||||
# sometimes Twitter returns URL's with None objects, so let's take it.
|
||||
# see https://github.com/manuelcortez/TWBlue/issues/103
|
||||
except TypeError:
|
||||
pass
|
||||
if int == False and "retweeted_status" in tweet:
|
||||
if not longtw and "retweeted_status" in tweet:
|
||||
for url in range(0, len(tweet["retweeted_status"]["entities"]["urls"])):
|
||||
try:
|
||||
if tweet["retweeted_status"]["entities"]["urls"][url] != None and "twishort.com" in tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"]:
|
||||
@ -52,7 +52,7 @@ def is_long(tweet):
|
||||
pass
|
||||
except TypeError:
|
||||
pass
|
||||
return int
|
||||
return longtw
|
||||
|
||||
def get_full_text(uri):
|
||||
try:
|
||||
@ -85,5 +85,4 @@ def create_tweet(user_token, user_secret, text, media=0):
|
||||
try:
|
||||
return response.json()["text_to_tweet"]
|
||||
except:
|
||||
print("There was a problem creating a long tweet")
|
||||
return 0
|
||||
log.exception("There was a problem creating a long tweet.")
|
@ -15,7 +15,7 @@ if system == "Windows":
|
||||
import languageHandler
|
||||
import paths
|
||||
#check if TWBlue is installed (Windows only)
|
||||
if os.path.exists(paths.app_path(u"Uninstall.exe")):
|
||||
if os.path.exists(paths.app_path("Uninstall.exe")):
|
||||
paths.mode="installed"
|
||||
import commandline
|
||||
import config
|
||||
|
@ -1,2 +1,2 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import widgets
|
@ -31,7 +31,7 @@ class list(object):
|
||||
if self.system == "Windows":
|
||||
self.list = wx.ListCtrl(parent, -1, **self.listArguments)
|
||||
for i in range(0, len(self.columns)):
|
||||
self.list.InsertColumn(i, u"%s" % (self.columns[i]))
|
||||
self.list.InsertColumn(i, "%s" % (self.columns[i]))
|
||||
else:
|
||||
self.list = wx.ListBox(parent, -1, choices=[])
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
""" A cross platform notification system.
|
||||
Under Linux, the wx.NotificationMessage does not show a notification on the taskbar, so we decided to use dbus for showing notifications for linux and wx for Windows."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import platform
|
||||
|
||||
notify = None
|
||||
|
16
src/paths.py
16
src/paths.py
@ -28,9 +28,9 @@ def config_path():
|
||||
global mode, directory
|
||||
if mode == "portable":
|
||||
if directory != None: path = os.path.join(directory, "config")
|
||||
elif directory == None: path = app_path(u"config")
|
||||
elif directory == None: path = app_path("config")
|
||||
elif mode == "installed":
|
||||
path = data_path(u"config")
|
||||
path = data_path("config")
|
||||
if not os.path.exists(path):
|
||||
log.debug("%s path does not exist, creating..." % (path,))
|
||||
os.mkdir(path)
|
||||
@ -41,9 +41,9 @@ def logs_path():
|
||||
global mode, directory
|
||||
if mode == "portable":
|
||||
if directory != None: path = os.path.join(directory, "logs")
|
||||
elif directory == None: path = app_path(u"logs")
|
||||
elif directory == None: path = app_path("logs")
|
||||
elif mode == "installed":
|
||||
path = data_path(u"logs")
|
||||
path = data_path("logs")
|
||||
if not os.path.exists(path):
|
||||
log.debug("%s path does not exist, creating..." % (path,))
|
||||
os.mkdir(path)
|
||||
@ -66,20 +66,20 @@ def data_path(app_name='TW blue'):
|
||||
|
||||
@merge_paths
|
||||
def locale_path():
|
||||
return app_path(u"locales")
|
||||
return app_path("locales")
|
||||
|
||||
@merge_paths
|
||||
def sound_path():
|
||||
return app_path(u"sounds")
|
||||
return app_path("sounds")
|
||||
|
||||
@merge_paths
|
||||
def com_path():
|
||||
global mode, directory
|
||||
if mode == "portable":
|
||||
if directory != None: path = os.path.join(directory, "com_cache")
|
||||
elif directory == None: path = app_path(u"com_cache")
|
||||
elif directory == None: path = app_path("com_cache")
|
||||
elif mode == "installed":
|
||||
path = data_path(u"com_cache")
|
||||
path = data_path("com_cache")
|
||||
if not os.path.exists(path):
|
||||
log.debug("%s path does not exist, creating..." % (path,))
|
||||
os.mkdir(path)
|
||||
|
@ -1,4 +1,4 @@
|
||||
from __future__ import print_function
|
||||
|
||||
from builtins import str
|
||||
import winreg
|
||||
import os
|
||||
|
@ -2,7 +2,7 @@ from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
import winreg
|
||||
|
||||
SHELL_REGKEY = ur"Directory\shell"
|
||||
SHELL_REGKEY = r"Directory\shell"
|
||||
|
||||
def context_menu_integrate(item_key_name, item_display_text, item_command):
|
||||
app_menu_key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, SHELL_REGKEY, 0, winreg.KEY_WRITE)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: cp1252 -*-
|
||||
#from config_utils import Configuration, ConfigurationResetException
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import object
|
||||
import config
|
||||
import paths
|
||||
|
@ -1,504 +1,6 @@
|
||||
<<<<<<< HEAD
|
||||
# -*- coding: utf-8 -*-
|
||||
""" The main session object. Here are the twitter functions to interact with the "model" of TWBlue."""
|
||||
import wx
|
||||
import urllib2
|
||||
import config
|
||||
import twitter
|
||||
from keys import keyring
|
||||
import session_exceptions as Exceptions
|
||||
import paths
|
||||
import output
|
||||
import time
|
||||
import sound
|
||||
import logging
|
||||
from twitter import utils, compose
|
||||
from twython import TwythonError, TwythonRateLimitError, TwythonAuthError
|
||||
import config_utils
|
||||
import shelve
|
||||
import application
|
||||
import os
|
||||
from mysc.thread_utils import stream_threaded, call_threaded
|
||||
from pubsub import pub
|
||||
log = logging.getLogger("sessionmanager.session")
|
||||
from long_tweets import tweets, twishort
|
||||
from wxUI import authorisationDialog
|
||||
|
||||
sessions = {}
|
||||
|
||||
class Session(object):
|
||||
""" A session object where we will save configuration, the twitter object and a local storage for saving the items retrieved through the Twitter API methods"""
|
||||
|
||||
# Decorators.
|
||||
|
||||
def _require_login(fn):
|
||||
|
||||
""" Decorator for checking if the user is logged in(a twitter object has credentials) on twitter.
|
||||
Some functions may need this to avoid making unneeded twitter API calls."""
|
||||
|
||||
def f(self, *args, **kwargs):
|
||||
if self.logged == True:
|
||||
fn(self, *args, **kwargs)
|
||||
else:
|
||||
raise Exceptions.NotLoggedSessionError("You are not logged in yet.")
|
||||
return f
|
||||
|
||||
def _require_configuration(fn):
|
||||
|
||||
""" Check if the user has a configured session."""
|
||||
|
||||
def f(self, *args, **kwargs):
|
||||
if self.settings != None:
|
||||
fn(self, *args, **kwargs)
|
||||
else:
|
||||
raise Exceptions.NotConfiguredSessionError("Not configured.")
|
||||
return f
|
||||
|
||||
def order_buffer(self, name, data, ignore_older=True):
|
||||
|
||||
""" Put the new items in the local database.
|
||||
name str: The name for the buffer stored in the dictionary.
|
||||
data list: A list with tweets.
|
||||
returns the number of items that have been added in this execution"""
|
||||
|
||||
num = 0
|
||||
last_id = None
|
||||
if self.db.has_key(name) == False:
|
||||
self.db[name] = []
|
||||
if ignore_older and len(self.db[name]) > 0:
|
||||
if self.settings["general"]["reverse_timelines"] == False:
|
||||
last_id = self.db[name][0]["id"]
|
||||
else:
|
||||
last_id = self.db[name][-1]["id"]
|
||||
for i in data:
|
||||
if ignore_older and last_id != None:
|
||||
if i["id"] < last_id:
|
||||
log.error("Ignoring an older tweet... Last id: {0}, tweet id: {1}".format(last_id, i["id"]))
|
||||
continue
|
||||
if utils.find_item(i["id"], self.db[name]) == None and utils.is_allowed(i, self.settings["twitter"]["ignored_clients"]) == True:
|
||||
try: i = self.check_quoted_status(i)
|
||||
except: pass
|
||||
i = self.check_long_tweet(i)
|
||||
if i == False: continue
|
||||
if self.settings["general"]["reverse_timelines"] == False: self.db[name].append(i)
|
||||
else: self.db[name].insert(0, i)
|
||||
num = num+1
|
||||
return num
|
||||
|
||||
def order_cursored_buffer(self, name, data):
|
||||
|
||||
""" Put the new items on the local database. Useful for cursored buffers (followers, friends, users of a list and searches)
|
||||
name str: The name for the buffer stored in the dictionary.
|
||||
data list: A list with items and some information about cursors.
|
||||
returns the number of items that have been added in this execution"""
|
||||
|
||||
num = 0
|
||||
if self.db.has_key(name) == False:
|
||||
self.db[name] = {}
|
||||
self.db[name]["items"] = []
|
||||
# if len(self.db[name]["items"]) > 0:
|
||||
for i in data:
|
||||
if utils.find_item(i["id"], self.db[name]["items"]) == None:
|
||||
if self.settings["general"]["reverse_timelines"] == False: self.db[name]["items"].append(i)
|
||||
else: self.db[name]["items"].insert(0, i)
|
||||
num = num+1
|
||||
return num
|
||||
|
||||
def __init__(self, session_id):
|
||||
|
||||
""" session_id (str): The name of the folder inside the config directory where the session is located."""
|
||||
|
||||
super(Session, self).__init__()
|
||||
self.session_id = session_id
|
||||
self.logged = False
|
||||
self.settings = None
|
||||
self.twitter = twitter.twitter.twitter()
|
||||
self.db={}
|
||||
self.reconnection_function_active = False
|
||||
self.counter = 0
|
||||
self.lists = []
|
||||
pub.subscribe(self.add_friends, "friends-receibed")
|
||||
|
||||
@property
|
||||
def is_logged(self):
|
||||
return self.logged
|
||||
|
||||
def get_configuration(self):
|
||||
|
||||
""" Gets settings for a session."""
|
||||
|
||||
file_ = "%s/session.conf" % (self.session_id,)
|
||||
# try:
|
||||
log.debug("Creating config file %s" % (file_,))
|
||||
self.settings = config_utils.load_config(paths.config_path(file_), paths.app_path("Conf.defaults"))
|
||||
self.init_sound()
|
||||
self.deshelve()
|
||||
# except:
|
||||
# log.exception("The session configuration has failed.")
|
||||
# self.settings = None
|
||||
|
||||
def init_sound(self):
|
||||
try: self.sound = sound.soundSystem(self.settings["sound"])
|
||||
except: log.exception("Exception thrown during sound system initialization")
|
||||
|
||||
@_require_configuration
|
||||
def login(self, verify_credentials=True):
|
||||
|
||||
""" Log into twitter using credentials from settings.
|
||||
if the user account isn't authorised, it needs to call self.authorise() before login."""
|
||||
|
||||
if self.settings["twitter"]["user_key"] != None and self.settings["twitter"]["user_secret"] != None:
|
||||
try:
|
||||
log.debug("Logging in to twitter...")
|
||||
self.twitter.login(self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], verify_credentials)
|
||||
self.logged = True
|
||||
log.debug("Logged.")
|
||||
self.counter = 0
|
||||
except:
|
||||
log.error("The login attempt failed.")
|
||||
self.logged = False
|
||||
else:
|
||||
self.logged = False
|
||||
raise Exceptions.RequireCredentialsSessionError
|
||||
|
||||
@_require_configuration
|
||||
def authorise(self):
|
||||
|
||||
""" Authorises a Twitter account. This function needs to be called for each new session, after self.get_configuration() and before self.login()"""
|
||||
|
||||
if self.logged == True:
|
||||
raise Exceptions.AlreadyAuthorisedError("The authorisation process is not needed at this time.")
|
||||
else:
|
||||
self.authorisation_thread = call_threaded(self.twitter.authorise, self.settings)
|
||||
self.authorisation_dialog = authorisationDialog()
|
||||
self.authorisation_dialog.cancel.Bind(wx.EVT_BUTTON, self.authorisation_cancelled)
|
||||
pub.subscribe(self.authorisation_accepted, "authorisation-accepted")
|
||||
self.authorisation_dialog.ShowModal()
|
||||
|
||||
def authorisation_cancelled(self, *args, **kwargs):
|
||||
pub.sendMessage("authorisation-cancelled")
|
||||
self.authorisation_dialog.Destroy()
|
||||
del self.authorisation_dialog
|
||||
|
||||
def authorisation_accepted(self):
|
||||
pub.unsubscribe(self.authorisation_accepted, "authorisation-accepted")
|
||||
self.authorisation_dialog.Destroy()
|
||||
|
||||
def get_more_items(self, update_function, users=False, name=None, *args, **kwargs):
|
||||
results = []
|
||||
data = getattr(self.twitter.twitter, update_function)(*args, **kwargs)
|
||||
if users == True:
|
||||
if type(data) == dict and data.has_key("next_cursor"):
|
||||
self.db[name]["cursor"] = data["next_cursor"]
|
||||
for i in data["users"]: results.append(i)
|
||||
elif type(data) == list:
|
||||
results.extend(data[1:])
|
||||
else:
|
||||
results.extend(data[1:])
|
||||
return results
|
||||
|
||||
def api_call(self, call_name, action="", _sound=None, report_success=False, report_failure=True, preexec_message="", *args, **kwargs):
|
||||
|
||||
""" Make a call to the Twitter API. If there is a connectionError or another exception not related to Twitter, It will call the method again at least 25 times, waiting a while between calls. Useful for post methods.
|
||||
If twitter returns an error, it will not call the method anymore.
|
||||
call_name str: The method to call
|
||||
action str: What you are doing on twitter, it will be reported to the user if report_success is set to True.
|
||||
for example "following @tw_blue2" will be reported as "following @tw_blue2 succeeded".
|
||||
_sound str: a sound to play if the call is executed properly.
|
||||
report_success and report_failure bool: These are self explanatory. True or False.
|
||||
preexec_message str: A message to speak to the user while the method is running, example: "trying to follow x user"."""
|
||||
|
||||
finished = False
|
||||
tries = 0
|
||||
if preexec_message:
|
||||
output.speak(preexec_message, True)
|
||||
while finished==False and tries < 25:
|
||||
try:
|
||||
val = getattr(self.twitter.twitter, call_name)(*args, **kwargs)
|
||||
finished = True
|
||||
except TwythonError as e:
|
||||
output.speak(e.message)
|
||||
if e.error_code != 403 and e.error_code != 404:
|
||||
tries = tries+1
|
||||
time.sleep(5)
|
||||
elif report_failure and hasattr(e, 'message'):
|
||||
output.speak(_("%s failed. Reason: %s") % (action, e.message))
|
||||
finished = True
|
||||
# except:
|
||||
# tries = tries + 1
|
||||
# time.sleep(5)
|
||||
if report_success:
|
||||
output.speak(_("%s succeeded.") % action)
|
||||
if _sound != None: self.sound.play(_sound)
|
||||
return val
|
||||
|
||||
def search(self, name, *args, **kwargs):
|
||||
tl = self.twitter.twitter.search(*args, **kwargs)
|
||||
tl["statuses"].reverse()
|
||||
return tl["statuses"]
|
||||
|
||||
@_require_login
|
||||
def get_favourites_timeline(self, name, *args, **kwargs):
|
||||
|
||||
""" Gets favourites for the authenticated user or a friend or follower.
|
||||
name str: Name for storage in the database."""
|
||||
|
||||
tl = self.call_paged(self.twitter.twitter.get_favorites, *args, **kwargs)
|
||||
return self.order_buffer(name, tl)
|
||||
|
||||
def call_paged(self, update_function, *args, **kwargs):
|
||||
|
||||
""" Makes a call to the Twitter API methods several times. Useful for get methods.
|
||||
this function is needed for retrieving more than 200 items.
|
||||
update_function str: The function to call. This function must be child of self.twitter.twitter
|
||||
returns a list with all items retrieved."""
|
||||
|
||||
max = int(self.settings["general"]["max_api_calls"])-1
|
||||
results = []
|
||||
data = getattr(self.twitter.twitter, update_function)(count=self.settings["general"]["max_tweets_per_call"], *args, **kwargs)
|
||||
results.extend(data)
|
||||
for i in range(0, max):
|
||||
if i == 0: max_id = results[-1]["id"]
|
||||
else: max_id = results[0]["id"]
|
||||
data = getattr(self.twitter.twitter, update_function)(max_id=max_id, count=self.settings["general"]["max_tweets_per_call"], *args, **kwargs)
|
||||
results.extend(data)
|
||||
results.reverse()
|
||||
return results
|
||||
|
||||
@_require_login
|
||||
def get_user_info(self):
|
||||
|
||||
""" Retrieves some information required by TWBlue for setup."""
|
||||
f = self.twitter.twitter.get_account_settings()
|
||||
sn = f["screen_name"]
|
||||
self.settings["twitter"]["user_name"] = sn
|
||||
self.db["user_name"] = sn
|
||||
self.db["user_id"] = self.twitter.twitter.show_user(screen_name=sn)["id_str"]
|
||||
try:
|
||||
self.db["utc_offset"] = f["time_zone"]["utc_offset"]
|
||||
except KeyError:
|
||||
self.db["utc_offset"] = -time.timezone
|
||||
self.get_lists()
|
||||
self.get_muted_users()
|
||||
self.settings.write()
|
||||
|
||||
@_require_login
|
||||
def get_lists(self):
|
||||
|
||||
""" Gets the lists that the user is subscribed to and stores them in the database. Returns None."""
|
||||
|
||||
self.db["lists"] = self.twitter.twitter.show_lists(reverse=True)
|
||||
|
||||
@_require_login
|
||||
def get_muted_users(self):
|
||||
|
||||
""" Gets muted users (oh really?)."""
|
||||
|
||||
self.db["muted_users"] = self.twitter.twitter.list_mute_ids()["ids"]
|
||||
|
||||
@_require_login
|
||||
def get_stream(self, name, function, *args, **kwargs):
|
||||
|
||||
""" Retrieves the items for a regular stream.
|
||||
name str: Name to save items to the database.
|
||||
function str: A function to get the items."""
|
||||
|
||||
last_id = -1
|
||||
if self.db.has_key(name):
|
||||
try:
|
||||
if self.db[name][0]["id"] > self.db[name][-1]["id"]:
|
||||
last_id = self.db[name][0]["id"]
|
||||
else:
|
||||
last_id = self.db[name][-1]["id"]
|
||||
except IndexError:
|
||||
pass
|
||||
tl = self.call_paged(function, sinze_id=last_id, *args, **kwargs)
|
||||
self.order_buffer(name, tl)
|
||||
|
||||
def get_cursored_stream(self, name, function, items="users", get_previous=False, *args, **kwargs):
|
||||
|
||||
""" Gets items for API calls that require using cursors to paginate the results.
|
||||
name str: Name to save it in the database.
|
||||
function str: Function that provides the items.
|
||||
items: When the function returns the list with results, items will tell how the order function should be look.
|
||||
for example get_followers_list returns a list and users are under list["users"], here the items should point to "users"."""
|
||||
|
||||
items_ = []
|
||||
try:
|
||||
if self.db[name].has_key("cursor") and get_previous:
|
||||
cursor = self.db[name]["cursor"]
|
||||
else:
|
||||
cursor = -1
|
||||
except KeyError:
|
||||
cursor = -1
|
||||
tl = getattr(self.twitter.twitter, function)(cursor=cursor, count=self.settings["general"]["max_tweets_per_call"], *args, **kwargs)
|
||||
tl[items].reverse()
|
||||
num = self.order_cursored_buffer(name, tl[items])
|
||||
self.db[name]["cursor"] = tl["next_cursor"]
|
||||
return num
|
||||
|
||||
def start_streaming(self):
|
||||
|
||||
""" Start the streaming for sending tweets in realtime."""
|
||||
if not hasattr(self, "main_stream"):
|
||||
self.get_timelines()
|
||||
if not hasattr(self, "timelinesStream"):
|
||||
self.get_main_stream()
|
||||
|
||||
def get_main_stream(self):
|
||||
log.debug("Starting the main stream...")
|
||||
self.main_stream = twitter.buffers.stream.streamer(keyring.get("api_key"), keyring.get("api_secret"), self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], self)
|
||||
stream_threaded(self.main_stream.user, self.session_id)
|
||||
|
||||
def get_timelines(self):
|
||||
log.debug("Starting the timelines stream...")
|
||||
self.timelinesStream = twitter.buffers.indibidual.timelinesStreamer(keyring.get("api_key"), keyring.get("api_secret"), self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], session=self)
|
||||
ids = ""
|
||||
for i in self.settings["other_buffers"]["timelines"]:
|
||||
ids = ids + "%s, " % (self.db[i+"-timeline"][0]["user"]["id_str"])
|
||||
for i in self.lists:
|
||||
for z in i.users:
|
||||
ids += str(z) + ", "
|
||||
if ids != "":
|
||||
# print ids
|
||||
stream_threaded(self.timelinesStream.statuses.filter, self.session_id, follow=ids)
|
||||
|
||||
def add_friends(self):
|
||||
try:
|
||||
# print "setting friends"
|
||||
self.timelinesStream.set_friends(self.main_stream.friends)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
def listen_stream_error(self):
|
||||
if hasattr(self, "main_stream"):
|
||||
log.debug("Disconnecting the main stream...")
|
||||
self.main_stream.disconnect()
|
||||
del self.main_stream
|
||||
if hasattr(self, "timelinesStream"):
|
||||
log.debug("disconnecting the timelines stream...")
|
||||
self.timelinesStream.disconnect()
|
||||
del self.timelinesStream
|
||||
|
||||
def check_connection(self):
|
||||
instan = 0
|
||||
self.counter += 1
|
||||
if self.counter >= 4:
|
||||
del self.twitter
|
||||
self.logged = False
|
||||
self.twitter = twitter.twitter.twitter()
|
||||
self.login(False)
|
||||
pub.sendMessage("restart_streams", session=self.session_id)
|
||||
if self.reconnection_function_active == True: return
|
||||
self.reconnection_function_active = True
|
||||
if not hasattr(self, "main_stream"):
|
||||
self.get_main_stream()
|
||||
if not hasattr(self, "timelinesStream"):
|
||||
self.get_timelines()
|
||||
self.reconnection_function_active = False
|
||||
if hasattr(self, "timelinesStream") and not hasattr(self.timelinesStream, "friends"):
|
||||
self.add_friends()
|
||||
# try:
|
||||
# urllib2.urlopen("http://74.125.228.231", timeout=5)
|
||||
# except urllib2.URLError:
|
||||
# pub.sendMessage("stream-error", session=self.session_id)
|
||||
|
||||
def remove_stream(self, stream):
|
||||
if stream == "timelinesStream":
|
||||
if hasattr(self, "timelinesStream"):
|
||||
self.timelinesStream.disconnect()
|
||||
del self.timelinesStream
|
||||
else:
|
||||
self.main_stream.disconnect()
|
||||
del self.main_stream
|
||||
|
||||
def shelve(self):
|
||||
"Shelve the database to allow for persistance."
|
||||
shelfname=paths.config_path(str(self.session_id)+"/cache.db")
|
||||
if self.settings["general"]["persist_size"] == 0:
|
||||
if os.path.exists(shelfname):
|
||||
os.remove(shelfname)
|
||||
return
|
||||
try:
|
||||
if not os.path.exists(shelfname):
|
||||
output.speak("Generating database, this might take a while.",True)
|
||||
shelf=shelve.open(paths.config_path(shelfname),'c')
|
||||
for key,value in self.db.items():
|
||||
if type(key) != str and type(key) != unicode:
|
||||
output.speak("Uh oh, while shelving the database, a key of type " + str(type(key)) + " has been found. It will be converted to type str, but this will cause all sorts of problems on deshelve. Please bring this to the attention of the " + application.name + " developers immediately. More information about the error will be written to the error log.",True)
|
||||
log.error("Uh oh, " + str(key) + " is of type " + str(type(key)) + "!")
|
||||
# Convert unicode objects to UTF-8 strings before shelve these objects.
|
||||
if type(value) == list and self.settings["general"]["persist_size"] != -1 and len(value) > self.settings["general"]["persist_size"]:
|
||||
shelf[str(key.encode("utf-8"))]=value[self.settings["general"]["persist_size"]:]
|
||||
else:
|
||||
shelf[str(key.encode("utf-8"))]=value
|
||||
shelf.close()
|
||||
except:
|
||||
output.speak("An exception occurred while shelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True)
|
||||
log.exception("Exception while shelving" + shelfname)
|
||||
os.remove(shelfname)
|
||||
|
||||
def deshelve(self):
|
||||
"Import a shelved database."
|
||||
shelfname=paths.config_path(str(self.session_id)+"/cache.db")
|
||||
if self.settings["general"]["persist_size"] == 0:
|
||||
if os.path.exists(shelfname):
|
||||
os.remove(shelfname)
|
||||
return
|
||||
try:
|
||||
shelf=shelve.open(paths.config_path(shelfname),'c')
|
||||
for key,value in shelf.items():
|
||||
self.db[key]=value
|
||||
shelf.close()
|
||||
except:
|
||||
output.speak("An exception occurred while deshelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True)
|
||||
log.exception("Exception while deshelving" + shelfname)
|
||||
try:
|
||||
os.remove(shelfname)
|
||||
except:
|
||||
pass
|
||||
|
||||
def check_quoted_status(self, tweet):
|
||||
status = tweets.is_long(tweet)
|
||||
if status != False and config.app["app-settings"]["handle_longtweets"]:
|
||||
tweet = self.get_quoted_tweet(tweet)
|
||||
return tweet
|
||||
|
||||
def get_quoted_tweet(self, tweet):
|
||||
quoted_tweet = tweet
|
||||
if tweet.has_key("full_text"):
|
||||
value = "full_text"
|
||||
else:
|
||||
value = "text"
|
||||
urls = utils.find_urls_in_text(quoted_tweet[value])
|
||||
for url in range(0, len(urls)):
|
||||
try: quoted_tweet[value] = quoted_tweet[value].replace(urls[url], quoted_tweet["entities"]["urls"][url]["expanded_url"])
|
||||
except IndexError: pass
|
||||
id = tweets.is_long(quoted_tweet)
|
||||
try: original_tweet = self.twitter.twitter.show_status(id=id, tweet_mode="extended")
|
||||
except: return quoted_tweet
|
||||
original_tweet = self.check_long_tweet(original_tweet)
|
||||
urls = utils.find_urls_in_text(original_tweet["full_text"])
|
||||
for url in range(0, len(urls)):
|
||||
try: original_tweet["full_text"] = original_tweet["full_text"].replace(urls[url], original_tweet["entities"]["urls"][url]["expanded_url"])
|
||||
except IndexError: pass
|
||||
return compose.compose_quoted_tweet(quoted_tweet, original_tweet)
|
||||
|
||||
def check_long_tweet(self, tweet):
|
||||
long = twishort.is_long(tweet)
|
||||
if long != False and config.app["app-settings"]["handle_longtweets"]:
|
||||
tweet["message"] = twishort.get_full_text(long)
|
||||
if tweet["message"] == False: return False
|
||||
tweet["twishort"] = True
|
||||
for i in tweet["entities"]["user_mentions"]:
|
||||
if "@%s" % (i["screen_name"]) not in tweet["message"] and i["screen_name"] != tweet["user"]["screen_name"]:
|
||||
if tweet.has_key("retweeted_status") and tweet["retweeted_status"]["user"]["screen_name"] == i["screen_name"]:
|
||||
continue
|
||||
tweet["message"] = u"@%s %s" % (i["screen_name"], tweet["message"])
|
||||
=======
|
||||
# -*- coding: utf-8 -*-
|
||||
""" The main session object. Here are the twitter functions to interact with the "model" of TWBlue."""
|
||||
from __future__ import absolute_import
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from builtins import str
|
||||
@ -676,10 +178,10 @@ class Session(object):
|
||||
results = []
|
||||
data = getattr(self.twitter.twitter, update_function)(*args, **kwargs)
|
||||
if users == True:
|
||||
if type(data) == dict and "cursor" in data:
|
||||
if isinstance(data, dict) and "cursor" in data:
|
||||
self.db[name]["cursor"] = data["next_cursor"]
|
||||
for i in data["users"]: results.append(i)
|
||||
elif type(data) == list:
|
||||
elif isinstance(data, list):
|
||||
results.extend(data[1:])
|
||||
else:
|
||||
results.extend(data[1:])
|
||||
@ -912,11 +414,11 @@ class Session(object):
|
||||
output.speak("Generating database, this might take a while.",True)
|
||||
shelf=shelve.open(paths.config_path(shelfname),'c')
|
||||
for key,value in list(self.db.items()):
|
||||
if type(key) != str and type(key) != str:
|
||||
if not isinstance(key, str) and not isinstance(key, str):
|
||||
output.speak("Uh oh, while shelving the database, a key of type " + str(type(key)) + " has been found. It will be converted to type str, but this will cause all sorts of problems on deshelve. Please bring this to the attention of the " + application.name + " developers immediately. More information about the error will be written to the error log.",True)
|
||||
log.error("Uh oh, " + str(key) + " is of type " + str(type(key)) + "!")
|
||||
# Convert unicode objects to UTF-8 strings before shelve these objects.
|
||||
if type(value) == list and self.settings["general"]["persist_size"] != -1 and len(value) > self.settings["general"]["persist_size"]:
|
||||
if isinstance(value, list) and self.settings["general"]["persist_size"] != -1 and len(value) > self.settings["general"]["persist_size"]:
|
||||
shelf[str(key.encode("utf-8"))]=value[self.settings["general"]["persist_size"]:]
|
||||
else:
|
||||
shelf[str(key.encode("utf-8"))]=value
|
||||
@ -973,15 +475,14 @@ class Session(object):
|
||||
return compose.compose_quoted_tweet(quoted_tweet, original_tweet)
|
||||
|
||||
def check_long_tweet(self, tweet):
|
||||
long = twishort.is_long(tweet)
|
||||
if int != False and config.app["app-settings"]["handle_longtweets"]:
|
||||
tweet["message"] = twishort.get_full_text(int)
|
||||
longtw = twishort.is_long(tweet)
|
||||
if longtw and config.app["app-settings"]["handle_longtweets"]:
|
||||
tweet["message"] = twishort.get_full_text(longtw)
|
||||
if tweet["message"] == False: return False
|
||||
tweet["twishort"] = True
|
||||
for i in tweet["entities"]["user_mentions"]:
|
||||
if "@%s" % (i["screen_name"]) not in tweet["message"] and i["screen_name"] != tweet["user"]["screen_name"]:
|
||||
if "retweeted_status" in tweet and tweet["retweeted_status"]["user"]["screen_name"] == i["screen_name"]:
|
||||
continue
|
||||
tweet["message"] = u"@%s %s" % (i["screen_name"], tweet["message"])
|
||||
>>>>>>> Prepare for py3 port.
|
||||
tweet["message"] = "@%s %s" % (i["screen_name"], tweet["message"])
|
||||
return tweet
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
from builtins import str
|
||||
from builtins import object
|
||||
import shutil
|
||||
|
@ -4,18 +4,18 @@ from multiplatform_widgets import widgets
|
||||
import application
|
||||
class sessionManagerWindow(wx.Dialog):
|
||||
def __init__(self):
|
||||
super(sessionManagerWindow, self).__init__(parent=None, title=_(u"Session manager"), size=wx.DefaultSize)
|
||||
super(sessionManagerWindow, self).__init__(parent=None, title=_("Session manager"), size=wx.DefaultSize)
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
label = wx.StaticText(panel, -1, _(u"Accounts list"), size=wx.DefaultSize)
|
||||
label = wx.StaticText(panel, -1, _("Accounts list"), size=wx.DefaultSize)
|
||||
listSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.list = widgets.list(panel, _(u"Account"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT)
|
||||
self.list = widgets.list(panel, _("Account"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT)
|
||||
listSizer.Add(label, 0, wx.ALL, 5)
|
||||
listSizer.Add(self.list.list, 0, wx.ALL, 5)
|
||||
sizer.Add(listSizer, 0, wx.ALL, 5)
|
||||
self.new = wx.Button(panel, -1, _(u"New account"), size=wx.DefaultSize)
|
||||
self.remove = wx.Button(panel, -1, _(u"Remove account"))
|
||||
self.configuration = wx.Button(panel, -1, _(u"Global Settings"))
|
||||
self.new = wx.Button(panel, -1, _("New account"), size=wx.DefaultSize)
|
||||
self.remove = wx.Button(panel, -1, _("Remove account"))
|
||||
self.configuration = wx.Button(panel, -1, _("Global Settings"))
|
||||
ok = wx.Button(panel, wx.ID_OK, size=wx.DefaultSize)
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, size=wx.DefaultSize)
|
||||
@ -38,29 +38,29 @@ class sessionManagerWindow(wx.Dialog):
|
||||
|
||||
def ok(self, ev):
|
||||
if self.list.get_count() == 0:
|
||||
wx.MessageDialog(None, _(u"You need to configure an account."), _(u"Account Error"), wx.ICON_ERROR).ShowModal()
|
||||
wx.MessageDialog(None, _("You need to configure an account."), _("Account Error"), wx.ICON_ERROR).ShowModal()
|
||||
return
|
||||
self.controller.do_ok()
|
||||
self.EndModal(wx.ID_OK)
|
||||
|
||||
def new_account_dialog(self):
|
||||
return wx.MessageDialog(self, _(u"The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?"), _(u"Authorization"), wx.YES_NO).ShowModal()
|
||||
return wx.MessageDialog(self, _("The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?"), _("Authorization"), wx.YES_NO).ShowModal()
|
||||
|
||||
def add_new_session_to_list(self):
|
||||
total = self.list.get_count()
|
||||
name = _(u"Authorized account %d") % (total+1)
|
||||
name = _("Authorized account %d") % (total+1)
|
||||
self.list.insert_item(False, name)
|
||||
if self.list.get_count() == 1:
|
||||
self.list.select_item(0)
|
||||
|
||||
def show_unauthorised_error(self):
|
||||
wx.MessageDialog(None, _(u"Your access token is invalid or the authorization has failed. Please try again."), _(u"Invalid user token"), wx.ICON_ERROR).ShowModal()
|
||||
wx.MessageDialog(None, _("Your access token is invalid or the authorization has failed. Please try again."), _("Invalid user token"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def get_response(self):
|
||||
return self.ShowModal()
|
||||
|
||||
def remove_account_dialog(self):
|
||||
return wx.MessageDialog(self, _(u"Do you really want to delete this account?"), _(u"Remove account"), wx.YES_NO).ShowModal()
|
||||
return wx.MessageDialog(self, _("Do you really want to delete this account?"), _("Remove account"), wx.YES_NO).ShowModal()
|
||||
|
||||
def get_selected(self):
|
||||
return self.list.get_selected()
|
||||
@ -74,16 +74,3 @@ class sessionManagerWindow(wx.Dialog):
|
||||
|
||||
def destroy(self):
|
||||
self.Destroy()
|
||||
|
||||
class authorisationDialog(wx.Dialog):
|
||||
def __init__(self):
|
||||
super(authorisationDialog, self).__init__(parent=None, title=_(u"Authorising account..."))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.text = wx.TextCtrl(panel, -1, _("Waiting for account authorisation..."), style=wx.TE_READONLY|wx.TE_MULTILINE)
|
||||
self.cancel = wx.Button(panel, wx.ID_CANCEL)
|
||||
sizer.Add(self.text, 0, wx.ALL, 5)
|
||||
sizer.Add(self.cancel, 0, wx.ALL, 5)
|
||||
panel.SetSizer(sizer)
|
||||
min = sizer.CalcMin()
|
||||
self.SetClientSize(min)
|
@ -54,7 +54,7 @@ def get_data():
|
||||
|
||||
def get_documentation ():
|
||||
answer = [("documentation", ["documentation/license.txt"])]
|
||||
depth = 20
|
||||
depth = 10
|
||||
for root, dirs, files in os.walk('documentation'):
|
||||
if depth == 0:
|
||||
break
|
||||
@ -102,7 +102,7 @@ def wx_files():
|
||||
if __name__ == '__main__':
|
||||
setup(
|
||||
name = application.name,
|
||||
author = u", ".join(application.authors),
|
||||
author = ", ".join(application.authors),
|
||||
author_email = application.authorEmail,
|
||||
version = application.version,
|
||||
url = application.url,
|
||||
|
@ -147,7 +147,7 @@ class URLStream(object):
|
||||
elif stream != None:
|
||||
self.stream=stream
|
||||
if self.prepared == True:
|
||||
self.stream = SoundlibURLStream(url=self.url)
|
||||
self.stream = SoundlibURLStream(url=bytes(self.url,'utf-8'))
|
||||
if hasattr(self,'stream'):
|
||||
self.stream.volume = float(volume)
|
||||
self.stream.play()
|
||||
|
@ -1,2 +1,2 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import buffers, utils, compose, twitter
|
||||
|
@ -1,6 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
import http.server
|
||||
import application
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
@ -19,5 +17,5 @@ class handler(http.server.BaseHTTPRequestHandler):
|
||||
params = parse_qs(urlparse(self.path).query)
|
||||
global verifier
|
||||
verifier = params.get('oauth_verifier', [None])[0]
|
||||
self.wfile.write("You have successfully logged into Twitter with {0}. You can close this window now.".format(application.name))
|
||||
self.wfile.write(bytes(_("You have successfully logged into Twitter with {0}. You can close this window now.".format(application.name)),"utf-8"))
|
||||
self.finish()
|
||||
|
@ -1,2 +1,2 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import stream, indibidual
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from builtins import object
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import division
|
||||
|
||||
from builtins import str
|
||||
from past.utils import old_div
|
||||
def convert_bytes(n):
|
||||
@ -27,19 +27,19 @@ def seconds_to_string(seconds, precision=0):
|
||||
sec_string = sec.__format__(sec_spec)
|
||||
string = ""
|
||||
if day == 1:
|
||||
string += _(u"%d day, ") % day
|
||||
string += _("%d day, ") % day
|
||||
elif day >= 2:
|
||||
string += _(u"%d days, ") % day
|
||||
string += _("%d days, ") % day
|
||||
if (hour == 1):
|
||||
string += _(u"%d hour, ") % hour
|
||||
string += _("%d hour, ") % hour
|
||||
elif (hour >= 2):
|
||||
string += _("%d hours, ") % hour
|
||||
if (min == 1):
|
||||
string += _(u"%d minute, ") % min
|
||||
string += _("%d minute, ") % min
|
||||
elif (min >= 2):
|
||||
string += _(u"%d minutes, ") % min
|
||||
string += _("%d minutes, ") % min
|
||||
if sec >= 0 and sec <= 2:
|
||||
string += _(u"%s second") % sec_string
|
||||
string += _("%s second") % sec_string
|
||||
else:
|
||||
string += _(u"%s seconds") % sec_string
|
||||
string += _("%s seconds") % sec_string
|
||||
return string
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
|
||||
|
||||
from builtins import str
|
||||
from past.utils import old_div
|
||||
import wx
|
||||
@ -10,7 +10,7 @@ from . import utils
|
||||
progress_dialog = None
|
||||
|
||||
def available_update_dialog(version, description, date):
|
||||
dialog = wx.MessageDialog(None, _(u"There's a new %s version available, released on %s. Would you like to download it now?\n\n %s version: %s\n\nChanges:\n%s") % (application.name, date, application.name, version, description), _(u"New version for %s") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING)
|
||||
dialog = wx.MessageDialog(None, _("There's a new %s version available, released on %s. Would you like to download it now?\n\n %s version: %s\n\nChanges:\n%s") % (application.name, date, application.name, version, description), _("New version for %s") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING)
|
||||
if dialog.ShowModal() == wx.ID_YES:
|
||||
return True
|
||||
else:
|
||||
@ -18,7 +18,7 @@ def available_update_dialog(version, description, date):
|
||||
|
||||
|
||||
def create_progress_dialog():
|
||||
return wx.ProgressDialog(_(u"Download in Progress"), _(u"Downloading the new version..."), parent=None, maximum=100)
|
||||
return wx.ProgressDialog(_("Download in Progress"), _("Downloading the new version..."), parent=None, maximum=100)
|
||||
|
||||
def progress_callback(total_downloaded, total_size):
|
||||
global progress_dialog
|
||||
@ -28,7 +28,7 @@ def progress_callback(total_downloaded, total_size):
|
||||
if total_downloaded == total_size:
|
||||
progress_dialog.Destroy()
|
||||
else:
|
||||
progress_dialog.Update(old_div((total_downloaded*100),total_size), _(u"Updating... %s of %s") % (str(utils.convert_bytes(total_downloaded)), str(utils.convert_bytes(total_size))))
|
||||
progress_dialog.Update(old_div((total_downloaded*100),total_size), _("Updating... %s of %s") % (str(utils.convert_bytes(total_downloaded)), str(utils.convert_bytes(total_size))))
|
||||
|
||||
def update_finished():
|
||||
ms = wx.MessageDialog(None, _(u"The update has been downloaded and installed successfully. Press OK to continue."), _(u"Done!")).ShowModal()
|
||||
ms = wx.MessageDialog(None, _("The update has been downloaded and installed successfully. Press OK to continue."), _("Done!")).ShowModal()
|
@ -1,3 +1,3 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import shorteners
|
||||
from .__main__ import *
|
||||
|
@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from functools import wraps
|
||||
from . import shorteners
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import platform
|
||||
if platform.system() == "Windows":
|
||||
from .wxUtils import *
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .base import basePanel
|
||||
from .dm import dmPanel
|
||||
from .events import eventsPanel
|
||||
|
@ -8,7 +8,7 @@ class basePanel(wx.Panel):
|
||||
self.list.list.Bind(wx.EVT_LIST_ITEM_FOCUSED, f)
|
||||
|
||||
def create_list(self):
|
||||
self.list = widgets.list(self, _(u"User"), _(u"Text"), _(u"Date"), _(u"Client"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES)
|
||||
self.list = widgets.list(self, _("User"), _("Text"), _("Date"), _("Client"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES)
|
||||
self.list.set_windows_size(0, 60)
|
||||
self.list.set_windows_size(1, 320)
|
||||
self.list.set_windows_size(2, 110)
|
||||
@ -21,10 +21,10 @@ class basePanel(wx.Panel):
|
||||
self.type = "baseBuffer"
|
||||
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.create_list()
|
||||
self.tweet = wx.Button(self, -1, _(u"Tweet"))
|
||||
self.retweet = wx.Button(self, -1, _(u"Retweet"))
|
||||
self.reply = wx.Button(self, -1, _(u"Reply"))
|
||||
self.dm = wx.Button(self, -1, _(u"Direct message"))
|
||||
self.tweet = wx.Button(self, -1, _("Tweet"))
|
||||
self.retweet = wx.Button(self, -1, _("Retweet"))
|
||||
self.reply = wx.Button(self, -1, _("Reply"))
|
||||
self.dm = wx.Button(self, -1, _("Direct message"))
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnSizer.Add(self.tweet, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.retweet, 0, wx.ALL, 5)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from .base import basePanel
|
||||
|
||||
|
@ -10,9 +10,9 @@ class eventsPanel(wx.Panel):
|
||||
super(eventsPanel, self).__init__(parent)
|
||||
self.name = name
|
||||
sizer = wx.BoxSizer()
|
||||
self.list = widgets.list(self, _(u"Date"), _(u"Event"), size=(600,600), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES)
|
||||
self.tweet = wx.Button(self, -1, _(u"Tweet"))
|
||||
self.delete_event = wx.Button(self, -1, _(u"Remove event"))
|
||||
self.list = widgets.list(self, _("Date"), _("Event"), size=(600,600), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES)
|
||||
self.tweet = wx.Button(self, -1, _("Tweet"))
|
||||
self.delete_event = wx.Button(self, -1, _("Remove event"))
|
||||
|
||||
def set_position(self, reversed=False):
|
||||
if reversed == False:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from .base import basePanel
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from .base import basePanel
|
||||
|
||||
|
@ -8,17 +8,17 @@ class accountPanel(wx.Panel):
|
||||
self.name = name
|
||||
self.type = "account"
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.login = wx.Button(self, -1, _(u"Login"))
|
||||
self.login = wx.Button(self, -1, _("Login"))
|
||||
sizer.Add(self.login, 0, wx.ALL, 5)
|
||||
self.autostart_account = wx.CheckBox(self, -1, _(u"Log in automatically"))
|
||||
self.autostart_account = wx.CheckBox(self, -1, _("Log in automatically"))
|
||||
sizer.Add(self.autostart_account, 0, wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
def change_login(self, login=True):
|
||||
if login == True:
|
||||
self.login.SetLabel(_(u"Login"))
|
||||
self.login.SetLabel(_("Login"))
|
||||
else:
|
||||
self.login.SetLabel(_(u"Logout"))
|
||||
self.login.SetLabel(_("Logout"))
|
||||
|
||||
def change_autostart(self, autostart=True):
|
||||
self.autostart_account.SetValue(autostart)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from multiplatform_widgets import widgets
|
||||
from .base import basePanel
|
||||
@ -8,10 +8,10 @@ class peoplePanel(basePanel):
|
||||
""" Buffer used to show people."""
|
||||
|
||||
def create_list(self):
|
||||
self.list = widgets.list(self, _(u"User"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(800, 800))
|
||||
self.list = widgets.list(self, _("User"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(800, 800))
|
||||
|
||||
def __init__(self, parent, name):
|
||||
super(peoplePanel, self).__init__(parent, name)
|
||||
self.type = "people"
|
||||
self.reply.SetLabel(_(u"Mention"))
|
||||
self.reply.SetLabel(_("Mention"))
|
||||
self.retweet.Disable()
|
||||
|
@ -5,7 +5,7 @@ from multiplatform_widgets import widgets
|
||||
class trendsPanel(wx.Panel):
|
||||
def create_list(self):
|
||||
""" Returns the list for put the tweets here."""
|
||||
self.list = widgets.list(self, _(u"Trending topic"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES)
|
||||
self.list = widgets.list(self, _("Trending topic"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES)
|
||||
self.list.set_windows_size(0, 30)
|
||||
self.list.set_size()
|
||||
|
||||
@ -14,9 +14,9 @@ class trendsPanel(wx.Panel):
|
||||
self.type = "trends"
|
||||
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.create_list()
|
||||
self.tweet = wx.Button(self, -1, _(u"Tweet"))
|
||||
self.tweetTrendBtn = wx.Button(self, -1, _(u"Tweet about this trend"))
|
||||
self.search_topic = wx.Button(self, -1, _(u"Search topic"))
|
||||
self.tweet = wx.Button(self, -1, _("Tweet"))
|
||||
self.tweetTrendBtn = wx.Button(self, -1, _("Tweet about this trend"))
|
||||
self.search_topic = wx.Button(self, -1, _("Search topic"))
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnSizer.Add(self.tweet, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.tweetTrendBtn, 0, wx.ALL, 5)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from .base import basePanel
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from .tweet_searches import searchPanel
|
||||
from multiplatform_widgets import widgets
|
||||
@ -7,7 +7,7 @@ from multiplatform_widgets import widgets
|
||||
class searchUsersPanel(searchPanel):
|
||||
def create_list(self):
|
||||
""" Returns the list for put the tweets here."""
|
||||
self.list = widgets.list(self, _(u"User"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(800, 800))
|
||||
self.list = widgets.list(self, _("User"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(800, 800))
|
||||
|
||||
def __init__(self, parent, name):
|
||||
super(searchUsersPanel, self).__init__(parent, name)
|
||||
|
@ -3,80 +3,80 @@ import wx
|
||||
import application
|
||||
|
||||
def retweet_as_link(parent):
|
||||
return wx.MessageDialog(parent, _(u"This retweet is over 140 characters. Would you like to post it as a mention to the poster with your comments and a link to the original tweet?"), application.name, wx.YES_NO|wx.ICON_QUESTION).ShowModal()
|
||||
return wx.MessageDialog(parent, _("This retweet is over 140 characters. Would you like to post it as a mention to the poster with your comments and a link to the original tweet?"), application.name, wx.YES_NO|wx.ICON_QUESTION).ShowModal()
|
||||
|
||||
def retweet_question(parent):
|
||||
return wx.MessageDialog(parent, _(u"Would you like to add a comment to this tweet?"), _("Retweet"), wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION).ShowModal()
|
||||
return wx.MessageDialog(parent, _("Would you like to add a comment to this tweet?"), _("Retweet"), wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION).ShowModal()
|
||||
|
||||
def delete_tweet_dialog(parent):
|
||||
return wx.MessageDialog(parent, _(u"Do you really want to delete this tweet? It will be deleted from Twitter as well."), _(u"Delete"), wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
||||
return wx.MessageDialog(parent, _("Do you really want to delete this tweet? It will be deleted from Twitter as well."), _("Delete"), wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
||||
|
||||
def exit_dialog(parent):
|
||||
dlg = wx.MessageDialog(parent, _(u"Do you really want to close {0}?").format(application.name,), _(u"Exit"), wx.YES_NO|wx.ICON_QUESTION)
|
||||
dlg = wx.MessageDialog(parent, _("Do you really want to close {0}?").format(application.name,), _("Exit"), wx.YES_NO|wx.ICON_QUESTION)
|
||||
return dlg.ShowModal()
|
||||
|
||||
def needs_restart():
|
||||
wx.MessageDialog(None, _(u" {0} must be restarted for these changes to take effect.").format(application.name,), _("Restart {0} ").format(application.name,), wx.OK).ShowModal()
|
||||
wx.MessageDialog(None, _(" {0} must be restarted for these changes to take effect.").format(application.name,), _("Restart {0} ").format(application.name,), wx.OK).ShowModal()
|
||||
|
||||
def delete_user_from_db():
|
||||
return wx.MessageDialog(None, _(u"Are you sure you want to delete this user from the database? This user will not appear in autocomplete results anymore."), _(u"Confirm"), wx.YES_NO|wx.ICON_QUESTION).ShowModal()
|
||||
return wx.MessageDialog(None, _("Are you sure you want to delete this user from the database? This user will not appear in autocomplete results anymore."), _("Confirm"), wx.YES_NO|wx.ICON_QUESTION).ShowModal()
|
||||
|
||||
def get_ignored_client():
|
||||
entry = wx.TextEntryDialog(None, _(u"Enter the name of the client : "), _(u"Add client"))
|
||||
entry = wx.TextEntryDialog(None, _("Enter the name of the client : "), _("Add client"))
|
||||
if entry.ShowModal() == wx.ID_OK:
|
||||
return entry.GetValue()
|
||||
return None
|
||||
|
||||
def clear_list():
|
||||
dlg = wx.MessageDialog(None, _(u"Do you really want to empty this buffer? It's items will be removed from the list but not from Twitter"), _(u"Empty buffer"), wx.ICON_QUESTION|wx.YES_NO)
|
||||
dlg = wx.MessageDialog(None, _("Do you really want to empty this buffer? It's items will be removed from the list but not from Twitter"), _("Empty buffer"), wx.ICON_QUESTION|wx.YES_NO)
|
||||
return dlg.ShowModal()
|
||||
|
||||
def remove_buffer():
|
||||
return wx.MessageDialog(None, _(u"Do you really want to destroy this buffer?"), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
||||
return wx.MessageDialog(None, _("Do you really want to destroy this buffer?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
||||
|
||||
def user_not_exist():
|
||||
return wx.MessageDialog(None, _(u"That user does not exist"), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("That user does not exist"), _("Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def timeline_exist():
|
||||
return wx.MessageDialog(None, _(u"A timeline for this user already exists. You can't open another"), _(u"Existing timeline"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("A timeline for this user already exists. You can't open another"), _("Existing timeline"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def no_tweets():
|
||||
return wx.MessageDialog(None, _(u"This user has no tweets, so you can't open a timeline for them."), _(u"Error!"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("This user has no tweets, so you can't open a timeline for them."), _("Error!"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def protected_user():
|
||||
return wx.MessageDialog(None, _(u"This is a protected Twitter user, which means you can't open a timeline using the Streaming API. The user's tweets will not update due to a twitter policy. Do you want to continue?"), _(u"Warning"), wx.ICON_WARNING|wx.YES_NO).ShowModal()
|
||||
return wx.MessageDialog(None, _("This is a protected Twitter user, which means you can't open a timeline using the Streaming API. The user's tweets will not update due to a twitter policy. Do you want to continue?"), _("Warning"), wx.ICON_WARNING|wx.YES_NO).ShowModal()
|
||||
|
||||
def no_following():
|
||||
return wx.MessageDialog(None, _(u"This is a protected user account, you need to follow this user to view their tweets or likes."), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("This is a protected user account, you need to follow this user to view their tweets or likes."), _("Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def donation():
|
||||
dlg = wx.MessageDialog(None, _(u"If you like {0} we need your help to keep it going. Help us by donating to the project. This will help us pay for the server, the domain and some other things to ensure that {0} will be actively maintained. Your donation will give us the means to continue the development of {0}, and to keep {0} free. Would you like to donate now?").format(application.name), _(u"We need your help"), wx.ICON_QUESTION|wx.YES_NO)
|
||||
dlg = wx.MessageDialog(None, _("If you like {0} we need your help to keep it going. Help us by donating to the project. This will help us pay for the server, the domain and some other things to ensure that {0} will be actively maintained. Your donation will give us the means to continue the development of {0}, and to keep {0} free. Would you like to donate now?").format(application.name), _("We need your help"), wx.ICON_QUESTION|wx.YES_NO)
|
||||
return dlg.ShowModal()
|
||||
|
||||
def no_tweets():
|
||||
return wx.MessageDialog(None, _(u"This user has no tweets. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("This user has no tweets. {0} can't create a timeline.").format(application.name), _("Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def no_favs():
|
||||
return wx.MessageDialog(None, _(u"This user has no favorited tweets. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("This user has no favorited tweets. {0} can't create a timeline.").format(application.name), _("Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def no_followers():
|
||||
return wx.MessageDialog(None, _(u"This user has no followers. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("This user has no followers. {0} can't create a timeline.").format(application.name), _("Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def no_friends():
|
||||
return wx.MessageDialog(None, _(u"This user has no friends. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
return wx.MessageDialog(None, _("This user has no friends. {0} can't create a timeline.").format(application.name), _("Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def view_geodata(geotext):
|
||||
"""Specific message dialog to display geolocation data"""
|
||||
return wx.MessageDialog(None, _(u"Geolocation data: {0}").format(geotext), _(u"Geo data for this tweet")).ShowModal()
|
||||
return wx.MessageDialog(None, _("Geolocation data: {0}").format(geotext), _("Geo data for this tweet")).ShowModal()
|
||||
|
||||
def changed_keymap():
|
||||
return wx.MessageDialog(None, _(u"TWBlue has detected that you're running windows 10 and has changed the default keymap to the Windows 10 keymap. It means that some keyboard shorcuts could be different. Please check the keystroke editor by pressing Alt+Win+K to see all available keystrokes for this keymap."), _(u"Information"), wx.OK).ShowModal()
|
||||
return wx.MessageDialog(None, _("TWBlue has detected that you're running windows 10 and has changed the default keymap to the Windows 10 keymap. It means that some keyboard shorcuts could be different. Please check the keystroke editor by pressing Alt+Win+K to see all available keystrokes for this keymap."), _("Information"), wx.OK).ShowModal()
|
||||
|
||||
def unauthorized():
|
||||
return wx.MessageDialog(None, _(u"You have been blocked from viewing this content"), _(u"Error"), wx.OK).ShowModal()
|
||||
return wx.MessageDialog(None, _("You have been blocked from viewing this content"), _("Error"), wx.OK).ShowModal()
|
||||
|
||||
def blocked_timeline():
|
||||
return wx.MessageDialog(None, _(u"You have been blocked from viewing someone's content. In order to avoid conflicts with the full session, TWBlue will remove the affected timeline."), _(u"Error"), wx.OK).ShowModal()
|
||||
return wx.MessageDialog(None, _("You have been blocked from viewing someone's content. In order to avoid conflicts with the full session, TWBlue will remove the affected timeline."), _("Error"), wx.OK).ShowModal()
|
||||
|
||||
def suspended_user():
|
||||
return wx.MessageDialog(None, _(u"TWBlue cannot load this timeline because the user has been suspended from Twitter."), _(u"Error"), wx.OK).ShowModal()
|
||||
return wx.MessageDialog(None, _("TWBlue cannot load this timeline because the user has been suspended from Twitter."), _("Error"), wx.OK).ShowModal()
|
@ -1,2 +1,2 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import baseDialog, trends, configuration, lists, message, search, find, show_user, update_profile, urlList, userSelection, utils
|
||||
|
@ -6,18 +6,18 @@ from multiplatform_widgets import widgets
|
||||
|
||||
class attachDialog(widgetUtils.BaseDialog):
|
||||
def __init__(self):
|
||||
super(attachDialog, self).__init__(None, title=_(u"Add an attachment"))
|
||||
super(attachDialog, self).__init__(None, title=_("Add an attachment"))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
lbl1 = wx.StaticText(panel, wx.NewId(), _(u"Attachments"))
|
||||
self.attachments = widgets.list(panel, _(u"Type"), _(u"Title"), style=wx.LC_REPORT)
|
||||
lbl1 = wx.StaticText(panel, wx.NewId(), _("Attachments"))
|
||||
self.attachments = widgets.list(panel, _("Type"), _("Title"), style=wx.LC_REPORT)
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(lbl1, 0, wx.ALL, 5)
|
||||
box.Add(self.attachments.list, 0, wx.ALL, 5)
|
||||
sizer.Add(box, 0, wx.ALL, 5)
|
||||
static = wx.StaticBox(panel, label=_(u"Add attachments"))
|
||||
self.photo = wx.Button(panel, wx.NewId(), _(u"&Photo"))
|
||||
self.remove = wx.Button(panel, wx.NewId(), _(u"Remove attachment"))
|
||||
static = wx.StaticBox(panel, label=_("Add attachments"))
|
||||
self.photo = wx.Button(panel, wx.NewId(), _("&Photo"))
|
||||
self.remove = wx.Button(panel, wx.NewId(), _("Remove attachment"))
|
||||
self.remove.Enable(False)
|
||||
btnsizer = wx.StaticBoxSizer(static, wx.HORIZONTAL)
|
||||
btnsizer.Add(self.photo, 0, wx.ALL, 5)
|
||||
@ -33,14 +33,14 @@ class attachDialog(widgetUtils.BaseDialog):
|
||||
self.SetClientSize(sizer.CalcMin())
|
||||
|
||||
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)
|
||||
openFileDialog = wx.FileDialog(self, _("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, None)
|
||||
dsc = self.ask_description()
|
||||
return (openFileDialog.GetPath(), dsc)
|
||||
|
||||
def ask_description(self):
|
||||
dlg = wx.TextEntryDialog(self, _(u"please provide a description"), _(u"Description"), defaultValue="")
|
||||
dlg = wx.TextEntryDialog(self, _("please provide a description"), _("Description"), defaultValue="")
|
||||
dlg.ShowModal()
|
||||
result = dlg.GetValue()
|
||||
dlg.Destroy()
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from builtins import range
|
||||
from . import baseDialog
|
||||
@ -14,36 +14,36 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
|
||||
def __init__(self, parent, languages,keymaps):
|
||||
super(general, self).__init__(parent)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
language = wx.StaticText(self, -1, _(u"Language"))
|
||||
language = wx.StaticText(self, -1, _("Language"))
|
||||
self.language = wx.ListBox(self, -1, choices=languages)
|
||||
self.language.SetSize(self.language.GetBestSize())
|
||||
langBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
langBox.Add(language, 0, wx.ALL, 5)
|
||||
langBox.Add(self.language, 0, wx.ALL, 5)
|
||||
sizer.Add(langBox, 0, wx.ALL, 5)
|
||||
self.autostart = wx.CheckBox(self, -1, _(u"Run {0} at Windows startup").format(application.name,))
|
||||
self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting {0}").format(application.name,))
|
||||
self.autostart = wx.CheckBox(self, -1, _("Run {0} at Windows startup").format(application.name,))
|
||||
self.ask_at_exit = wx.CheckBox(self, -1, _("ask before exiting {0}").format(application.name,))
|
||||
sizer.Add(self.autostart, 0, wx.ALL, 5)
|
||||
sizer.Add(self.ask_at_exit, 0, wx.ALL, 5)
|
||||
self.play_ready_sound = wx.CheckBox(self, -1, _(U"Play a sound when {0} launches").format(application.name,))
|
||||
self.play_ready_sound = wx.CheckBox(self, -1, _("Play a sound when {0} launches").format(application.name,))
|
||||
sizer.Add(self.play_ready_sound, 0, wx.ALL, 5)
|
||||
self.speak_ready_msg = wx.CheckBox(self, -1, _(U"Speak a message when {0} launches").format(application.name,))
|
||||
self.speak_ready_msg = wx.CheckBox(self, -1, _("Speak a message when {0} launches").format(application.name,))
|
||||
sizer.Add(self.speak_ready_msg, 0, wx.ALL, 5)
|
||||
self.use_invisible_shorcuts = wx.CheckBox(self, -1, _(u"Use invisible interface's keyboard shortcuts while GUI is visible"))
|
||||
self.use_invisible_shorcuts = wx.CheckBox(self, -1, _("Use invisible interface's keyboard shortcuts while GUI is visible"))
|
||||
sizer.Add(self.use_invisible_shorcuts, 0, wx.ALL, 5)
|
||||
self.disable_sapi5 = wx.CheckBox(self, -1, _(u"Activate Sapi5 when any other screen reader is not being run"))
|
||||
self.disable_sapi5 = wx.CheckBox(self, -1, _("Activate Sapi5 when any other screen reader is not being run"))
|
||||
sizer.Add(self.disable_sapi5, 0, wx.ALL, 5)
|
||||
self.hide_gui = wx.CheckBox(self, -1, _(u"Hide GUI on launch"))
|
||||
self.hide_gui = wx.CheckBox(self, -1, _("Hide GUI on launch"))
|
||||
sizer.Add(self.hide_gui, 0, wx.ALL, 5)
|
||||
self.handle_longtweets = wx.CheckBox(self, wx.NewId(), _(u"Use Codeofdusk's longtweet handlers (may decrease client performance)"))
|
||||
self.handle_longtweets = wx.CheckBox(self, wx.NewId(), _("Use Codeofdusk's longtweet handlers (may decrease client performance)"))
|
||||
sizer.Add(self.handle_longtweets, 0, wx.ALL, 5)
|
||||
kmbox = wx.BoxSizer(wx.VERTICAL)
|
||||
km_label = wx.StaticText(self, -1, _(u"Keymap"))
|
||||
km_label = wx.StaticText(self, -1, _("Keymap"))
|
||||
self.km = wx.ComboBox(self, -1, choices=keymaps, style=wx.CB_READONLY)
|
||||
self.km.SetSize(self.km.GetBestSize())
|
||||
kmbox.Add(km_label, 0, wx.ALL, 5)
|
||||
kmbox.Add(self.km, 0, wx.ALL, 5)
|
||||
self.check_for_updates = wx.CheckBox(self, -1, _(U"Check for updates when {0} launches").format(application.name,))
|
||||
self.check_for_updates = wx.CheckBox(self, -1, _("Check for updates when {0} launches").format(application.name,))
|
||||
sizer.Add(self.check_for_updates, 0, wx.ALL, 5)
|
||||
sizer.Add(kmbox, 0, wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
@ -53,32 +53,32 @@ class proxy(wx.Panel, baseDialog.BaseWXDialog):
|
||||
def __init__(self, parent, proxyTypes):
|
||||
super(proxy, self).__init__(parent)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
type=wx.StaticText(self, wx.NewId(), _(u"Proxy type: "))
|
||||
type=wx.StaticText(self, wx.NewId(), _("Proxy type: "))
|
||||
self.type=wx.ComboBox(self, -1, choices=proxyTypes, style=wx.CB_READONLY)
|
||||
self.type.SetSize(self.type.GetBestSize())
|
||||
typeBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
typeBox.Add(type, 0, wx.ALL, 5)
|
||||
typeBox.Add(self.type, 0, wx.ALL, 5)
|
||||
sizer.Add(typeBox, 0, wx.ALL, 5)
|
||||
lbl = wx.StaticText(self, wx.NewId(), _(u"Proxy server: "))
|
||||
lbl = wx.StaticText(self, wx.NewId(), _("Proxy server: "))
|
||||
self.server = wx.TextCtrl(self, -1)
|
||||
serverBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
serverBox.Add(lbl, 0, wx.ALL, 5)
|
||||
serverBox.Add(self.server, 0, wx.ALL, 5)
|
||||
sizer.Add(serverBox, 0, wx.ALL, 5)
|
||||
lbl = wx.StaticText(self, wx.NewId(), _(u"Port: "))
|
||||
lbl = wx.StaticText(self, wx.NewId(), _("Port: "))
|
||||
self.port = wx.TextCtrl(self, wx.NewId())
|
||||
portBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
portBox.Add(lbl, 0, wx.ALL, 5)
|
||||
portBox.Add(self.port, 0, wx.ALL, 5)
|
||||
sizer.Add(portBox, 0, wx.ALL, 5)
|
||||
lbl = wx.StaticText(self, wx.NewId(), _(u"User: "))
|
||||
lbl = wx.StaticText(self, wx.NewId(), _("User: "))
|
||||
self.user = wx.TextCtrl(self, wx.NewId())
|
||||
userBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
userBox.Add(lbl, 0, wx.ALL, 5)
|
||||
userBox.Add(self.user, 0, wx.ALL, 5)
|
||||
sizer.Add(userBox, 0, wx.ALL, 5)
|
||||
lbl = wx.StaticText(self, wx.NewId(), _(u"Password: "))
|
||||
lbl = wx.StaticText(self, wx.NewId(), _("Password: "))
|
||||
self.password = wx.TextCtrl(self, wx.NewId(), style=wx.TE_PASSWORD)
|
||||
passwordBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
passwordBox.Add(lbl, 0, wx.ALL, 5)
|
||||
@ -90,35 +90,35 @@ class generalAccount(wx.Panel, baseDialog.BaseWXDialog):
|
||||
def __init__(self, parent):
|
||||
super(generalAccount, self).__init__(parent)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.au = wx.Button(self, wx.NewId(), _(u"Autocompletion settings..."))
|
||||
self.au = wx.Button(self, wx.NewId(), _("Autocompletion settings..."))
|
||||
sizer.Add(self.au, 0, wx.ALL, 5)
|
||||
self.relative_time = wx.CheckBox(self, wx.NewId(), _(U"Relative timestamps"))
|
||||
self.relative_time = wx.CheckBox(self, wx.NewId(), _("Relative timestamps"))
|
||||
sizer.Add(self.relative_time, 0, wx.ALL, 5)
|
||||
apiCallsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
apiCallsBox.Add(wx.StaticText(self, -1, _(u"API calls (One API call = 200 tweets, two API calls = 400 tweets, etc):")), 0, wx.ALL, 5)
|
||||
apiCallsBox.Add(wx.StaticText(self, -1, _("API calls (One API call = 200 tweets, two API calls = 400 tweets, etc):")), 0, wx.ALL, 5)
|
||||
self.apiCalls = wx.SpinCtrl(self, wx.NewId())
|
||||
self.apiCalls.SetRange(1, 10)
|
||||
self.apiCalls.SetSize(self.apiCalls.GetBestSize())
|
||||
apiCallsBox.Add(self.apiCalls, 0, wx.ALL, 5)
|
||||
sizer.Add(apiCallsBox, 0, wx.ALL, 5)
|
||||
tweetsPerCallBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
tweetsPerCallBox.Add(wx.StaticText(self, -1, _(u"Items on each API call")), 0, wx.ALL, 5)
|
||||
tweetsPerCallBox.Add(wx.StaticText(self, -1, _("Items on each API call")), 0, wx.ALL, 5)
|
||||
self.itemsPerApiCall = wx.SpinCtrl(self, wx.NewId())
|
||||
self.itemsPerApiCall.SetRange(0, 200)
|
||||
self.itemsPerApiCall.SetSize(self.itemsPerApiCall.GetBestSize())
|
||||
tweetsPerCallBox.Add(self.itemsPerApiCall, 0, wx.ALL, 5)
|
||||
sizer.Add(tweetsPerCallBox, 0, wx.ALL, 5)
|
||||
self.reverse_timelines = wx.CheckBox(self, wx.NewId(), _(u"Inverted buffers: The newest tweets will be shown at the beginning while the oldest at the end"))
|
||||
self.reverse_timelines = wx.CheckBox(self, wx.NewId(), _("Inverted buffers: The newest tweets will be shown at the beginning while the oldest at the end"))
|
||||
sizer.Add(self.reverse_timelines, 0, wx.ALL, 5)
|
||||
lbl = wx.StaticText(self, wx.NewId(), _(u"Retweet mode"))
|
||||
self.retweet_mode = wx.ComboBox(self, wx.NewId(), choices=[_(u"Ask"), _(u"Retweet without comments"), _(u"Retweet with comments")], style=wx.CB_READONLY)
|
||||
lbl = wx.StaticText(self, wx.NewId(), _("Retweet mode"))
|
||||
self.retweet_mode = wx.ComboBox(self, wx.NewId(), choices=[_("Ask"), _("Retweet without comments"), _("Retweet with comments")], style=wx.CB_READONLY)
|
||||
rMode = wx.BoxSizer(wx.HORIZONTAL)
|
||||
rMode.Add(lbl, 0, wx.ALL, 5)
|
||||
rMode.Add(self.retweet_mode, 0, wx.ALL, 5)
|
||||
sizer.Add(rMode, 0, wx.ALL, 5)
|
||||
self.show_screen_names = wx.CheckBox(self, wx.NewId(), _(U"Show screen names instead of full names"))
|
||||
self.show_screen_names = wx.CheckBox(self, wx.NewId(), _("Show screen names instead of full names"))
|
||||
sizer.Add(self.show_screen_names, 0, wx.ALL, 5)
|
||||
PersistSizeLabel = wx.StaticText(self, -1, _(u"Number of items per buffer to cache in database (0 to disable caching, blank for unlimited)"))
|
||||
PersistSizeLabel = wx.StaticText(self, -1, _("Number of items per buffer to cache in database (0 to disable caching, blank for unlimited)"))
|
||||
self.persist_size = wx.TextCtrl(self, -1)
|
||||
sizer.Add(PersistSizeLabel, 0, wx.ALL, 5)
|
||||
sizer.Add(self.persist_size, 0, wx.ALL, 5)
|
||||
@ -128,12 +128,12 @@ class other_buffers(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
super(other_buffers, self).__init__(parent)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.buffers = widgets.list(self, _(u"Buffer"), _(u"Name"), _(u"Status"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT)
|
||||
self.buffers = widgets.list(self, _("Buffer"), _("Name"), _("Status"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT)
|
||||
sizer.Add(self.buffers.list, 0, wx.ALL, 5)
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.toggle_state = wx.Button(self, -1, _(u"Show/hide"))
|
||||
self.up = wx.Button(self, -1, _(u"Move up"))
|
||||
self.down = wx.Button(self, -1, _(u"Move down"))
|
||||
self.toggle_state = wx.Button(self, -1, _("Show/hide"))
|
||||
self.up = wx.Button(self, -1, _("Move up"))
|
||||
self.down = wx.Button(self, -1, _("Move down"))
|
||||
btnSizer.Add(self.toggle_state, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.up, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.down, 0, wx.ALL, 5)
|
||||
@ -143,9 +143,9 @@ class other_buffers(wx.Panel):
|
||||
def insert_buffers(self, buffers):
|
||||
for i in buffers:
|
||||
if i[2] == True:
|
||||
self.buffers.insert_item(False, *[i[0], i[1], _(u"Show")])
|
||||
self.buffers.insert_item(False, *[i[0], i[1], _("Show")])
|
||||
else:
|
||||
self.buffers.insert_item(False, *[i[0], i[1], _(u"Hide")])
|
||||
self.buffers.insert_item(False, *[i[0], i[1], _("Hide")])
|
||||
|
||||
def connect_hook_func(self, func):
|
||||
self.buffers.list.Bind(wx.EVT_CHAR_HOOK, func)
|
||||
@ -153,13 +153,13 @@ class other_buffers(wx.Panel):
|
||||
def move_up(self, *args, **kwargs):
|
||||
current = self.buffers.get_selected()
|
||||
if current == -1:
|
||||
output.speak(_(u"Select a buffer first."), True)
|
||||
output.speak(_("Select a buffer first."), True)
|
||||
return False
|
||||
if self.buffers.get_text_column(current, 2) == _(u"Hide"):
|
||||
output.speak(_(u"The buffer is hidden, show it first."), True)
|
||||
if self.buffers.get_text_column(current, 2) == _("Hide"):
|
||||
output.speak(_("The buffer is hidden, show it first."), True)
|
||||
return False
|
||||
if current <= 0:
|
||||
output.speak(_(u"The buffer is already at the top of the list."), True)
|
||||
output.speak(_("The buffer is already at the top of the list."), True)
|
||||
return False
|
||||
current_text = self.buffers.get_text_column(self.buffers.get_selected(), 0)
|
||||
current_name = self.buffers.get_text_column(self.buffers.get_selected(), 1)
|
||||
@ -177,13 +177,13 @@ class other_buffers(wx.Panel):
|
||||
def move_down(self, *args, **kwargs):
|
||||
current = self.buffers.get_selected()
|
||||
if current == -1:
|
||||
output.speak(_(u"Select a buffer first."), True)
|
||||
output.speak(_("Select a buffer first."), True)
|
||||
return False
|
||||
if self.buffers.get_text_column(current, 2) == _(u"Hide"):
|
||||
output.speak(_(u"The buffer is hidden, show it first."), True)
|
||||
if self.buffers.get_text_column(current, 2) == _("Hide"):
|
||||
output.speak(_("The buffer is hidden, show it first."), True)
|
||||
return False
|
||||
if current+1 >= self.buffers.get_count():
|
||||
output.speak(_(u"The buffer is already at the bottom of the list."), True)
|
||||
output.speak(_("The buffer is already at the bottom of the list."), True)
|
||||
return False
|
||||
current_text = self.buffers.get_text_column(self.buffers.get_selected(), 0)
|
||||
current_name = self.buffers.get_text_column(self.buffers.get_selected(), 1)
|
||||
@ -208,15 +208,15 @@ class other_buffers(wx.Panel):
|
||||
def change_selected_item(self):
|
||||
current = self.buffers.get_selected()
|
||||
text = self.buffers.get_text_column(current, 2)
|
||||
if text == _(u"Show"):
|
||||
self.buffers.set_text_column(current, 2, _(u"Hide"))
|
||||
if text == _("Show"):
|
||||
self.buffers.set_text_column(current, 2, _("Hide"))
|
||||
else:
|
||||
self.buffers.set_text_column(current, 2, _(u"Show"))
|
||||
self.buffers.set_text_column(current, 2, _("Show"))
|
||||
output.speak(self.buffers.get_text_column(current, 2),True)
|
||||
def get_list(self):
|
||||
buffers_list = []
|
||||
for i in range(0, self.buffers.get_count()):
|
||||
if self.buffers.get_text_column(i, 2) == _(u"Show"):
|
||||
if self.buffers.get_text_column(i, 2) == _("Show"):
|
||||
buffers_list.append(self.buffers.get_text_column(i, 0))
|
||||
return buffers_list
|
||||
|
||||
@ -224,14 +224,14 @@ class ignoredClients(wx.Panel):
|
||||
def __init__(self, parent, choices):
|
||||
super(ignoredClients, self).__init__(parent=parent)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
label = wx.StaticText(self, -1, _(u"Ignored clients"))
|
||||
label = wx.StaticText(self, -1, _("Ignored clients"))
|
||||
self.clients = wx.ListBox(self, -1, choices=choices)
|
||||
self.clients.SetSize(self.clients.GetBestSize())
|
||||
clientsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
clientsBox.Add(label, 0, wx.ALL, 5)
|
||||
clientsBox.Add(self.clients, 0, wx.ALL, 5)
|
||||
self.add = wx.Button(self, -1, _(u"Add client"))
|
||||
self.remove = wx.Button(self, -1, _(u"Remove client"))
|
||||
self.add = wx.Button(self, -1, _("Add client"))
|
||||
self.remove = wx.Button(self, -1, _("Remove client"))
|
||||
btnBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnBox.Add(self.add, 0, wx.ALL, 5)
|
||||
btnBox.Add(self.remove, 0, wx.ALL, 5)
|
||||
@ -255,7 +255,7 @@ class sound(wx.Panel):
|
||||
def __init__(self, parent, input_devices, output_devices, soundpacks):
|
||||
wx.Panel.__init__(self, parent)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
volume = wx.StaticText(self, -1, _(u"Volume"))
|
||||
volume = wx.StaticText(self, -1, _("Volume"))
|
||||
self.volumeCtrl = wx.Slider(self)
|
||||
self.volumeCtrl.SetRange(0, 100)
|
||||
self.volumeCtrl.SetSize(self.volumeCtrl.GetBestSize())
|
||||
@ -263,16 +263,16 @@ class sound(wx.Panel):
|
||||
volumeBox.Add(volume, 0, wx.ALL, 5)
|
||||
volumeBox.Add(self.volumeCtrl, 0, wx.ALL, 5)
|
||||
sizer.Add(volumeBox, 0, wx.ALL, 5)
|
||||
self.session_mute = wx.CheckBox(self, -1, _(u"Session mute"))
|
||||
self.session_mute = wx.CheckBox(self, -1, _("Session mute"))
|
||||
sizer.Add(self.session_mute, 0, wx.ALL, 5)
|
||||
output_label = wx.StaticText(self, -1, _(u"Output device"))
|
||||
output_label = wx.StaticText(self, -1, _("Output device"))
|
||||
self.output = wx.ComboBox(self, -1, choices=output_devices, style=wx.CB_READONLY)
|
||||
self.output.SetSize(self.output.GetBestSize())
|
||||
outputBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
outputBox.Add(output_label, 0, wx.ALL, 5)
|
||||
outputBox.Add(self.output, 0, wx.ALL, 5)
|
||||
sizer.Add(outputBox, 0, wx.ALL, 5)
|
||||
input_label = wx.StaticText(self, -1, _(u"Input device"))
|
||||
input_label = wx.StaticText(self, -1, _("Input device"))
|
||||
self.input = wx.ComboBox(self, -1, choices=input_devices, style=wx.CB_READONLY)
|
||||
self.input.SetSize(self.input.GetBestSize())
|
||||
inputBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
@ -280,17 +280,17 @@ class sound(wx.Panel):
|
||||
inputBox.Add(self.input, 0, wx.ALL, 5)
|
||||
sizer.Add(inputBox, 0, wx.ALL, 5)
|
||||
soundBox = wx.BoxSizer(wx.VERTICAL)
|
||||
soundpack_label = wx.StaticText(self, -1, _(u"Sound pack"))
|
||||
soundpack_label = wx.StaticText(self, -1, _("Sound pack"))
|
||||
self.soundpack = wx.ComboBox(self, -1, choices=soundpacks, style=wx.CB_READONLY)
|
||||
self.soundpack.SetSize(self.soundpack.GetBestSize())
|
||||
soundBox.Add(soundpack_label, 0, wx.ALL, 5)
|
||||
soundBox.Add(self.soundpack, 0, wx.ALL, 5)
|
||||
sizer.Add(soundBox, 0, wx.ALL, 5)
|
||||
self.indicate_audio = wx.CheckBox(self, -1, _(u"Indicate audio tweets with sound"))
|
||||
self.indicate_audio = wx.CheckBox(self, -1, _("Indicate audio tweets with sound"))
|
||||
sizer.Add(self.indicate_audio, 0, wx.ALL, 5)
|
||||
self.indicate_geo = wx.CheckBox(self, -1, _(u"Indicate geotweets with sound"))
|
||||
self.indicate_geo = wx.CheckBox(self, -1, _("Indicate geotweets with sound"))
|
||||
sizer.Add(self.indicate_geo, 0, wx.ALL, 5)
|
||||
self.indicate_img = wx.CheckBox(self, -1, _(u"Indicate tweets containing images with sound"))
|
||||
self.indicate_img = wx.CheckBox(self, -1, _("Indicate tweets containing images with sound"))
|
||||
sizer.Add(self.indicate_img, 0, wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
@ -301,13 +301,13 @@ class extrasPanel(wx.Panel):
|
||||
def __init__(self, parent, ocr_languages=[], translation_languages=[]):
|
||||
super(extrasPanel, self).__init__(parent)
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
OCRBox = wx.StaticBox(self, label=_(u"Language for OCR"))
|
||||
OCRBox = wx.StaticBox(self, label=_("Language for OCR"))
|
||||
self.ocr_lang = wx.ListBox(self, -1, choices=ocr_languages)
|
||||
self.ocr_lang.SetSize(self.ocr_lang.GetBestSize())
|
||||
ocrLanguageSizer = wx.StaticBoxSizer(OCRBox, wx.HORIZONTAL)
|
||||
ocrLanguageSizer.Add(self.ocr_lang, 0, wx.ALL, 5)
|
||||
mainSizer.Add(ocrLanguageSizer, 0, wx.ALL, 5)
|
||||
lbl = wx.StaticText(self, wx.NewId(), _(u"API Key for SndUp"))
|
||||
lbl = wx.StaticText(self, wx.NewId(), _("API Key for SndUp"))
|
||||
self.sndup_apiKey = wx.TextCtrl(self, -1)
|
||||
sndupBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
sndupBox.Add(lbl, 0, wx.ALL, 5)
|
||||
@ -322,46 +322,46 @@ class configurationDialog(baseDialog.BaseWXDialog):
|
||||
def __init__(self):
|
||||
super(configurationDialog, self).__init__(None, -1)
|
||||
self.panel = wx.Panel(self)
|
||||
self.SetTitle(_(u"{0} preferences").format(application.name,))
|
||||
self.SetTitle(_("{0} preferences").format(application.name,))
|
||||
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.notebook = wx.Notebook(self.panel)
|
||||
|
||||
def create_general(self, languageList,keymaps):
|
||||
self.general = general(self.notebook, languageList,keymaps)
|
||||
self.notebook.AddPage(self.general, _(u"General"))
|
||||
self.notebook.AddPage(self.general, _("General"))
|
||||
self.general.SetFocus()
|
||||
|
||||
def create_proxy(self, proxyTypes):
|
||||
self.proxy = proxy(self.notebook, proxyTypes)
|
||||
self.notebook.AddPage(self.proxy, _(u"Proxy"))
|
||||
self.notebook.AddPage(self.proxy, _("Proxy"))
|
||||
|
||||
def create_general_account(self):
|
||||
self.general = generalAccount(self.notebook)
|
||||
self.notebook.AddPage(self.general, _(u"General"))
|
||||
self.notebook.AddPage(self.general, _("General"))
|
||||
self.general.SetFocus()
|
||||
|
||||
def create_other_buffers(self):
|
||||
self.buffers = other_buffers(self.notebook)
|
||||
self.notebook.AddPage(self.buffers, _(u"Buffers"))
|
||||
self.notebook.AddPage(self.buffers, _("Buffers"))
|
||||
|
||||
def create_ignored_clients(self, ignored_clients_list):
|
||||
self.ignored_clients = ignoredClients(self.notebook, ignored_clients_list)
|
||||
self.notebook.AddPage(self.ignored_clients, _(u"Ignored clients"))
|
||||
self.notebook.AddPage(self.ignored_clients, _("Ignored clients"))
|
||||
|
||||
def create_sound(self, output_devices, input_devices, soundpacks):
|
||||
self.sound = sound(self.notebook, output_devices, input_devices, soundpacks)
|
||||
self.notebook.AddPage(self.sound, _(u"Sound"))
|
||||
self.notebook.AddPage(self.sound, _("Sound"))
|
||||
|
||||
def create_extras(self, ocr_languages=[], translator_languages=[]):
|
||||
self.extras = extrasPanel(self.notebook, ocr_languages, translator_languages)
|
||||
self.notebook.AddPage(self.extras, _(u"Extras"))
|
||||
self.notebook.AddPage(self.extras, _("Extras"))
|
||||
|
||||
def realize(self):
|
||||
self.sizer.Add(self.notebook, 0, wx.ALL, 5)
|
||||
ok_cancel_box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
ok = wx.Button(self.panel, wx.ID_OK, _(u"Save"))
|
||||
ok = wx.Button(self.panel, wx.ID_OK, _("Save"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(self.panel, wx.ID_CANCEL, _(u"Close"))
|
||||
cancel = wx.Button(self.panel, wx.ID_CANCEL, _("Close"))
|
||||
self.SetEscapeId(cancel.GetId())
|
||||
ok_cancel_box.Add(ok, 0, wx.ALL, 5)
|
||||
ok_cancel_box.Add(cancel, 0, wx.ALL, 5)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import baseDialog
|
||||
import wx
|
||||
@ -9,17 +9,17 @@ class findDialog(baseDialog.BaseWXDialog):
|
||||
super(findDialog, self).__init__(None, -1)
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.SetTitle(_(u"Find in current buffer"))
|
||||
label = wx.StaticText(panel, -1, _(u"String"))
|
||||
self.SetTitle(_("Find in current buffer"))
|
||||
label = wx.StaticText(panel, -1, _("String"))
|
||||
self.string = wx.TextCtrl(panel, -1, value)
|
||||
dc = wx.WindowDC(self.string)
|
||||
dc.SetFont(self.string.GetFont())
|
||||
self.string.SetSize(dc.GetTextExtent("0"*40))
|
||||
sizer.Add(label, 0, wx.ALL, 5)
|
||||
sizer.Add(self.string, 0, wx.ALL, 5)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
||||
ok = wx.Button(panel, wx.ID_OK, _("OK"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Cancel"))
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _("Cancel"))
|
||||
btnsizer = wx.BoxSizer()
|
||||
btnsizer.Add(ok, 0, wx.ALL, 5)
|
||||
btnsizer.Add(cancel, 0, wx.ALL, 5)
|
||||
|
@ -7,18 +7,18 @@ class listViewer(widgetUtils.BaseDialog):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(listViewer, self).__init__(parent=None, *args, **kwargs)
|
||||
self.SetTitle(_(u"Lists manager"))
|
||||
self.SetTitle(_("Lists manager"))
|
||||
panel = wx.Panel(self)
|
||||
label = wx.StaticText(panel, -1, _(u"Lists"))
|
||||
self.lista = widgets.list(panel, _(u"List"), _(u"Description"), _(u"Owner"), _(u"Members"), _(u"mode"), size=(800, 800), style=wx.LC_REPORT|wx.LC_SINGLE_SEL)
|
||||
label = wx.StaticText(panel, -1, _("Lists"))
|
||||
self.lista = widgets.list(panel, _("List"), _("Description"), _("Owner"), _("Members"), _("mode"), size=(800, 800), style=wx.LC_REPORT|wx.LC_SINGLE_SEL)
|
||||
self.lista.list.SetFocus()
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(label)
|
||||
sizer.Add(self.lista.list)
|
||||
self.createBtn = wx.Button(panel, wx.NewId(), _(u"Create a new list"))
|
||||
self.editBtn = wx.Button(panel, -1, _(u"Edit"))
|
||||
self.deleteBtn = wx.Button(panel, -1, _(u"Remove"))
|
||||
self.view = wx.Button(panel, -1, _(u"Open in buffer"))
|
||||
self.createBtn = wx.Button(panel, wx.NewId(), _("Create a new list"))
|
||||
self.editBtn = wx.Button(panel, -1, _("Edit"))
|
||||
self.deleteBtn = wx.Button(panel, -1, _("Remove"))
|
||||
self.view = wx.Button(panel, -1, _("Open in buffer"))
|
||||
# self.members = wx.Button(panel, -1, _(u"View members"))
|
||||
# self.members.Disable()
|
||||
# self.subscriptors = wx.Button(panel, -1, _(u"View subscribers"))
|
||||
@ -48,9 +48,9 @@ class userListViewer(listViewer):
|
||||
def __init__(self, username, *args, **kwargs):
|
||||
self.username = username
|
||||
super(userListViewer, self).__init__(*args, **kwargs)
|
||||
self.SetTitle(_(u"Viewing lists for %s") % (self.username))
|
||||
self.createBtn.SetLabel(_(u"Subscribe"))
|
||||
self.deleteBtn.SetLabel(_(u"Unsubscribe"))
|
||||
self.SetTitle(_("Viewing lists for %s") % (self.username))
|
||||
self.createBtn.SetLabel(_("Subscribe"))
|
||||
self.deleteBtn.SetLabel(_("Unsubscribe"))
|
||||
self.editBtn.Disable()
|
||||
self.view.Disable()
|
||||
|
||||
@ -58,22 +58,22 @@ class createListDialog(widgetUtils.BaseDialog):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(createListDialog, self).__init__(parent=None, *args, **kwargs)
|
||||
self.SetTitle(_(u"Create a new list"))
|
||||
self.SetTitle(_("Create a new list"))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
name = wx.StaticText(panel, -1, _(u"Name (20 characters maximun)"))
|
||||
name = wx.StaticText(panel, -1, _("Name (20 characters maximun)"))
|
||||
self.name = wx.TextCtrl(panel, -1)
|
||||
nameSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
nameSizer.Add(name)
|
||||
nameSizer.Add(self.name)
|
||||
description = wx.StaticText(panel, -1, _(u"Description"))
|
||||
description = wx.StaticText(panel, -1, _("Description"))
|
||||
self.description = wx.TextCtrl(panel, -1)
|
||||
descriptionSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
descriptionSizer.Add(description)
|
||||
descriptionSizer.Add(self.description)
|
||||
mode = wx.StaticText(panel, -1, _(u"Mode"))
|
||||
self.public = wx.RadioButton(panel, -1, _(u"Public"), style=wx.RB_GROUP)
|
||||
self.private = wx.RadioButton(panel, -1, _(u"Private"))
|
||||
mode = wx.StaticText(panel, -1, _("Mode"))
|
||||
self.public = wx.RadioButton(panel, -1, _("Public"), style=wx.RB_GROUP)
|
||||
self.private = wx.RadioButton(panel, -1, _("Private"))
|
||||
modeBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
modeBox.Add(mode)
|
||||
modeBox.Add(self.public)
|
||||
@ -93,7 +93,7 @@ class editListDialog(createListDialog):
|
||||
|
||||
def __init__(self, list, *args, **kwargs):
|
||||
super(editListDialog, self).__init__(*args, **kwargs)
|
||||
self.SetTitle(_(u"Editing the list %s") % (list["name"]))
|
||||
self.SetTitle(_("Editing the list %s") % (list["name"]))
|
||||
self.name.ChangeValue(list["name"])
|
||||
self.description.ChangeValue(list["description"])
|
||||
if list["mode"] == "public":
|
||||
@ -104,8 +104,8 @@ class editListDialog(createListDialog):
|
||||
class addUserListDialog(listViewer):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(addUserListDialog, self).__init__(*args, **kwargs)
|
||||
self.SetTitle(_(u"Select a list to add the user"))
|
||||
self.createBtn.SetLabel(_(u"Add"))
|
||||
self.SetTitle(_("Select a list to add the user"))
|
||||
self.createBtn.SetLabel(_("Add"))
|
||||
self.createBtn.SetDefault()
|
||||
self.createBtn.Bind(wx.EVT_BUTTON, self.ok)
|
||||
self.editBtn.Disable()
|
||||
@ -120,8 +120,8 @@ class addUserListDialog(listViewer):
|
||||
class removeUserListDialog(listViewer):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(removeUserListDialog, self).__init__(*args, **kwargs)
|
||||
self.SetTitle(_(u"Select a list to remove the user"))
|
||||
self.createBtn.SetLabel(_(u"Remove"))
|
||||
self.SetTitle(_("Select a list to remove the user"))
|
||||
self.createBtn.SetLabel(_("Remove"))
|
||||
self.createBtn.SetDefault()
|
||||
self.createBtn.SetId(wx.ID_OK)
|
||||
self.editBtn.Disable()
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from . import baseDialog
|
||||
|
||||
@ -8,14 +8,14 @@ class showUserProfile(baseDialog.BaseWXDialog):
|
||||
super(showUserProfile, self).__init__(parent=None, id=wx.NewId())
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
static = wx.StaticText(panel, -1, _(u"Details"))
|
||||
static = wx.StaticText(panel, -1, _("Details"))
|
||||
sizer.Add(static, 0, wx.ALL, 5)
|
||||
self.text = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE|wx.TE_READONLY, size=(350, 250))
|
||||
self.text.SetFocus()
|
||||
sizer.Add(self.text, 0, wx.ALL|wx.EXPAND, 5)
|
||||
self.url = wx.Button(panel, -1, _(u"&Go to URL"), size=wx.DefaultSize)
|
||||
self.url = wx.Button(panel, -1, _("&Go to URL"), size=wx.DefaultSize)
|
||||
self.url.Disable()
|
||||
close = wx.Button(panel, wx.ID_CANCEL, _(u"&Close"))
|
||||
close = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnSizer.Add(self.url, 0, wx.ALL, 5)
|
||||
btnSizer.Add(close, 0, wx.ALL, 5)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import baseDialog
|
||||
import wx
|
||||
@ -9,25 +9,25 @@ class trendingTopicsDialog(baseDialog.BaseWXDialog):
|
||||
super(trendingTopicsDialog, self).__init__(None, -1)
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.SetTitle(_(u"View trending topics"))
|
||||
label = wx.StaticText(panel, -1, _(u"Trending topics by"))
|
||||
self.SetTitle(_("View trending topics"))
|
||||
label = wx.StaticText(panel, -1, _("Trending topics by"))
|
||||
sizer.Add(label, 0, wx.ALL, 5)
|
||||
self.country = wx.RadioButton(panel, -1, _(u"Country"), style=wx.RB_GROUP)
|
||||
self.city = wx.RadioButton(panel, -1, _(u"City"))
|
||||
self.country = wx.RadioButton(panel, -1, _("Country"), style=wx.RB_GROUP)
|
||||
self.city = wx.RadioButton(panel, -1, _("City"))
|
||||
radioSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
radioSizer.Add(label, 0, wx.ALL, 5)
|
||||
radioSizer.Add(self.country, 0, wx.ALL, 5)
|
||||
radioSizer.Add(self.city, 0, wx.ALL, 5)
|
||||
sizer.Add(radioSizer, 0, wx.ALL, 5)
|
||||
label = wx.StaticText(panel, -1, _(u"&Location"))
|
||||
label = wx.StaticText(panel, -1, _("&Location"))
|
||||
self.location = wx.ListBox(panel, -1, choices=[], style=wx.CB_READONLY)
|
||||
locationBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
locationBox.Add(label, 0, wx.ALL, 5)
|
||||
locationBox.Add(self.location, 0, wx.ALL, 5)
|
||||
sizer.Add(locationBox, 0, wx.ALL, 5)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"&OK"))
|
||||
ok = wx.Button(panel, wx.ID_OK, _("&OK"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close"))
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
|
||||
btnsizer = wx.BoxSizer()
|
||||
btnsizer.Add(ok, 0, wx.ALL, 5)
|
||||
btnsizer.Add(cancel, 0, wx.ALL, 5)
|
||||
|
@ -1,37 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from . import baseDialog
|
||||
|
||||
class updateProfileDialog(baseDialog.BaseWXDialog):
|
||||
def __init__(self):
|
||||
super(updateProfileDialog, self).__init__(parent=None, id=-1)
|
||||
self.SetTitle(_(u"Update your profile"))
|
||||
self.SetTitle(_("Update your profile"))
|
||||
panel = wx.Panel(self)
|
||||
labelName = wx.StaticText(panel, -1, _(u"&Name (20 characters maximum)"))
|
||||
labelName = wx.StaticText(panel, -1, _("&Name (20 characters maximum)"))
|
||||
self.name = wx.TextCtrl(panel, -1)
|
||||
self.name.SetFocus()
|
||||
dc = wx.WindowDC(self.name)
|
||||
dc.SetFont(self.name.GetFont())
|
||||
self.name.SetSize(dc.GetTextExtent("0"*20))
|
||||
labelLocation = wx.StaticText(panel, -1, _(u"&Location"))
|
||||
labelLocation = wx.StaticText(panel, -1, _("&Location"))
|
||||
self.location = wx.TextCtrl(panel, -1)
|
||||
dc = wx.WindowDC(self.location)
|
||||
dc.SetFont(self.location.GetFont())
|
||||
self.location.SetSize(dc.GetTextExtent("0"*35))
|
||||
labelUrl = wx.StaticText(panel, -1, _(u"&Website"))
|
||||
labelUrl = wx.StaticText(panel, -1, _("&Website"))
|
||||
self.url = wx.TextCtrl(panel, -1)
|
||||
dc = wx.WindowDC(self.url)
|
||||
dc.SetFont(self.url.GetFont())
|
||||
self.url.SetSize(dc.GetTextExtent("0"*22))
|
||||
labelDescription = wx.StaticText(panel, -1, _(u"&Bio (160 characters maximum)"))
|
||||
labelDescription = wx.StaticText(panel, -1, _("&Bio (160 characters maximum)"))
|
||||
self.description = wx.TextCtrl(panel, -1, size=(400, 400))
|
||||
dc = wx.WindowDC(self.description)
|
||||
dc.SetFont(self.description.GetFont())
|
||||
self.description.SetSize(dc.GetTextExtent("0"*160))
|
||||
self.image = None
|
||||
self.upload_image = wx.Button(panel, -1, _(u"Upload a &picture"))
|
||||
self.ok = wx.Button(panel, wx.ID_OK, _(u"&Update profile"))
|
||||
self.upload_image = wx.Button(panel, -1, _("Upload a &picture"))
|
||||
self.ok = wx.Button(panel, wx.ID_OK, _("&Update profile"))
|
||||
self.ok.SetDefault()
|
||||
close = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
@ -73,12 +73,12 @@ class updateProfileDialog(baseDialog.BaseWXDialog):
|
||||
|
||||
def change_upload_button(self, uploaded=False):
|
||||
if uploaded == False:
|
||||
self.upload_image.SetLabel(_(u"Upload a picture"))
|
||||
self.upload_image.SetLabel(_("Upload a picture"))
|
||||
else:
|
||||
self.upload_image.SetLabel(_(u"Discard image"))
|
||||
self.upload_image.SetLabel(_("Discard image"))
|
||||
|
||||
def upload_picture(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)
|
||||
openFileDialog = wx.FileDialog(self, _("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 openFileDialog.GetPath()
|
||||
|
@ -2,7 +2,7 @@
|
||||
import wx
|
||||
|
||||
class urlList(wx.Dialog):
|
||||
def __init__(self, title=_(u"Select URL")):
|
||||
def __init__(self, title=_("Select URL")):
|
||||
super(urlList, self).__init__(parent=None, title=title)
|
||||
panel = wx.Panel(self)
|
||||
self.lista = wx.ListBox(panel, -1)
|
||||
|
@ -6,24 +6,24 @@ class UserActionsDialog(wx.Dialog):
|
||||
super(UserActionsDialog, self).__init__(parent=None, *args, **kwargs)
|
||||
panel = wx.Panel(self)
|
||||
userSizer = wx.BoxSizer()
|
||||
self.SetTitle(_(u"Action"))
|
||||
userLabel = wx.StaticText(panel, -1, _(u"&User"))
|
||||
self.SetTitle(_("Action"))
|
||||
userLabel = wx.StaticText(panel, -1, _("&User"))
|
||||
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
|
||||
self.cb.SetFocus()
|
||||
self.autocompletion = wx.Button(panel, -1, _(u"&Autocomplete users"))
|
||||
self.autocompletion = wx.Button(panel, -1, _("&Autocomplete users"))
|
||||
userSizer.Add(userLabel, 0, wx.ALL, 5)
|
||||
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
||||
userSizer.Add(self.autocompletion, 0, wx.ALL, 5)
|
||||
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
label2 = wx.StaticText(panel, -1, _(u"Action"))
|
||||
self.follow = wx.RadioButton(panel, -1, _(u"&Follow"), name=_(u"Action"), style=wx.RB_GROUP)
|
||||
self.unfollow = wx.RadioButton(panel, -1, _(u"U&nfollow"))
|
||||
self.mute = wx.RadioButton(panel, -1, _(u"&Mute"))
|
||||
self.unmute = wx.RadioButton(panel, -1, _(u"Unmu&te"))
|
||||
self.block = wx.RadioButton(panel, -1, _(u"&Block"))
|
||||
self.unblock = wx.RadioButton(panel, -1, _(u"Unbl&ock"))
|
||||
self.reportSpam = wx.RadioButton(panel, -1, _(u"&Report as spam"))
|
||||
self.ignore_client = wx.RadioButton(panel, -1, _(u"&Ignore tweets from this client"))
|
||||
label2 = wx.StaticText(panel, -1, _("Action"))
|
||||
self.follow = wx.RadioButton(panel, -1, _("&Follow"), name=_("Action"), style=wx.RB_GROUP)
|
||||
self.unfollow = wx.RadioButton(panel, -1, _("U&nfollow"))
|
||||
self.mute = wx.RadioButton(panel, -1, _("&Mute"))
|
||||
self.unmute = wx.RadioButton(panel, -1, _("Unmu&te"))
|
||||
self.block = wx.RadioButton(panel, -1, _("&Block"))
|
||||
self.unblock = wx.RadioButton(panel, -1, _("Unbl&ock"))
|
||||
self.reportSpam = wx.RadioButton(panel, -1, _("&Report as spam"))
|
||||
self.ignore_client = wx.RadioButton(panel, -1, _("&Ignore tweets from this client"))
|
||||
self.setup_default(default)
|
||||
hSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hSizer.Add(label2, 0, wx.ALL, 5)
|
||||
@ -37,9 +37,9 @@ class UserActionsDialog(wx.Dialog):
|
||||
actionSizer.Add(self.ignore_client, 0, wx.ALL, 5)
|
||||
hSizer.Add(actionSizer, 0, wx.ALL, 5)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"&OK"))
|
||||
ok = wx.Button(panel, wx.ID_OK, _("&OK"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close"))
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
|
||||
btnsizer = wx.BoxSizer()
|
||||
btnsizer.Add(ok)
|
||||
btnsizer.Add(cancel)
|
||||
|
@ -6,20 +6,20 @@ class selectUserDialog(wx.Dialog):
|
||||
super(selectUserDialog, self).__init__(parent=None, *args, **kwargs)
|
||||
panel = wx.Panel(self)
|
||||
userSizer = wx.BoxSizer()
|
||||
self.SetTitle(_(u"Timeline for %s") % (users[0]))
|
||||
userLabel = wx.StaticText(panel, -1, _(u"User"))
|
||||
self.SetTitle(_("Timeline for %s") % (users[0]))
|
||||
userLabel = wx.StaticText(panel, -1, _("User"))
|
||||
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
|
||||
self.cb.SetFocus()
|
||||
self.autocompletion = wx.Button(panel, -1, _(u"&Autocomplete users"))
|
||||
self.autocompletion = wx.Button(panel, -1, _("&Autocomplete users"))
|
||||
userSizer.Add(userLabel, 0, wx.ALL, 5)
|
||||
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
||||
userSizer.Add(self.autocompletion, 0, wx.ALL, 5)
|
||||
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
label2 = wx.StaticText(panel, -1, _(u"Buffer type"))
|
||||
self.tweets = wx.RadioButton(panel, -1, _(u"&Tweets"), style=wx.RB_GROUP)
|
||||
self.favourites = wx.RadioButton(panel, -1, _(u"&Likes"))
|
||||
self.followers = wx.RadioButton(panel, -1, _(u"&Followers"))
|
||||
self.friends = wx.RadioButton(panel, -1, _(u"F&riends"))
|
||||
label2 = wx.StaticText(panel, -1, _("Buffer type"))
|
||||
self.tweets = wx.RadioButton(panel, -1, _("&Tweets"), style=wx.RB_GROUP)
|
||||
self.favourites = wx.RadioButton(panel, -1, _("&Likes"))
|
||||
self.followers = wx.RadioButton(panel, -1, _("&Followers"))
|
||||
self.friends = wx.RadioButton(panel, -1, _("F&riends"))
|
||||
self.setup_default(default)
|
||||
hSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hSizer.Add(label2, 0, wx.ALL, 5)
|
||||
@ -29,9 +29,9 @@ class selectUserDialog(wx.Dialog):
|
||||
actionSizer.Add(self.friends, 0, wx.ALL, 5)
|
||||
hSizer.Add(actionSizer, 0, wx.ALL, 5)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"&OK"))
|
||||
ok = wx.Button(panel, wx.ID_OK, _("&OK"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close"))
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
|
||||
btnsizer = wx.BoxSizer()
|
||||
btnsizer.Add(ok)
|
||||
btnsizer.Add(cancel)
|
||||
|
@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
############################################################
|
||||
from __future__ import absolute_import
|
||||
|
||||
import wx
|
||||
from . import baseDialog
|
||||
|
||||
@ -27,15 +27,15 @@ class selectUserDialog(baseDialog.BaseWXDialog):
|
||||
userSizer = wx.BoxSizer()
|
||||
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0], size=wx.DefaultSize)
|
||||
self.cb.SetFocus()
|
||||
self.autocompletion = wx.Button(panel, -1, _(u"&Autocomplete users"))
|
||||
userSizer.Add(wx.StaticText(panel, -1, _(u"User")), 0, wx.ALL, 5)
|
||||
self.autocompletion = wx.Button(panel, -1, _("&Autocomplete users"))
|
||||
userSizer.Add(wx.StaticText(panel, -1, _("User")), 0, wx.ALL, 5)
|
||||
userSizer.Add(self.cb, 0, wx.ALL, 5)
|
||||
userSizer.Add(self.autocompletion, 0, wx.ALL, 5)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
||||
ok = wx.Button(panel, wx.ID_OK, _("OK"))
|
||||
ok.SetDefault()
|
||||
# ok.Bind(wx.EVT_BUTTON, self.onok)
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _("Close"))
|
||||
btnsizer = wx.BoxSizer()
|
||||
btnsizer.Add(ok, 0, wx.ALL, 5)
|
||||
btnsizer.Add(cancel, 0, wx.ALL, 5)
|
||||
|
@ -4,94 +4,94 @@ import wx
|
||||
class basePanelMenu(wx.Menu):
|
||||
def __init__(self):
|
||||
super(basePanelMenu, self).__init__()
|
||||
self.retweet = wx.MenuItem(self, wx.NewId(), _(u"&Retweet"))
|
||||
self.retweet = wx.MenuItem(self, wx.NewId(), _("&Retweet"))
|
||||
self.Append(self.retweet)
|
||||
self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply"))
|
||||
self.reply = wx.MenuItem(self, wx.NewId(), _("Re&ply"))
|
||||
self.Append(self.reply)
|
||||
self.fav = wx.MenuItem(self, wx.NewId(), _(u"&Like"))
|
||||
self.fav = wx.MenuItem(self, wx.NewId(), _("&Like"))
|
||||
self.Append(self.fav)
|
||||
self.unfav = wx.MenuItem(self, wx.NewId(), _(u"&Unlike"))
|
||||
self.unfav = wx.MenuItem(self, wx.NewId(), _("&Unlike"))
|
||||
self.Append(self.unfav)
|
||||
self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
|
||||
self.openUrl = wx.MenuItem(self, wx.NewId(), _("&Open URL"))
|
||||
self.Append(self.openUrl)
|
||||
self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio"))
|
||||
self.play = wx.MenuItem(self, wx.NewId(), _("&Play audio"))
|
||||
self.Append(self.play)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet"))
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _("&Show tweet"))
|
||||
self.Append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard"))
|
||||
self.Append(self.copy)
|
||||
self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
|
||||
self.remove = wx.MenuItem(self, wx.NewId(), _("&Delete"))
|
||||
self.Append(self.remove)
|
||||
self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions..."))
|
||||
self.userActions = wx.MenuItem(self, wx.NewId(), _("&User actions..."))
|
||||
self.Append(self.userActions)
|
||||
|
||||
class dmPanelMenu(wx.Menu):
|
||||
def __init__(self):
|
||||
super(dmPanelMenu, self).__init__()
|
||||
self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply"))
|
||||
self.append(self.reply)
|
||||
self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
|
||||
self.append(self.openUrl)
|
||||
self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio"))
|
||||
self.append(self.play)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show direct message"))
|
||||
self.append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
|
||||
self.append(self.copy)
|
||||
self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
|
||||
self.append(self.remove)
|
||||
self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions..."))
|
||||
self.append(self.userActions)
|
||||
self.reply = wx.MenuItem(self, wx.NewId(), _("Re&ply"))
|
||||
self.Append(self.reply)
|
||||
self.openUrl = wx.MenuItem(self, wx.NewId(), _("&Open URL"))
|
||||
self.Append(self.openUrl)
|
||||
self.play = wx.MenuItem(self, wx.NewId(), _("&Play audio"))
|
||||
self.Append(self.play)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _("&Show direct message"))
|
||||
self.Append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard"))
|
||||
self.Append(self.copy)
|
||||
self.remove = wx.MenuItem(self, wx.NewId(), _("&Delete"))
|
||||
self.Append(self.remove)
|
||||
self.userActions = wx.MenuItem(self, wx.NewId(), _("&User actions..."))
|
||||
self.Append(self.userActions)
|
||||
|
||||
class sentPanelMenu(wx.Menu):
|
||||
def __init__(self):
|
||||
super(sentPanelMenu, self).__init__()
|
||||
self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
|
||||
self.append(self.openUrl)
|
||||
self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio"))
|
||||
self.append(self.play)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet"))
|
||||
self.append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
|
||||
self.append(self.copy)
|
||||
self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
|
||||
self.append(self.remove)
|
||||
self.openUrl = wx.MenuItem(self, wx.NewId(), _("&Open URL"))
|
||||
self.Append(self.openUrl)
|
||||
self.play = wx.MenuItem(self, wx.NewId(), _("&Play audio"))
|
||||
self.Append(self.play)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _("&Show tweet"))
|
||||
self.Append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard"))
|
||||
self.Append(self.copy)
|
||||
self.remove = wx.MenuItem(self, wx.NewId(), _("&Delete"))
|
||||
self.Append(self.remove)
|
||||
|
||||
class eventsPanelMenu(wx.Menu):
|
||||
def __init__(self):
|
||||
super(eventsPanelMenu, self).__init__()
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show event"))
|
||||
self.append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
|
||||
self.append(self.copy)
|
||||
self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
|
||||
self.append(self.remove)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _("&Show event"))
|
||||
self.Append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard"))
|
||||
self.Append(self.copy)
|
||||
self.remove = wx.MenuItem(self, wx.NewId(), _("&Delete"))
|
||||
self.Append(self.remove)
|
||||
|
||||
class peoplePanelMenu(wx.Menu):
|
||||
def __init__(self):
|
||||
super(peoplePanelMenu, self).__init__()
|
||||
self.reply = wx.MenuItem(self, wx.NewId(), _(u"Direct &message"))
|
||||
self.append(self.reply)
|
||||
self.lists = wx.MenuItem(self, wx.NewId(), _(u"&View lists"))
|
||||
self.append(self.lists)
|
||||
self.reply = wx.MenuItem(self, wx.NewId(), _("Direct &message"))
|
||||
self.Append(self.reply)
|
||||
self.lists = wx.MenuItem(self, wx.NewId(), _("&View lists"))
|
||||
self.Append(self.lists)
|
||||
self.lists.Enable(False)
|
||||
self.details = wx.MenuItem(self, wx.NewId(), _(u"Show user &profile"))
|
||||
self.append(self.details)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show user"))
|
||||
self.append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
|
||||
self.append(self.copy)
|
||||
self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions..."))
|
||||
self.append(self.userActions)
|
||||
self.details = wx.MenuItem(self, wx.NewId(), _("Show user &profile"))
|
||||
self.Append(self.details)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _("&Show user"))
|
||||
self.Append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard"))
|
||||
self.Append(self.copy)
|
||||
self.userActions = wx.MenuItem(self, wx.NewId(), _("&User actions..."))
|
||||
self.Append(self.userActions)
|
||||
|
||||
class trendsPanelMenu(wx.Menu):
|
||||
def __init__(self):
|
||||
super(trendsPanelMenu, self).__init__()
|
||||
self.search_topic = wx.MenuItem(self, wx.NewId(), _(u"Search topic"))
|
||||
self.append(self.search_topic)
|
||||
self.tweetThisTrend = wx.MenuItem(self, wx.NewId(), _(u"&Tweet about this trend"))
|
||||
self.append(self.tweetThisTrend)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show item"))
|
||||
self.append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
|
||||
self.append(self.copy)
|
||||
self.search_topic = wx.MenuItem(self, wx.NewId(), _("Search topic"))
|
||||
self.Append(self.search_topic)
|
||||
self.tweetThisTrend = wx.MenuItem(self, wx.NewId(), _("&Tweet about this trend"))
|
||||
self.Append(self.tweetThisTrend)
|
||||
self.view = wx.MenuItem(self, wx.NewId(), _("&Show item"))
|
||||
self.Append(self.view)
|
||||
self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard"))
|
||||
self.Append(self.copy)
|
||||
|
@ -31,14 +31,14 @@ class SysTrayIcon(adv.TaskBarIcon):
|
||||
icon=wx.Icon(os.path.join(paths.app_path(), "icon.ico"), wx.BITMAP_TYPE_ICO)
|
||||
self.SetIcon(icon, application.name)
|
||||
self.menu=wx.Menu()
|
||||
self.tweet = self.menu.Append(wx.ID_ANY, _(u"Tweet"))
|
||||
self.global_settings = self.menu.Append(wx.ID_ANY, _(u"&Global settings"))
|
||||
self.account_settings = self.menu.Append(wx.ID_ANY, _(u"Account se&ttings"))
|
||||
self.update_profile = self.menu.Append(wx.ID_ANY, _(u"Update &profile"))
|
||||
self.show_hide = self.menu.Append(wx.ID_ANY, _(u"&Show / hide"))
|
||||
self.doc = self.menu.Append(wx.ID_ANY, _(u"&Documentation"))
|
||||
self.check_for_updates = self.menu.Append(wx.ID_ANY, _(u"Check for &updates"))
|
||||
self.exit = self.menu.Append(wx.ID_ANY, _(u"&Exit"))
|
||||
self.tweet = self.menu.Append(wx.ID_ANY, _("Tweet"))
|
||||
self.global_settings = self.menu.Append(wx.ID_ANY, _("&Global settings"))
|
||||
self.account_settings = self.menu.Append(wx.ID_ANY, _("Account se&ttings"))
|
||||
self.update_profile = self.menu.Append(wx.ID_ANY, _("Update &profile"))
|
||||
self.show_hide = self.menu.Append(wx.ID_ANY, _("&Show / hide"))
|
||||
self.doc = self.menu.Append(wx.ID_ANY, _("&Documentation"))
|
||||
self.check_for_updates = self.menu.Append(wx.ID_ANY, _("Check for &updates"))
|
||||
self.exit = self.menu.Append(wx.ID_ANY, _("&Exit"))
|
||||
|
||||
def show_menu(self):
|
||||
self.PopupMenu(self.menu)
|
||||
|
104
src/wxUI/view.py
104
src/wxUI/view.py
@ -13,74 +13,74 @@ class mainFrame(wx.Frame):
|
||||
|
||||
# Application menu
|
||||
app = wx.Menu()
|
||||
self.manage_accounts = app.Append(wx.NewId(), _(u"&Manage accounts"))
|
||||
self.updateProfile = app.Append(wx.NewId(), _(u"&Update profile"))
|
||||
self.show_hide = app.Append(wx.NewId(), _(u"&Hide window"))
|
||||
self.menuitem_search = app.Append(wx.NewId(), _(u"&Search"))
|
||||
self.lists = app.Append(wx.NewId(), _(u"&Lists manager"))
|
||||
self.keystroke_editor = app.Append(wx.NewId(), _(u"&Edit keystrokes"))
|
||||
self.account_settings = app.Append(wx.NewId(), _(u"Account se&ttings"))
|
||||
self.prefs = app.Append(wx.ID_PREFERENCES, _(u"&Global settings"))
|
||||
self.close = app.Append(wx.ID_EXIT, _(u"E&xit"))
|
||||
self.manage_accounts = app.Append(wx.NewId(), _("&Manage accounts"))
|
||||
self.updateProfile = app.Append(wx.NewId(), _("&Update profile"))
|
||||
self.show_hide = app.Append(wx.NewId(), _("&Hide window"))
|
||||
self.menuitem_search = app.Append(wx.NewId(), _("&Search"))
|
||||
self.lists = app.Append(wx.NewId(), _("&Lists manager"))
|
||||
self.keystroke_editor = app.Append(wx.NewId(), _("&Edit keystrokes"))
|
||||
self.account_settings = app.Append(wx.NewId(), _("Account se&ttings"))
|
||||
self.prefs = app.Append(wx.ID_PREFERENCES, _("&Global settings"))
|
||||
self.close = app.Append(wx.ID_EXIT, _("E&xit"))
|
||||
|
||||
# Tweet menu
|
||||
tweet = wx.Menu()
|
||||
self.compose = tweet.Append(wx.NewId(), _(u"&Tweet"))
|
||||
self.reply = tweet.Append(wx.NewId(), _(u"Re&ply"))
|
||||
self.retweet = tweet.Append(wx.NewId(), _(u"&Retweet"))
|
||||
self.fav = tweet.Append(wx.NewId(), _(u"&Like"))
|
||||
self.unfav = tweet.Append(wx.NewId(), _(u"&Unlike"))
|
||||
self.view = tweet.Append(wx.NewId(), _(u"&Show tweet"))
|
||||
self.view_coordinates = tweet.Append(wx.NewId(), _(u"View &address"))
|
||||
self.view_conversation = tweet.Append(wx.NewId(), _(u"View conversa&tion"))
|
||||
self.ocr = tweet.Append(wx.NewId(), _(u"Read text in picture"))
|
||||
self.delete = tweet.Append(wx.NewId(), _(u"&Delete"))
|
||||
self.compose = tweet.Append(wx.NewId(), _("&Tweet"))
|
||||
self.reply = tweet.Append(wx.NewId(), _("Re&ply"))
|
||||
self.retweet = tweet.Append(wx.NewId(), _("&Retweet"))
|
||||
self.fav = tweet.Append(wx.NewId(), _("&Like"))
|
||||
self.unfav = tweet.Append(wx.NewId(), _("&Unlike"))
|
||||
self.view = tweet.Append(wx.NewId(), _("&Show tweet"))
|
||||
self.view_coordinates = tweet.Append(wx.NewId(), _("View &address"))
|
||||
self.view_conversation = tweet.Append(wx.NewId(), _("View conversa&tion"))
|
||||
self.ocr = tweet.Append(wx.NewId(), _("Read text in picture"))
|
||||
self.delete = tweet.Append(wx.NewId(), _("&Delete"))
|
||||
|
||||
# User menu
|
||||
user = wx.Menu()
|
||||
self.follow = user.Append(wx.NewId(), _(u"&Actions..."))
|
||||
self.timeline = user.Append(wx.NewId(), _(u"&View timeline..."))
|
||||
self.dm = user.Append(wx.NewId(), _(u"Direct me&ssage"))
|
||||
self.addToList = user.Append(wx.NewId(), _(u"&Add to list"))
|
||||
self.removeFromList = user.Append(wx.NewId(), _(u"R&emove from list"))
|
||||
self.viewLists = user.Append(wx.NewId(), _(u"&View lists"))
|
||||
self.details = user.Append(wx.NewId(), _(u"Show user &profile"))
|
||||
self.favs = user.Append(wx.NewId(), _(u"V&iew likes"))
|
||||
self.follow = user.Append(wx.NewId(), _("&Actions..."))
|
||||
self.timeline = user.Append(wx.NewId(), _("&View timeline..."))
|
||||
self.dm = user.Append(wx.NewId(), _("Direct me&ssage"))
|
||||
self.addToList = user.Append(wx.NewId(), _("&Add to list"))
|
||||
self.removeFromList = user.Append(wx.NewId(), _("R&emove from list"))
|
||||
self.viewLists = user.Append(wx.NewId(), _("&View lists"))
|
||||
self.details = user.Append(wx.NewId(), _("Show user &profile"))
|
||||
self.favs = user.Append(wx.NewId(), _("V&iew likes"))
|
||||
|
||||
# buffer menu
|
||||
buffer = wx.Menu()
|
||||
self.update_buffer = buffer.Append(wx.NewId(), _(u"&Update buffer"))
|
||||
self.trends = buffer.Append(wx.NewId(), _(u"New &trending topics buffer..."))
|
||||
self.find = buffer.Append(wx.NewId(), _(u"Find a string in the currently focused buffer..."))
|
||||
self.load_previous_items = buffer.Append(wx.NewId(), _(u"&Load previous items"))
|
||||
self.update_buffer = buffer.Append(wx.NewId(), _("&Update buffer"))
|
||||
self.trends = buffer.Append(wx.NewId(), _("New &trending topics buffer..."))
|
||||
self.find = buffer.Append(wx.NewId(), _("Find a string in the currently focused buffer..."))
|
||||
self.load_previous_items = buffer.Append(wx.NewId(), _("&Load previous items"))
|
||||
buffer.AppendSeparator()
|
||||
self.mute_buffer = buffer.AppendCheckItem(wx.NewId(), _(u"&Mute"))
|
||||
self.autoread = buffer.AppendCheckItem(wx.NewId(), _(u"&Autoread"))
|
||||
self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer"))
|
||||
self.deleteTl = buffer.Append(wx.NewId(), _(u"&Destroy"))
|
||||
self.mute_buffer = buffer.AppendCheckItem(wx.NewId(), _("&Mute"))
|
||||
self.autoread = buffer.AppendCheckItem(wx.NewId(), _("&Autoread"))
|
||||
self.clear = buffer.Append(wx.NewId(), _("&Clear buffer"))
|
||||
self.deleteTl = buffer.Append(wx.NewId(), _("&Destroy"))
|
||||
|
||||
# audio menu
|
||||
audio = wx.Menu()
|
||||
self.seekLeft = audio.Append(wx.NewId(), _(u"&Seek back 5 seconds"))
|
||||
self.seekRight = audio.Append(wx.NewId(), _(u"&Seek forward 5 seconds"))
|
||||
self.seekLeft = audio.Append(wx.NewId(), _("&Seek back 5 seconds"))
|
||||
self.seekRight = audio.Append(wx.NewId(), _("&Seek forward 5 seconds"))
|
||||
|
||||
# Help Menu
|
||||
help = wx.Menu()
|
||||
self.doc = help.Append(-1, _(u"&Documentation"))
|
||||
self.sounds_tutorial = help.Append(wx.NewId(), _(u"Sounds &tutorial"))
|
||||
self.changelog = help.Append(wx.NewId(), _(u"&What's new in this version?"))
|
||||
self.check_for_updates = help.Append(wx.NewId(), _(u"&Check for updates"))
|
||||
self.reportError = help.Append(wx.NewId(), _(u"&Report an error"))
|
||||
self.visit_website = help.Append(-1, _(u"{0}'s &website").format(application.name,))
|
||||
self.about = help.Append(-1, _(u"About &{0}").format(application.name,))
|
||||
self.doc = help.Append(-1, _("&Documentation"))
|
||||
self.sounds_tutorial = help.Append(wx.NewId(), _("Sounds &tutorial"))
|
||||
self.changelog = help.Append(wx.NewId(), _("&What's new in this version?"))
|
||||
self.check_for_updates = help.Append(wx.NewId(), _("&Check for updates"))
|
||||
self.reportError = help.Append(wx.NewId(), _("&Report an error"))
|
||||
self.visit_website = help.Append(-1, _("{0}'s &website").format(application.name,))
|
||||
self.about = help.Append(-1, _("About &{0}").format(application.name,))
|
||||
|
||||
# Add all to the menu Bar
|
||||
menuBar.Append(app, _(u"&Application"))
|
||||
menuBar.Append(tweet, _(u"&Tweet"))
|
||||
menuBar.Append(user, _(u"&User"))
|
||||
menuBar.Append(buffer, _(u"&Buffer"))
|
||||
menuBar.Append(audio, _(u"&Audio"))
|
||||
menuBar.Append(help, _(u"&Help"))
|
||||
menuBar.Append(app, _("&Application"))
|
||||
menuBar.Append(tweet, _("&Tweet"))
|
||||
menuBar.Append(user, _("&User"))
|
||||
menuBar.Append(buffer, _("&Buffer"))
|
||||
menuBar.Append(audio, _("&Audio"))
|
||||
menuBar.Append(help, _("&Help"))
|
||||
|
||||
self.accel_tbl = wx.AcceleratorTable([
|
||||
(wx.ACCEL_CTRL, ord('N'), self.compose.GetId()),
|
||||
@ -166,7 +166,7 @@ class mainFrame(wx.Frame):
|
||||
self.Show()
|
||||
|
||||
def show_address(self, address):
|
||||
wx.MessageDialog(self, address, _(u"Address"), wx.OK).ShowModal()
|
||||
wx.MessageDialog(self, address, _("Address"), wx.OK).ShowModal()
|
||||
|
||||
def delete_buffer(self, pos):
|
||||
self.nb.DeletePage(pos)
|
||||
@ -196,4 +196,4 @@ class mainFrame(wx.Frame):
|
||||
return self.nb.GetPageText(page)
|
||||
|
||||
def no_update_available():
|
||||
wx.MessageDialog(None, _(u"Your {0} version is up to date").format(application.name,), _(u"Update"), style=wx.OK).ShowModal()
|
||||
wx.MessageDialog(None, _("Your {0} version is up to date").format(application.name,), _("Update"), style=wx.OK).ShowModal()
|
||||
|
Loading…
x
Reference in New Issue
Block a user