Removed GTK module for now, updated translation template, updated Spanish Translation

This commit is contained in:
Manuel Cortez 2015-06-26 08:45:25 -05:00
parent 67910e18a8
commit f70033bb27
32 changed files with 1603 additions and 2613 deletions

View File

@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
""" This is the GTK view module for TWBlue.
As of April 3 2015, there are the things that have been implemented:
* the main view (partially implemented)
* All buffers.
* Three of the most common message dialogs.
* Dialogs for tweet, reply, retweet, send a direct message and view a tweet.
And we need to implement:
* All the other dialogs.
"""

View File

@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
from base import basePanel
from dm import dmPanel
from events import eventsPanel
from favourites import favsPanel
from lists import listPanel
from panels import accountPanel, emptyPanel
from people import peoplePanel
from trends import trendsPanel
from tweet_searches import searchPanel
from user_searches import searchUsersPanel

View File

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
import widgetUtils
from gi.repository import Gtk
class basePanel(Gtk.VBox):
def create_list(self):
self.list = widgetUtils.list(_(u"User"), _(u"Text"), _(u"Date"), _(u"Client"))
def __init__(self, parent, name):
super(basePanel, self).__init__(spacing=6)
self.name = name
self.type = "baseBuffer"
self.create_list()
self.tweet = Gtk.Button(_(u"Tweet"))
self.retweet = Gtk.Button(_(u"Retweet"))
self.reply = Gtk.Button(_(u"Reply"))
self.dm = Gtk.Button(_(u"Direct message"))
btnSizer = Gtk.Box(spacing=6)
btnSizer.add(self.tweet)
btnSizer.add(self.retweet)
btnSizer.add(self.reply)
btnSizer.add(self.dm)
self.add(self.list.list)
self.add(btnSizer)
def set_position(self, reversed=False):
if reversed == False:
self.list.select_item(self.list.get_count()-1)
else:
self.list.select_item(0)
def set_focus_function(self, f):
tree_selection = self.list.list.get_selection()
tree_selection.connect("changed", f)

View File

@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
import widgetUtils
from base import basePanel
class dmPanel(basePanel):
def __init__(self, parent, name):
""" Class to DM'S. Reply and retweet buttons are not showed and they have your delete method for dm's."""
super(dmPanel, self).__init__(parent, name)
self.retweet.hide()
self.retweet.set_no_show_all(True)
self.reply.hide()
self.reply.set_no_show_all(True)
self.type = "dm"

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
import widgetUtils
from gi.repository import Gtk
class eventsPanel(Gtk.VBox):
""" Buffer to show events. Different than tweets or people."""
def __init__(self, parent, name):
self.type = "event"
super(eventsPanel, self).__init__(spacing=6)
self.name = name
self.list = widgetUtils.list(_(u"Date"), _(u"Event"))
self.add(self.list.list)
self.tweet = Gtk.Button(_(u"Tweet"))
self.delete_event = Gtk.Button(_(u"Remove event"))
btnBox = Gtk.Box(spacing=6)
btnBox.add(self.tweet)
btnBox.add(self.delete_event)
self.add(btnBox)
def set_position(self, reversed=False):
if reversed == False:
self.list.select_item(self.list.get_count()-1)
else:
self.list.select_item(0)

View File

@ -1,8 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
from base import basePanel
class favsPanel(basePanel):
def __init__(self, parent, name):
super(favsPanel, self).__init__(parent, name)
self.type = "favourites_timeline"

View File

@ -1,9 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
from base import basePanel
class listPanel(basePanel):
def __init__(self, parent, name):
super(listPanel, self).__init__(parent, name)
self.type = "list"
self.users = []

View File

@ -1,34 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
import widgetUtils
class accountPanel(Gtk.VBox):
def __init__(self, parent, name=None):
super(accountPanel, self).__init__(spacing=5)
self.name = name
self.type = "account"
self.login = Gtk.Button(_(u"Login"))
self.add(self.login)
self.autostart_account = Gtk.ToggleButton(_(u"Log in automatically"))
self.add(self.autostart_account)
def change_login(self, login=True):
if login == True:
self.login.set_label(_(u"Login"))
else:
self.login.set_label(_(u"Logout"))
def change_autostart(self, autostart=True):
self.autostart_account.set_active(autostart)
def get_autostart(self):
print "actived"
print self.autostart_account.get_active()
return self.autostart_account.get_active()
class emptyPanel(Gtk.VBox):
def __init__(self, parent, name):
super(emptyPanel, self).__init__(spacing=6)
self.name = name
self.type = "account"

View File

@ -1,17 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
import widgetUtils
from base import basePanel
class peoplePanel(basePanel):
""" Buffer used to show people."""
def create_list(self):
self.list = widgetUtils.list(_(u"User"))
def __init__(self, parent, name):
super(peoplePanel, self).__init__(parent, name)
self.type = "people"
self.reply.set_label(_(u"Mention"))
self.retweet.hide()
self.retweet.set_no_show_all(True)

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
import widgetUtils
class trendsPanel(Gtk.VBox):
def create_list(self):
""" Returns the list for put the tweets here."""
self.list = widgetUtils.list(_(u"Trending topic"))
def __init__(self, parent, name):
super(trendsPanel, self).__init__(spacing=6)
self.type = "trends"
self.create_list()
self.tweet = Gtk.Button(_(u"Tweet"))
self.tweetTrendBtn = Gtk.Button(_(u"Tweet about this trend"))
btnSizer = Gtk.Box(spacing=3)
btnSizer.add(self.tweet)
btnSizer.add(self.tweetTrendBtn)
self.add(btnSizer)
self.Add(self.list.list)
def set_position(self, reversed=False):
if reversed == False:
self.list.select_item(self.list.get_count()-1)
else:
self.list.select_item(0)

View File

@ -1,8 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
from base import basePanel
class searchPanel(basePanel):
def __init__(self, parent, name):
super(searchPanel, self).__init__(parent, name)
self.type = "search"

View File

@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
from tweet_searches import searchPanel
import widgetUtils
class searchUsersPanel(searchPanel):
def create_list(self):
""" Returns the list for put the tweets here."""
self.list = widgetUtils.list(_(u"User"))
def __init__(self, parent, name):
self.create_list()
super(searchUsersPanel, self).__init__(parent, name)
self.type = "user_searches"

View File

@ -1,64 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
import application
def retweet_as_link(parent):
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, unicode(application.name))
dialog.format_secondary_text(_(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?"))
answer = dialog.run()
dialog.destroy()
return answer
def retweet_question(parent):
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, _(u"Retweet"))
dialog.format_secondary_text(_(u"Would you like to add a comment to this tweet?"))
answer = dialog.run()
dialog.destroy()
return answer
def delete_tweet_dialog(parent):
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, _(u"Delete"))
dialog.format_secondary_text(_(u"Do you really want to delete this message? It will be deleted from Twitter as well."))
answer = dialog.run()
dialog.destroy()
return answer
def exit_dialog(parent):
dialog = Gtk.MessageDialog(parent, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, _(u"Exit"))
dialog.format_secondary_text(_(u"Do you really want to close " + application.name + "?"))
answer = dialog.run()
dialog.destroy()
return answer
def needs_restart():
wx.MessageDialog(None, _(unicode(application.name+" must be restarted to save these changes. Press OK to restart now.")), _("Restart " + 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 on the autocomplete results anymore."), _(u"Confirm"), wx.YES_NO|wx.ICON_QUESTION).ShowModal()
def get_ignored_client():
entry = wx.TextEntryDialog(None, _(u"Enter the name of the client here"), _(u"Add a new ignored 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)
return dlg.ShowModal()
def remove_buffer():
return wx.MessageDialog(None, _(u"Do you really want to delete this timeline?"), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def user_not_exist():
return wx.MessageDialog(None, _(u"The user does not exist"), _(u"Error"), wx.ICON_ERROR).ShowModal()
def timeline_exist():
return wx.MessageDialog(None, _(u"There's currently a timeline for this user. You are not able to open another"), _(u"Existing timeline"), wx.ICON_ERROR).ShowModal()
def no_tweets():
return wx.MessageDialog(None, _(u"This user has no tweets. You can't open a timeline for this user"), _(u"Error!"), wx.ICON_ERROR).ShowModal()
def protected_user():
return wx.MessageDialog(None, _(u"This is a protected Twitter user. It means you can not 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()
def no_following():
return wx.MessageDialog(None, _(u"This is a protected user account, you need follow to this user for viewing your tweets or favourites."), _(u"Error"), wx.ICON_ERROR).ShowModal()

View File

@ -1 +0,0 @@
#import trends, configuration, lists, message, search, show_user, update_profile, urlList, userSelection, utils

View File

@ -1,228 +0,0 @@
# -*- coding: utf-8 -*-
import baseDialog
import wx
import logging as original_logger
import application
class general(wx.Panel, baseDialog.BaseWXDialog):
def __init__(self, parent, languages):
super(general, self).__init__(parent)
sizer = wx.BoxSizer(wx.VERTICAL)
language = wx.StaticText(self, -1, _(u"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.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting " + application.name))
sizer.Add(self.ask_at_exit, 0, wx.ALL, 5)
self.use_invisible_shorcuts = wx.CheckBox(self, -1, _(u"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"))
sizer.Add(self.disable_sapi5, 0, wx.ALL, 5)
self.hide_gui = wx.CheckBox(self, -1, _(u"Hide GUI on launch"))
sizer.Add(self.hide_gui, 0, wx.ALL, 5)
self.SetSizer(sizer)
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"Set the autocomplete function"))
sizer.Add(self.au, 0, wx.ALL, 5)
self.relative_time = wx.CheckBox(self, wx.NewId(), _(U"Relative times"))
sizer.Add(self.relative_time, 0, wx.ALL, 5)
apiCallsBox = wx.BoxSizer(wx.HORIZONTAL)
apiCallsBox.Add(wx.StaticText(self, -1, _(u"API calls when the stream is started (One API call equals to 200 tweetts, two API calls equals 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)
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 of the lists while the oldest at the end"))
sizer.Add(self.reverse_timelines, 0, wx.ALL, 5)
self.SetSizer(sizer)
class other_buffers(wx.Panel):
def __init__(self, parent):
super(other_buffers, self).__init__(parent)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
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"))
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"))
btnBox = wx.BoxSizer(wx.HORIZONTAL)
btnBox.Add(self.add, 0, wx.ALL, 5)
btnBox.Add(self.remove, 0, wx.ALL, 5)
sizer.Add(clientsBox, 0, wx.ALL, 5)
sizer.Add(btnBox, 0, wx.ALL, 5)
self.SetSizer(sizer)
def append(self, client):
self.clients.Append(client)
def get_clients(self):
return self.clients.GetCount()
def get_client_id(self):
return self.clients.GetSelection()
def remove_(self, id):
self.clients.Delete(id)
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"))
self.volumeCtrl = wx.Slider(self)
self.volumeCtrl.SetRange(0, 100)
self.volumeCtrl.SetSize(self.volumeCtrl.GetBestSize())
volumeBox = wx.BoxSizer(wx.HORIZONTAL)
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"))
sizer.Add(self.session_mute, 0, wx.ALL, 5)
output_label = wx.StaticText(self, -1, _(u"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"))
self.input = wx.ComboBox(self, -1, choices=input_devices, style=wx.CB_READONLY)
self.input.SetSize(self.input.GetBestSize())
inputBox = wx.BoxSizer(wx.HORIZONTAL)
inputBox.Add(input_label, 0, wx.ALL, 5)
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"))
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.SetSizer(sizer)
def get(self, control):
return getattr(self, control).GetStringSelection()
class audioServicesPanel(wx.Panel):
def __init__(self, parent):
super(audioServicesPanel, self).__init__(parent)
mainSizer = wx.BoxSizer(wx.VERTICAL)
apiKeyLabel = wx.StaticText(self, -1, _(u"If you've got a SndUp account, enter your API Key here. Whether the API Key is wrong, the App will fail to upload anything to the server. Whether there's no API Key here, then the audio files will be uploaded anonimously"))
self.apiKey = wx.TextCtrl(self, -1)
dc = wx.WindowDC(self.apiKey)
dc.SetFont(self.apiKey.GetFont())
self.apiKey.SetSize(dc.GetTextExtent("0"*100))
apiKeyBox = wx.BoxSizer(wx.HORIZONTAL)
apiKeyBox.Add(apiKeyLabel, 0, wx.ALL, 5)
apiKeyBox.Add(self.apiKey, 0, wx.ALL, 5)
mainSizer.Add(apiKeyBox, 0, wx.ALL, 5)
first_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.dropbox = wx.Button(self, -1)
first_sizer.Add(self.dropbox, 0, wx.ALL, 5)
mainSizer.Add(first_sizer, 0, wx.ALL, 5)
self.SetSizer(mainSizer)
def set_dropbox(self, active=True):
if active == True:
self.dropbox.SetLabel(_(u"Unlink your Dropbox account"))
else:
self.dropbox.SetLabel(_(u"Link your Dropbox account"))
def show_dialog(self):
wx.MessageDialog(self, _(u"The authorization request will be opened in your browser. Copy the code from Dropbox and paste it into the text box which will appear. You only need to do this once."), _(u"Authorization"), wx.OK).ShowModal()
def get_response(self):
dlg = wx.TextEntryDialog(self, _(u"Enter the code here."), _(u"Verification code"))
if dlg.ShowModal() == wx.ID_CANCEL:
return False
return dlg.GetValue()
def show_error(self):
wx.MessageDialog(self, _(u"Error during authorisation. Try again later."), _(u"Error!"), wx.ICON_ERROR).ShowModal()
def get_dropbox(self):
return self.dropbox.GetLabel()
class configurationDialog(baseDialog.BaseWXDialog):
def set_title(self, title):
self.SetTitle(title)
def __init__(self):
super(configurationDialog, self).__init__(None, -1)
self.panel = wx.Panel(self)
self.SetTitle(_(u"TW Blue preferences"))
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.notebook = wx.Notebook(self.panel)
def create_general(self, languageList):
self.general = general(self.notebook, languageList)
self.notebook.AddPage(self.general, _(u"General"))
self.general.SetFocus()
def create_general_account(self):
self.general = generalAccount(self.notebook)
self.notebook.AddPage(self.general, _(u"General"))
self.general.SetFocus()
def create_other_buffers(self):
self.buffers = other_buffers(self.notebook)
self.notebook.AddPage(self.buffers, _(u"Show other 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"))
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"))
def create_audio_services(self):
self.services = audioServicesPanel(self.notebook)
self.notebook.AddPage(self.services, _(u"Audio Services"))
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.SetDefault()
cancel = wx.Button(self.panel, wx.ID_CANCEL, _(u"Close"))
self.SetEscapeId(cancel.GetId())
ok_cancel_box.Add(ok, 0, wx.ALL, 5)
ok_cancel_box.Add(cancel, 0, wx.ALL, 5)
self.sizer.Add(ok_cancel_box, 0, wx.ALL, 5)
self.panel.SetSizer(self.sizer)
self.SetClientSize(self.sizer.CalcMin())
def get_value(self, panel, key):
p = getattr(self, panel)
return getattr(p, key).GetValue()
def set_value(self, panel, key, value):
p = getattr(self, panel)
control = getattr(p, key)
getattr(control, "SetValue")(value)

View File

@ -1,123 +0,0 @@
# -*- coding: utf-8 -*-
import wx
from multiplatform_widgets import widgets
class listViewer(wx.Dialog):
def __init__(self, *args, **kwargs):
super(listViewer, self).__init__(parent=None, *args, **kwargs)
self.SetTitle(_(u"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)
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.members = wx.Button(panel, -1, _(u"View members"))
# self.members.Disable()
# self.subscriptors = wx.Button(panel, -1, _(u"View subscribers"))
# self.subscriptors.Disable()
# self.get_linkBtn = wx.Button(panel, -1, _(u"Get link for the list"))
# self.get_linkBtn.Bind(wx.EVT_BUTTON, self.onGetLink)
self.cancelBtn = wx.Button(panel, wx.ID_CANCEL)
btnSizer = wx.BoxSizer()
btnSizer.Add(self.createBtn)
btnSizer.Add(self.editBtn)
btnSizer.Add(self.cancelBtn)
panel.SetSizer(sizer)
def populate_list(self, lists):
for item in lists:
self.lista.insert_item(False, *item)
def get_item(self):
return self.lista.get_selected()
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.editBtn.Disable()
self.view.Disable()
class createListDialog(wx.Dialog):
def __init__(self, *args, **kwargs):
super(createListDialog, self).__init__(*args, **kwargs)
self.SetTitle(_(u"Create a new list"))
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
name = wx.StaticText(panel, -1, _(u"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"))
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"))
modeBox = wx.BoxSizer(wx.HORIZONTAL)
modeBox.Add(mode)
modeBox.Add(self.public)
modeBox.Add(self.private)
ok = wx.Button(panel, wx.ID_OK)
ok.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL)
btnBox = wx.BoxSizer(wx.HORIZONTAL)
btnBox.Add(ok)
btnBox.Add(cancel)
sizer.Add(nameSizer)
sizer.Add(descriptionSizer)
sizer.Add(modeBox)
sizer.Add(btnBox)
def get(self, field):
return getattr(self, field).GetValue()
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.name.ChangeValue(list["name"])
self.description.ChangeValue(list["description"])
if list["mode"] == "public":
self.public.SetValue(True)
else:
self.private.SetValue(True)
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.createBtn.SetDefault()
self.editBtn.Disable()
self.view.Disable()
# self.subscriptors.Disable()
# self.members.Disable()
self.deleteBtn.Disable()
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.createBtn.SetDefault()
self.editBtn.Disable()
self.view.Disable()
# self.subscriptors.Disable()
# self.members.Disable()
self.deleteBtn.Disable()

View File

@ -1,275 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import Gtk
import widgetUtils
class textLimited(widgetUtils.baseDialog):
def __init__(self, *args, **kwargs):
super(textLimited, self).__init__(buttons=(Gtk.STOCK_OK, widgetUtils.OK, Gtk.STOCK_CANCEL, widgetUtils.CANCEL), *args, **kwargs)
def createTextArea(self, message="", text=""):
self.label = Gtk.Label(message)
self.set_title(message, titleWindow=True)
self.text = Gtk.Entry()
self.text.set_max_length(140)
self.text.set_text(text)
self.text.set_placeholder_text(message)
self.set_title(str(len(text)))
self.textBox = Gtk.Box(spacing=10)
self.textBox.add(self.label)
self.textBox.add(self.text)
def get(self, control):
if control == "upload_image":
return self.upload_image.get_label()
elif control == "cb":
return self.cb.get_active_text()
def set(self, control, val):
if control == "upload_image":
self.upload_image.set_label(val)
elif control == "cb":
self.cb.set_active_text(val)
def text_focus(self):
self.text.grab_focus()
def get_text(self):
return self.text.get_text()
def set_text(self, text):
self.text.set_text(text)
def set_title(self, new_title, titleWindow=False):
if titleWindow == False:
self.text.set_placeholder_text(new_title)
else:
super(textLimited, self).set_title(new_title)
# self.set_title(new_title)
def enable_button(self, buttonName):
if getattr(self, buttonName):
return getattr(self, buttonName).show()
def disable_button(self, buttonName):
if getattr(self, buttonName):
return getattr(self, buttonName).hide()
def set_cursor_at_end(self):
self.text.set_position(-1)
def set_cursor_at_position(self, position):
self.text.set_position()
def get_position(self):
return self.text.get_position()
class tweet(textLimited):
def createControls(self, title, message, text):
self.createTextArea(message, text)
self.box.add(self.textBox)
self.upload_image = Gtk.Button(_(u"Upload image..."))
self.spellcheck = Gtk.Button(_("Check spelling..."))
self.attach = Gtk.Button(_(u"Attach audio..."))
self.shortenButton = Gtk.Button(_(u"Shorten URL"))
self.unshortenButton = Gtk.Button(_(u"Expand URL"))
self.shortenButton.hide()
self.shortenButton.set_no_show_all(True)
self.unshortenButton.hide()
self.unshortenButton.set_no_show_all(True)
self.translateButton = Gtk.Button(_(u"Translate..."))
self.autocompletionButton = Gtk.Button(_(u"&Autocomplete users"))
self.buttonsBox1 = Gtk.Box(spacing=6)
self.buttonsBox1.add(self.upload_image)
self.buttonsBox1.add(self.spellcheck)
self.buttonsBox1.add(self.attach)
self.box.add(self.buttonsBox1)
self.buttonsBox2 = Gtk.Box(spacing=6)
self.buttonsBox2.add(self.shortenButton)
self.buttonsBox2.add(self.unshortenButton)
self.buttonsBox2.add(self.translateButton)
self.box.add(self.buttonsBox2)
def __init__(self, title, message, text):
super(tweet, self).__init__()
self.createControls(message, title, text)
self.show_all()
def get_image(self):
dialog = Gtk.FileChooserDialog(_(u"Select the picture to be uploaded"), self, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
filter_jpg = Gtk.FileFilter()
filter_jpg.set_name(_(u"JPG images"))
filter_jpg.add_mime_type("image/jpeg")
dialog.add_filter(filter_jpg)
filter_gif = Gtk.FileFilter()
filter_gif.set_name(_(u"GIF images"))
filter_gif.add_mime_type("image/gif")
dialog.add_filter(filter_gif)
filter_png = Gtk.FileFilter()
filter_png.set_name(_(u"PNG Images"))
filter_png.add_mime_type("image/png")
dialog.add_filter(filter_png)
answer = dialog.run()
if answer == widgetUtils.OK:
image = dialog.get_filename()
dialog.destroy()
return open(image, "rb")
else:
dialog.destroy()
return None
class dm(textLimited):
def createControls(self, title, message, users):
label = Gtk.Label(_(u"Recipient"))
self.cb = Gtk.ComboBoxText.new_with_entry()
self.cb.set_entry_text_column(0)
for user in users:
self.cb.append_text(user)
self.cb.get_child().set_placeholder_text(_(u"Recipient"))
self.cb.get_child().set_text(users[0])
self.autocompletionButton = Gtk.Button(_(u"&Autocomplete users"))
self.createTextArea(message, text="")
userBox = Gtk.Box(spacing=8)
userBox.add(label)
userBox.add(self.cb)
userBox.add(self.autocompletionButton)
self.box.add(userBox)
# self.mainBox.Add(self.cb, 0, wx.ALL, 5)
self.box.add(self.textBox)
self.spellcheck = Gtk.Button(_("Spelling correction"))
self.attach = Gtk.Button(_(u"Attach audio"))
self.shortenButton = Gtk.Button(_(u"Shorten URL"))
self.unshortenButton = Gtk.Button(_(u"Expand URL"))
self.shortenButton.hide()
self.shortenButton.set_no_show_all(True)
self.unshortenButton.hide()
self.unshortenButton.set_no_show_all(True)
self.translateButton = Gtk.Button(_(u"Translate message"))
self.buttonsBox = Gtk.Box(spacing=6)
self.buttonsBox.add(self.spellcheck)
self.buttonsBox.add(self.attach)
self.box.add(self.buttonsBox)
self.buttonsBox1 = Gtk.Box(spacing=6)
self.buttonsBox1.add(self.shortenButton)
self.buttonsBox1.add(self.unshortenButton)
self.buttonsBox1.add(self.translateButton)
self.box.add(self.buttonsBox1)
self.text.grab_focus()
def __init__(self, title, message, users):
super(dm, self).__init__()
self.createControls(message, title, users)
# self.onTimer(wx.EVT_CHAR_HOOK)
self.show_all()
def get_user(self):
return self.cb.get_text()
def set_user(self, user):
return self.cb.set_value()
class reply(tweet):
def __init__(self, title, message, text):
super(reply, self).__init__(message, title, text)
self.text.set_position(-1)
self.mentionAll = Gtk.Button(_(u"Men&tion to all"))
self.mentionAll.set_no_show_all(True)
self.mentionAll.hide()
self.buttonsBox1.add(self.mentionAll)
class viewTweet(widgetUtils.baseDialog):
def set_title(self, lenght):
pass
self.set_title(_(u"Tweet - %i characters ") % (lenght,))
def __init__(self, text, rt_count, favs_count):
super(viewTweet, self).__init__(buttons=(Gtk.STOCK_OK, widgetUtils.OK, Gtk.STOCK_CANCEL, widgetUtils.CANCEL))
label = Gtk.Label(_(u"Tweet"))
self.text = Gtk.TextView()
self.textBuffer = self.text.get_buffer()
self.textBuffer.set_text(text)
self.text.set_editable(False)
# self.textBuffer.set_placeholder_text(message)
textBox = Gtk.Box(spacing=6)
textBox.add(label)
textBox.add(self.text)
self.box.add(textBox)
rtCountLabel = Gtk.Label(_(u"Retweets: "))
rtCount = Gtk.Entry()
rtCount.set_text(rt_count)
rtCount.set_editable(False)
rtBox = Gtk.Box(spacing=2)
rtBox.add(rtCountLabel)
rtBox.add(rtCount)
favsCountLabel = Gtk.Label(_(u"Favourites: "))
favsCount = Gtk.Entry()
favsCount.set_text(favs_count)
favsCount.set_editable(False)
favsBox = Gtk.Box(spacing=2)
favsBox.add(favsCountLabel)
favsBox.add(favsCount)
infoBox = Gtk.Box(spacing=4)
infoBox.add(rtBox)
infoBox.add(favsBox)
self.box.add(infoBox)
self.spellcheck = Gtk.Button(_("Spelling correction"))
self.unshortenButton = Gtk.Button(_(u"Expand URL"))
self.unshortenButton.hide()
self.unshortenButton.set_no_show_all(True)
self.translateButton = Gtk.Button(_(u"Translate message"))
buttonsBox = Gtk.Box(spacing=6)
buttonsBox.add(self.spellcheck)
buttonsBox.add(self.unshortenButton)
buttonsBox.add(self.translateButton)
self.box.add(buttonsBox)
self.show_all()
def set_text(self, text):
self.textBuffer.set_text(text)
def get_text(self):
return self.textBuffer.get_text(self.textBuffer.get_start_iter(), self.textBuffer.get_end_iter(), False)
def text_focus(self):
self.text.grab_focus()
def enable_button(self, buttonName):
if getattr(self, buttonName):
return getattr(self, buttonName).show()
class viewNonTweet(widgetUtils.baseDialog):
def __init__(self, text):
super(viewNonTweet, self).__init__(buttons=(Gtk.STOCK_OK, widgetUtils.OK, Gtk.STOCK_CANCEL, widgetUtils.CANCEL))
self.set_title(_(u"View"))
label = Gtk.Label(_(u"Item"))
self.text = Gtk.TextView()
self.text.set_editable(False)
self.text.get_buffer().set_text(text)
textBox = Gtk.Box(spacing=5)
textBox.add(label)
textBox.add(self.text)
self.box.Add(textBox)
self.spellcheck = Gtk.Button(_("Spelling correction"))
self.unshortenButton = Gtk.Button(_(u"Expand URL"))
self.unshortenButton.hide()
self.unshortenButton.set_no_show_all(True)
self.translateButton = Gtk.Button(_(u"Translate message"))
buttonsBox = Gtk.Box(spacing=6)
buttonsBox.add(self.spellcheck)
buttonsBox.add(self.unshortenButton)
buttonsBox.add(self.translateButton)
self.box.Add(buttonsBox)
self.show_all()
def set_text(self, text):
self.text.get_buffer().set_text()
def get_text(self):
return self.text.get_buffer().get_text()
def text_focus(self):
self.text.grab_focus()
def enable_button(self, buttonName):
if getattr(self, buttonName):
return getattr(self, buttonName).show()

View File

@ -1,32 +0,0 @@
# -*- coding: utf-8 -*-
import baseDialog
import wx
class searchDialog(baseDialog.BaseWXDialog):
def __init__(self, value=""):
super(searchDialog, self).__init__(None, -1)
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetTitle(_(u"Search on Twitter"))
label = wx.StaticText(panel, -1, _(u"Search"))
self.term = wx.TextCtrl(panel, -1, value)
dc = wx.WindowDC(self.term)
dc.SetFont(self.term.GetFont())
self.term.SetSize(dc.GetTextExtent("0"*40))
sizer.Add(label, 0, wx.ALL, 5)
sizer.Add(self.term, 0, wx.ALL, 5)
self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
self.users = wx.RadioButton(panel, -1, _(u"Users"))
radioSizer = wx.BoxSizer(wx.HORIZONTAL)
radioSizer.Add(self.tweets, 0, wx.ALL, 5)
radioSizer.Add(self.users, 0, wx.ALL, 5)
sizer.Add(radioSizer, 0, wx.ALL, 5)
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
ok.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
btnsizer = wx.BoxSizer()
btnsizer.Add(ok, 0, wx.ALL, 5)
btnsizer.Add(cancel, 0, wx.ALL, 5)
sizer.Add(btnsizer, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
import wx
import baseDialog
class showUserProfile(baseDialog.BaseWXDialog):
def __init__(self):
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"))
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.Disable()
close = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
btnSizer.Add(self.url, 0, wx.ALL, 5)
btnSizer.Add(close, 0, wx.ALL, 5)
sizer.Add(btnSizer, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def enable_url(self, enabled=True):
self.url.Enable(enabled)

View File

@ -1,46 +0,0 @@
# -*- coding: utf-8 -*-
import baseDialog
import wx
class trendingTopicsDialog(baseDialog.BaseWXDialog):
def __init__(self):
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"))
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"))
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"))
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.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
btnsizer = wx.BoxSizer()
btnsizer.Add(ok, 0, wx.ALL, 5)
btnsizer.Add(cancel, 0, wx.ALL, 5)
sizer.Add(btnsizer, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def get_active(self):
if self.country.GetValue() == True:
return "country"
else:
return "city"
def get_item(self):
return self.location.GetStringSelection()
def set(self, values):
self.location.Set(values)

View File

@ -1,98 +0,0 @@
# -*- coding: utf-8 -*-
import wx
import baseDialog
class updateProfileDialog(baseDialog.BaseWXDialog):
def __init__(self):
super(updateProfileDialog, self).__init__(parent=None, id=-1)
self.SetTitle(_(u"Update your profile"))
panel = wx.Panel(self)
labelName = wx.StaticText(panel, -1, _(u"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"))
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"))
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)"))
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.ok.SetDefault()
close = wx.Button(panel, wx.ID_CANCEL, _("Close"))
sizer = wx.BoxSizer(wx.VERTICAL)
nameBox = wx.BoxSizer(wx.HORIZONTAL)
nameBox.Add(labelName, 0, wx.ALL, 5)
nameBox.Add(self.name, 0, wx.ALL, 5)
sizer.Add(nameBox, 0, wx.ALL, 5)
locationBox = wx.BoxSizer(wx.HORIZONTAL)
locationBox.Add(labelLocation, 0, wx.ALL, 5)
locationBox.Add(self.location, 0, wx.ALL, 5)
sizer.Add(locationBox, 0, wx.ALL, 5)
urlBox = wx.BoxSizer(wx.HORIZONTAL)
urlBox.Add(labelUrl, 0, wx.ALL, 5)
urlBox.Add(self.url, 0, wx.ALL, 5)
sizer.Add(urlBox, 0, wx.ALL, 5)
descriptionBox = wx.BoxSizer(wx.HORIZONTAL)
descriptionBox.Add(labelDescription, 0, wx.ALL, 5)
descriptionBox.Add(self.description, 0, wx.ALL, 5)
sizer.Add(descriptionBox, 0, wx.ALL, 5)
sizer.Add(self.upload_image, 5, wx.CENTER, 5)
btnBox = wx.BoxSizer(wx.HORIZONTAL)
btnBox.Add(self.ok, 0, wx.ALL, 5)
btnBox.Add(close, 0, wx.ALL, 5)
sizer.Add(btnBox, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def set_name(self, name):
self.set("name", name)
def set_description(self, description):
self.set("description", description)
def set_location(self, location):
self.set("location", location)
def set_url(self, url):
self.set("url", url)
def change_upload_button(self, uploaded=False):
if uploaded == False:
self.upload_image.SetLabel(_(u"Upload a picture"))
else:
self.upload_image.SetLabel(_(u"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)
if openFileDialog.ShowModal() == wx.ID_CANCEL:
return None
return openFileDialog.GetPath()
def hide_upload_button(self, hide):
self.upload_image.Enable(hide)
def set_readonly(self):
self.name.style = wx.TE_READONLY
self.name.Refresh()
self.description.style = wx.TE_READONLY
self.description.Refresh()
self.location.style = wx.TE_READONLY
self.location.Refresh()
self.url.style = wx.TE_READONLY
self.url.Refresh()
self.hide_upload_button(False)
self.ok.Enable(False)

View File

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
import wx
class urlList(wx.Dialog):
def __init__(self):
super(urlList, self).__init__(parent=None, title=_(u"Select an URL"))
panel = wx.Panel(self)
self.lista = wx.ListBox(panel, -1)
self.lista.SetFocus()
self.lista.SetSize(self.lista.GetBestSize())
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.lista, 0, wx.ALL, 5)
goBtn = wx.Button(panel, wx.ID_OK)
goBtn.SetDefault()
cancelBtn = wx.Button(panel, wx.ID_CANCEL)
btnSizer = wx.BoxSizer()
btnSizer.Add(goBtn, 0, wx.ALL, 5)
btnSizer.Add(cancelBtn, 0, wx.ALL, 5)
sizer.Add(btnSizer, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def populate_list(self, urls):
for i in urls:
self.lista.Append(i)
self.lista.SetSelection(0)
def get_string(self):
return self.lista.GetStringSelection()
def get_item(self):
return self.lista.GetSelection()
def get_response(self):
return self.ShowModal()

View File

@ -1,81 +0,0 @@
# -*- coding: utf-8 -*-
import wx
class UserActionsDialog(wx.Dialog):
def __init__(self, users=[], default="follow", *args, **kwargs):
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.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
self.cb.SetFocus()
userSizer.Add(userLabel, 0, wx.ALL, 5)
userSizer.Add(self.cb, 0, wx.ALL, 5)
actionSizer = wx.BoxSizer(wx.VERTICAL)
label2 = wx.StaticText(panel, -1, _(u"Action"))
self.follow = wx.RadioButton(panel, -1, _(u"Follow"), style=wx.RB_GROUP)
self.unfollow = wx.RadioButton(panel, -1, _(u"Unfollow"))
self.mute = wx.RadioButton(panel, -1, _(u"Mute"))
self.unmute = wx.RadioButton(panel, -1, _(u"Unmute"))
self.block = wx.RadioButton(panel, -1, _(u"Block"))
self.unblock = wx.RadioButton(panel, -1, _(u"Unblock"))
self.reportSpam = wx.RadioButton(panel, -1, _(u"Report as spam"))
self.ignore_client = wx.RadioButton(panel, -1, _(u"Ignore tweets from this client"))
self.setup_default(default)
hSizer = wx.BoxSizer(wx.HORIZONTAL)
hSizer.Add(label2, 0, wx.ALL, 5)
actionSizer.Add(self.follow, 0, wx.ALL, 5)
actionSizer.Add(self.unfollow, 0, wx.ALL, 5)
actionSizer.Add(self.mute, 0, wx.ALL, 5)
actionSizer.Add(self.unmute, 0, wx.ALL, 5)
actionSizer.Add(self.block, 0, wx.ALL, 5)
actionSizer.Add(self.unblock, 0, wx.ALL, 5)
actionSizer.Add(self.reportSpam, 0, wx.ALL, 5)
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.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
btnsizer = wx.BoxSizer()
btnsizer.Add(ok)
btnsizer.Add(cancel)
sizer.Add(userSizer)
sizer.Add(hSizer, 0, wx.ALL, 5)
sizer.Add(btnsizer)
panel.SetSizer(sizer)
def get_action(self):
if self.follow.GetValue() == True: return "follow"
elif self.unfollow.GetValue() == True: return "unfollow"
elif self.mute.GetValue() == True: return "mute"
elif self.unmute.GetValue() == True: return "unmute"
elif self.reportSpam.GetValue() == True: return "report"
elif self.block.GetValue() == True: return "block"
elif self.unblock.GetValue() == True: return "unblock"
elif self.ignore_client.GetValue() == True: return "ignore_client"
def setup_default(self, default):
if default == "follow":
self.follow.SetValue(True)
elif default == "unfollow":
self.unfollow.SetValue(True)
elif default == "mute":
self.mute.SetValue(True)
elif default == "unmute":
self.unmute.SetValue(True)
elif default == "report":
self.reportSpam.SetValue(True)
elif default == "block":
self.block.SetValue(True)
elif default == "unblock":
self.unblock.SetValue(True)
elif default == "ignore_client":
self.ignore_client.SetValue(True)
def get_response(self):
return self.ShowModal()
def get_user(self):
return self.cb.GetValue()

View File

@ -1,51 +0,0 @@
# -*- coding: utf-8 -*-
import wx
class selectUserDialog(wx.Dialog):
def __init__(self, users=[], default="tweets", *args, **kwargs):
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.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
self.cb.SetFocus()
userSizer.Add(userLabel, 0, wx.ALL, 5)
userSizer.Add(self.cb, 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"Favourites"))
self.setup_default(default)
hSizer = wx.BoxSizer(wx.HORIZONTAL)
hSizer.Add(label2, 0, wx.ALL, 5)
actionSizer.Add(self.tweets, 0, wx.ALL, 5)
actionSizer.Add(self.favourites, 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.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
btnsizer = wx.BoxSizer()
btnsizer.Add(ok)
btnsizer.Add(cancel)
sizer.Add(userSizer)
sizer.Add(hSizer, 0, wx.ALL, 5)
sizer.Add(btnsizer)
panel.SetSizer(sizer)
def get_action(self):
if self.tweets.GetValue() == True: return "tweets"
elif self.favourites.GetValue() == True: return "favourites"
def setup_default(self, default):
if default == "tweets":
self.tweets.SetValue(True)
elif default == "favourites":
self.favourites.SetValue(True)
def get_response(self):
return self.ShowModal()
def get_user(self):
return self.cb.GetValue()

View File

@ -1,46 +0,0 @@
# -*- coding: utf-8 -*-
############################################################
# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo <manuel@manuelcortez.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
import wx
import baseDialog
class selectUserDialog(baseDialog.BaseWXDialog):
def __init__(self, title, users):
super(selectUserDialog, self).__init__(parent=None, id=wx.NewId(), title=title)
panel = wx.Panel(self)
userSizer = wx.BoxSizer()
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0], size=wx.DefaultSize)
self.cb.SetFocus()
userSizer.Add(wx.StaticText(panel, -1, _(u"User")), 0, wx.ALL, 5)
userSizer.Add(self.cb)
sizer = wx.BoxSizer(wx.VERTICAL)
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
ok.SetDefault()
# ok.Bind(wx.EVT_BUTTON, self.onok)
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
btnsizer = wx.BoxSizer()
btnsizer.Add(ok, 0, wx.ALL, 5)
btnsizer.Add(cancel, 0, wx.ALL, 5)
sizer.Add(userSizer, 0, wx.ALL, 5)
sizer.Add(btnsizer, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def get_user(self):
return self.cb.GetValue()

View File

@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
""" A systray for TW Blue """
############################################################
# Copyright (c) 2014 José Manuel Delicado Alcolea <jmdaweb@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
import wx
import application
import paths
import os
class SysTrayIcon(wx.TaskBarIcon):
def __init__(self):
super(SysTrayIcon, self).__init__()
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.doc.Enable(False)
self.check_for_updates = self.menu.Append(wx.ID_ANY, _(u"Check for &updates"))
self.exit = self.menu.Append(wx.ID_ANY, _(u"&Exit"))
def show_menu(self):
self.PopupMenu(self.menu)
def Destroy(self):
self.menu.Destroy()
super(SysTrayIcon, self).Destroy()

View File

@ -1,206 +0,0 @@
# -*- coding: utf-8 -*-
import application
import widgetUtils
from gi.repository import Gtk, Gdk
class mainFrame(Gtk.Window):
""" Main class of the Frame. This is the Main Window."""
def append_to_menu(self, menu, *elements):
for i in elements:
menu.append(i)
### MENU
def makeMenus(self):
""" Creates, bind and returns the menu bar for the application. Also in this function, the accel table is created."""
menuBar = Gtk.MenuBar()
# Application menu
app = Gtk.Menu()
self.manage_accounts = Gtk.MenuItem(label=_(u"Manage accounts"))
self.updateProfile = Gtk.MenuItem(label="Update profile")
self.updateProfile.add_accelerator("activate", self.accel_group, ord("U"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
# As in Gtk is not possible to bind keyboard shorcuts to the system, we don't have support for an invisible interface.
self.show_hide = None
self.menuitem_search = Gtk.MenuItem(label="Search")
self.lists = Gtk.MenuItem(label="Lists manager")
self.keystrokes_editor = None
self.account_settings = Gtk.MenuItem(label="Account settings")
self.prefs = Gtk.MenuItem(label="Global settings")
self.close = Gtk.MenuItem(label="Close")
self.close.add_accelerator("activate", self.accel_group, ord("Q"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
self.append_to_menu(app, self.manage_accounts, self.updateProfile, self.menuitem_search, self.lists, self.account_settings, self.prefs, self.close)
app_menu = Gtk.MenuItem(label="Application")
app_menu.add_accelerator("activate", self.accel_group, ord("a"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
app_menu.set_submenu(app)
menuBar.append(app_menu)
# Tweet menu
tweet = Gtk.Menu()
self.compose = Gtk.MenuItem(label="Tweet")
self.compose.add_accelerator("activate", self.accel_group, ord("N"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
self.reply = Gtk.MenuItem(label="Reply")
self.reply.add_accelerator("activate", self.accel_group, ord("R"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
self.retweet = Gtk.MenuItem(label="Retweet")
self.retweet.add_accelerator("activate", self.accel_group, ord("T"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
self.fav = Gtk.MenuItem(label="Add to favourites")
self.fav.add_accelerator("activate", self.accel_group, ord("F"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
self.unfav = Gtk.MenuItem(label="Remove from favourites")
self.view = Gtk.MenuItem(label="Show tweet")
self.view_coordinates = Gtk.MenuItem(label="View address")
self.view_conversation = Gtk.MenuItem(label="View conversation")
self.delete = Gtk.MenuItem(label="Delete")
self.append_to_menu(tweet, self.compose, self.reply, self.retweet, self.fav, self.unfav, self.view, self.view_coordinates, self.view_conversation, self.delete)
tweet_menu = Gtk.MenuItem(label="Tweet")
tweet_menu.set_submenu(tweet)
menuBar.append(tweet_menu)
# User menu
user = Gtk.Menu()
self.follow = Gtk.MenuItem(label="Follow")
self.unfollow = Gtk.MenuItem(label="Unfollow")
self.mute = Gtk.MenuItem(label="Mute")
self.unmute = Gtk.MenuItem(label="Unmute")
self.report = Gtk.MenuItem(label="Report as spam")
self.block = Gtk.MenuItem(label="Block")
self.unblock = Gtk.MenuItem(label="Unblock")
self.timeline = Gtk.MenuItem(label="View timeline...")
self.dm = Gtk.MenuItem(label="Direct message")
self.addToList = Gtk.MenuItem(label="Add to list")
self.removeFromList = Gtk.MenuItem(label="Remove from list")
self.viewLists = Gtk.MenuItem(label="View lists")
self.details = Gtk.MenuItem(label="Show user profile")
self.favs = Gtk.MenuItem(label="View favourites")
self.append_to_menu(user, self.follow, self.unfollow, self.mute, self.unmute, self.report, self.block, self.unblock, self.timeline, self.dm, self.addToList, self.removeFromList, self.viewLists, self.details, self.favs)
user_menu = Gtk.MenuItem(label="User")
user_menu.set_submenu(user)
menuBar.append(user_menu)
# buffer menu
buffer = Gtk.Menu()
self.trends = Gtk.MenuItem(label="New trending topics buffer...")
self.trends.add_accelerator("activate", self.accel_group, ord("T"), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE)
self.load_previous_items = Gtk.MenuItem(label="Load previous items")
self.mute_buffer = Gtk.MenuItem(label="Mute")
self.autoread = Gtk.MenuItem(label="Autoread")
self.clear = Gtk.MenuItem(label="Clear buffer")
self.deleteTl = Gtk.MenuItem(label="Destroy")
self.append_to_menu(buffer, self.trends, self.load_previous_items, self.mute_buffer, self.autoread, self.clear, self.deleteTl)
buffer_menu = Gtk.MenuItem(label="Buffer")
buffer_menu.set_submenu(buffer)
menuBar.append(buffer_menu)
# Help Menu
help = Gtk.Menu()
self.doc = Gtk.MenuItem(label="Documentation")
self.sounds_tutorial = Gtk.MenuItem(label="Sounds tutorial")
self.changelog = Gtk.MenuItem(label="What's new in this version?")
self.check_for_updates = Gtk.MenuItem(label="Check for updates")
self.reportError = Gtk.MenuItem(label="Report an error")
self.visit_website = Gtk.MenuItem(label=application.name+"'s website")
self.about = Gtk.MenuItem(label="ABout "+application.name)
self.append_to_menu(help, self.doc, self.sounds_tutorial, self.changelog, self.check_for_updates, self.reportError, self.visit_website, self.about)
help_menu = Gtk.MenuItem(label="Help")
help_menu.set_submenu(help)
menuBar.append(help_menu)
self.box.pack_start(menuBar, False, False, 0)
### MAIN
def __init__(self):
""" Main function of this class."""
super(mainFrame, self).__init__(title=application.name)
self.accel_group = Gtk.AccelGroup()
self.add_accel_group(self.accel_group)
self.box = Gtk.VBox()
self.makeMenus()
self.nb = widgetUtils.notebook()
self.w = None
self.notebookBox = Gtk.Box(spacing=5)
self.notebookBox.add(self.nb.view)
self.box.add(self.notebookBox)
self.add(self.box)
select = self.nb.view.get_selection()
select.connect("changed", self.load)
def show(self):
self.show_all()
def get_buffer_count(self):
return self.nb.get_count()
def add_buffer(self, buffer, name):
buff = widgetUtils.buffer(buffer)
buff.name = name
self.nb.store.append(None, (buff,))
def insert_buffer(self, buffer, name, pos):
iter = self.nb.store.get_iter(pos)
buff = widgetUtils.buffer(buffer)
buff.name = name
self.nb.store.insert(iter, -1, (buff,))
def prepare(self):
pass
def search(self, name_, account):
(path, iter) = self.nb.search(self.nb.store, name_, account)
if path != None:
return path
def get_current_buffer(self):
return self.nb.get_current_page()
def get_current_buffer_pos(self):
return self.nb.get_current_page_path()
def get_buffer(self, pos):
return self.get_page(pos)
def load(self, selection):
model, treeiter = selection.get_selected()
if treeiter != None:
if self.w != None:
self.notebookBox.remove(self.w)
self.w = self.nb.store[treeiter][0].buffer
self.notebookBox.add(self.w)
self.show_all()
def change_buffer(self, position):
self.nb.ChangeSelection(position)
def get_buffer_text(self):
return self.nb.GetPageText(self.nb.GetSelection())
def get_buffer_by_id(self, id):
return self.nb.FindWindowById(id)
def advance_selection(self, forward):
self.nb.AdvanceSelection(forward)
def show_address(self, address):
wx.MessageDialog(self, address, _(u"Address"), wx.OK).ShowModal()
def delete_buffer(self, pos):
self.nb.DeletePage(pos)
def about_dialog(self):
info = wx.AboutDialogInfo()
info.SetName(application.name)
info.SetVersion(application.version)
info.SetDescription(application.description)
info.SetCopyright(application.copyright)
info.SetTranslators(application.translators)
# info.SetLicence(application.licence)
info.AddDeveloper(application.author)
wx.AboutBox(info)
def set_focus(self):
self.SetFocus()
def check_menuitem(self, menuitem, check=True):
if hasattr(self, menuitem):
getattr(self, menuitem).Check(check)
def no_update_available():
wx.MessageDialog(None, _(u"Your " + application.name + " version is up to date"), _(u"Update"), style=wx.OK).ShowModal()

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
@echo off @echo off
echo Generating application translation strings... echo Generating application translation strings...
C:\python27\python.exe pygettext.py -v -d twblue ../src/*.pyw ../src/*.py ../src/*/*.py ../src/*/*.pyw ../src/*/*/*.py ../src/*/*/*.pyw ../src/*/*/*/*.py ../src/*/*/*/*.pyw ../src/*/*/*/*/*.py ../src/*/*/*/*/*.pyw C:\python27\python.exe pygettext.py -d twblue ../src/*.pyw ../src/*.py ../src/*/*.py ../src/*/*.pyw ../src/*/*/*.py ../src/*/*/*.pyw ../src/*/*/*/*.py ../src/*/*/*/*.pyw ../src/*/*/*/*/*.py ../src/*/*/*/*/*.pyw
C:\python27\python.exe pygettext.py -v -d twblue-documentation ../doc/*.py C:\python27\python.exe pygettext.py -v -d twblue-documentation ../doc/*.py

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff