mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-17 21:56:07 -04:00
The next generation branch has been added
This commit is contained in:
1
src/wxUI/__init__.py
Normal file
1
src/wxUI/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
10
src/wxUI/buffers/__init__.py
Normal file
10
src/wxUI/buffers/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- 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 tweet_searches import searchPanel
|
||||
from user_searches import searchUsersPanel
|
32
src/wxUI/buffers/base.py
Normal file
32
src/wxUI/buffers/base.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
from multiplatform_widgets import widgets
|
||||
|
||||
class basePanel(wx.Panel):
|
||||
|
||||
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.set_windows_size(0, 30)
|
||||
self.list.set_windows_size(1, 160)
|
||||
self.list.set_windows_size(2, 55)
|
||||
self.list.set_windows_size(3, 42)
|
||||
self.list.set_size()
|
||||
|
||||
def __init__(self, parent, name):
|
||||
super(basePanel, self).__init__(parent)
|
||||
self.name = name
|
||||
self.type = "baseBuffer"
|
||||
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.create_list()
|
||||
self.btn = wx.Button(self, -1, _(u"Tweet"))
|
||||
self.retweetBtn = wx.Button(self, -1, _(u"Retweet"))
|
||||
self.responseBtn = wx.Button(self, -1, _(u"Reply"))
|
||||
self.dmBtn = wx.Button(self, -1, _(u"Direct message"))
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnSizer.Add(self.btn, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.retweetBtn, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.responseBtn, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.dmBtn, 0, wx.ALL, 5)
|
||||
self.sizer.Add(btnSizer, 0, wx.ALL, 5)
|
||||
self.sizer.Add(self.list.list, 0, wx.ALL, 5)
|
||||
self.SetSizer(self.sizer)
|
11
src/wxUI/buffers/dm.py
Normal file
11
src/wxUI/buffers/dm.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
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.retweetBtn.Disable()
|
||||
self.responseBtn.Disable()
|
||||
self.type = "dm"
|
15
src/wxUI/buffers/events.py
Normal file
15
src/wxUI/buffers/events.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
from multiplatform_widgets import widgets
|
||||
|
||||
class eventsPanel(wx.Panel):
|
||||
""" Buffer to show events. Different than tweets or people."""
|
||||
|
||||
def __init__(self, parent, name):
|
||||
self.type = "event"
|
||||
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"))
|
8
src/wxUI/buffers/favourites.py
Normal file
8
src/wxUI/buffers/favourites.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
from base import basePanel
|
||||
|
||||
class favsPanel(basePanel):
|
||||
def __init__(self, parent, name):
|
||||
super(favsPanel, self).__init__(parent, name)
|
||||
self.type = "favourites_timeline"
|
9
src/wxUI/buffers/lists.py
Normal file
9
src/wxUI/buffers/lists.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
from base import basePanel
|
||||
|
||||
class listPanel(basePanel):
|
||||
def __init__(self, parent, name):
|
||||
super(listPanel, self).__init__(parent, name)
|
||||
self.type = "list"
|
||||
self.users = []
|
18
src/wxUI/buffers/panels.py
Normal file
18
src/wxUI/buffers/panels.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
from multiplatform_widgets import widgets
|
||||
|
||||
class accountPanel(wx.Panel):
|
||||
def __init__(self, parent, name=None):
|
||||
super(accountPanel, self).__init__(parent=parent)
|
||||
self.name = name
|
||||
self.type = "account"
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.list = widgets.list(self, _(u"Announce"))
|
||||
sizer.Add(self.list.list, 0, wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
class emptyPanel(accountPanel):
|
||||
def __init__(self, parent, name):
|
||||
super(emptyPanel, self).__init__(parent=parent, name=name)
|
||||
self.type = "empty"
|
16
src/wxUI/buffers/people.py
Normal file
16
src/wxUI/buffers/people.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
from multiplatform_widgets import widgets
|
||||
from base import basePanel
|
||||
|
||||
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))
|
||||
|
||||
def __init__(self, parent, name):
|
||||
super(peoplePanel, self).__init__(parent, name)
|
||||
self.type = "people"
|
||||
self.responseBtn.SetLabel(_(u"Mention"))
|
||||
self.retweetBtn.Disable()
|
8
src/wxUI/buffers/tweet_searches.py
Normal file
8
src/wxUI/buffers/tweet_searches.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
from base import basePanel
|
||||
|
||||
class searchPanel(basePanel):
|
||||
def __init__(self, parent, name):
|
||||
super(searchPanel, self).__init__(parent, name)
|
||||
self.type = "search"
|
14
src/wxUI/buffers/user_searches.py
Normal file
14
src/wxUI/buffers/user_searches.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
from tweet_searches import searchPanel
|
||||
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))
|
||||
|
||||
def __init__(self, parent, name):
|
||||
super(searchUsersPanel, self).__init__(parent, name)
|
||||
self.create_list()
|
||||
self.type = "user_searches"
|
1
src/wxUI/dialogs/__init__.py
Normal file
1
src/wxUI/dialogs/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
import baseDialog, configuration, follow, lists, message, search, show_user, update_profile, urlList
|
16
src/wxUI/dialogs/baseDialog.py
Normal file
16
src/wxUI/dialogs/baseDialog.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import wx
|
||||
|
||||
class BaseWXDialog(wx.Dialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(BaseWXDialog, self).__init__(*args, **kwargs)
|
||||
|
||||
def get_response(self):
|
||||
return self.ShowModal()
|
||||
|
||||
def get(self, control):
|
||||
if hasattr(self, control):
|
||||
control = getattr(self, control)
|
||||
if hasattr(control, "GetValue"): return getattr(control, "GetValue")()
|
||||
elif hasattr(control, "GetLabel"): return getattr(control, "GetLabel")()
|
||||
else: return -1
|
||||
else: return 0
|
182
src/wxUI/dialogs/configuration.py
Normal file
182
src/wxUI/dialogs/configuration.py
Normal file
@@ -0,0 +1,182 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import baseDialog
|
||||
import wx
|
||||
import logging as original_logger
|
||||
|
||||
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.relative_time = wx.CheckBox(self, -1, _(U"Relative times"))
|
||||
sizer.Add(self.relative_time, 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.show_gui = wx.CheckBox(self, -1, _(u"Activate the auto-start of the invisible interface"))
|
||||
sizer.Add(self.show_gui, 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, -1)
|
||||
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, -1)
|
||||
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, -1, _(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.followers = wx.CheckBox(self, -1, _(u"Show followers"))
|
||||
sizer.Add(self.followers, 0, wx.ALL, 5)
|
||||
self.friends = wx.CheckBox(self, -1, _(u"Show friends"))
|
||||
sizer.Add(self.friends, 0, wx.ALL, 5)
|
||||
self.favs = wx.CheckBox(self, -1, _(u"Show favourites"))
|
||||
sizer.Add(self.favs, 0, wx.ALL, 5)
|
||||
self.blocks = wx.CheckBox(self, -1, _(u"Show blocked users"))
|
||||
sizer.Add(self.blocks, 0, wx.ALL, 5)
|
||||
self.mutes = wx.CheckBox(self, -1, _(u"Show muted users"))
|
||||
sizer.Add(self.mutes, 0, wx.ALL, 5)
|
||||
self.events = wx.CheckBox(self, -1, _(u"Show events"))
|
||||
sizer.Add(self.events, 0, wx.ALL, 5)
|
||||
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)
|
||||
add = wx.Button(self, -1, _(u"Add client"))
|
||||
remove = wx.Button(self, -1, _(u"Remove client"))
|
||||
btnBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnBox.Add(add, 0, wx.ALL, 5)
|
||||
btnBox.Add(remove, 0, wx.ALL, 5)
|
||||
sizer.Add(clientsBox, 0, wx.ALL, 5)
|
||||
sizer.Add(btnBox, 0, wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
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.global_mute = wx.CheckBox(self, -1, _(u"Global mute"))
|
||||
sizer.Add(self.global_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)
|
||||
|
||||
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)
|
||||
|
||||
class configurationDialog(wx.Dialog):
|
||||
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_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):
|
||||
p = getattr(self, panel)
|
||||
getattr(self, p).SetValue(key)
|
||||
|
66
src/wxUI/dialogs/follow.py
Normal file
66
src/wxUI/dialogs/follow.py
Normal file
@@ -0,0 +1,66 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
|
||||
class actionDialog(wx.Dialog):
|
||||
def __init__(self, user=[], default="follow", *args, **kwargs):
|
||||
super(actionDialog, self).__init__(parent=None, *args, **kwargs)
|
||||
panel = wx.Panel(self)
|
||||
userSizer = wx.BoxSizer()
|
||||
self.SetTitle(_(u"Action"))
|
||||
self.cb = wx.ComboBox(panel, -1, choices=user, value=user[0])
|
||||
self.cb.SetFocus()
|
||||
userSizer.Add(self.cb)
|
||||
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.setup_default(default)
|
||||
actionSizer.Add(label2)
|
||||
actionSizer.Add(self.follow)
|
||||
actionSizer.Add(self.unfollow)
|
||||
actionSizer.Add(self.mute)
|
||||
actionSizer.Add(self.unmute)
|
||||
actionSizer.Add(self.block)
|
||||
actionSizer.Add(self.unblock)
|
||||
actionSizer.Add(self.reportSpam)
|
||||
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(actionSizer)
|
||||
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"
|
||||
|
||||
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)
|
123
src/wxUI/dialogs/lists.py
Normal file
123
src/wxUI/dialogs/lists.py
Normal file
@@ -0,0 +1,123 @@
|
||||
# -*- 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()
|
163
src/wxUI/dialogs/message.py
Normal file
163
src/wxUI/dialogs/message.py
Normal file
@@ -0,0 +1,163 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
import baseDialog
|
||||
|
||||
class textLimited(baseDialog.BaseWXDialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(textLimited, self).__init__(parent=None, *args, **kwargs)
|
||||
|
||||
def createTextArea(self, message="", text=""):
|
||||
self.panel = wx.Panel(self)
|
||||
self.label = wx.StaticText(self.panel, -1, message)
|
||||
self.SetTitle(str(len(text)))
|
||||
self.text = wx.TextCtrl(self.panel, -1, text)
|
||||
font = self.text.GetFont()
|
||||
dc = wx.WindowDC(self.text)
|
||||
dc.SetFont(font)
|
||||
x, y = dc.GetTextExtent("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
||||
self.text.SetSize((x, y))
|
||||
self.text.SetFocus()
|
||||
self.textBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.textBox.Add(self.label, 0, wx.ALL, 5)
|
||||
self.textBox.Add(self.text, 0, wx.ALL, 5)
|
||||
|
||||
def get_text(self):
|
||||
return self.text.GetValue()
|
||||
|
||||
def onSelect(self, ev):
|
||||
self.text.SelectAll()
|
||||
|
||||
class tweet(textLimited):
|
||||
def createControls(self, message, title, text):
|
||||
self.mainBox = wx.BoxSizer(wx.VERTICAL)
|
||||
self.createTextArea(message, text)
|
||||
self.mainBox.Add(self.textBox, 0, wx.ALL, 5)
|
||||
self.upload_image = wx.Button(self.panel, -1, _(u"Upload a picture"), size=wx.DefaultSize)
|
||||
self.spellcheck = wx.Button(self.panel, -1, _("Spelling correction"), size=wx.DefaultSize)
|
||||
self.attach = wx.Button(self.panel, -1, _(u"Attach audio"), size=wx.DefaultSize)
|
||||
self.shortenButton = wx.Button(self.panel, -1, _(u"Shorten URL"), size=wx.DefaultSize)
|
||||
self.unshortenButton = wx.Button(self.panel, -1, _(u"Expand URL"), size=wx.DefaultSize)
|
||||
self.shortenButton.Disable()
|
||||
self.unshortenButton.Disable()
|
||||
self.translateButton = wx.Button(self.panel, -1, _(u"Translate message"), size=wx.DefaultSize)
|
||||
self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Send"), size=wx.DefaultSize)
|
||||
self.okButton.SetDefault()
|
||||
cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"Close"), size=wx.DefaultSize)
|
||||
self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.buttonsBox1.Add(self.upload_image, 0, wx.ALL, 5)
|
||||
self.buttonsBox1.Add(self.spellcheck, 0, wx.ALL, 5)
|
||||
self.buttonsBox1.Add(self.attach, 0, wx.ALL, 5)
|
||||
self.mainBox.Add(self.buttonsBox1, 0, wx.ALL, 5)
|
||||
self.buttonsBox2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.buttonsBox2.Add(self.shortenButton, 0, wx.ALL, 5)
|
||||
self.buttonsBox2.Add(self.unshortenButton, 0, wx.ALL, 5)
|
||||
self.buttonsBox2.Add(self.translateButton, 0, wx.ALL, 5)
|
||||
self.mainBox.Add(self.buttonsBox2, 0, wx.ALL, 5)
|
||||
self.ok_cancelSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.ok_cancelSizer.Add(self.okButton, 0, wx.ALL, 5)
|
||||
self.ok_cancelSizer.Add(cancelButton, 0, wx.ALL, 5)
|
||||
self.mainBox.Add(self.ok_cancelSizer)
|
||||
selectId = wx.NewId()
|
||||
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
|
||||
self.accel_tbl = wx.AcceleratorTable([
|
||||
(wx.ACCEL_CTRL, ord('A'), selectId),
|
||||
])
|
||||
self.SetAcceleratorTable(self.accel_tbl)
|
||||
self.panel.SetSizer(self.mainBox)
|
||||
|
||||
def __init__(self, message, title, text):
|
||||
super(tweet, self).__init__()
|
||||
self.createControls(message, title, text)
|
||||
# self.onTimer(wx.EVT_CHAR_HOOK)
|
||||
self.SetClientSize(self.mainBox.CalcMin())
|
||||
|
||||
class dm(textLimited):
|
||||
def createControls(self, message, title, users):
|
||||
self.panel = wx.Panel(self)
|
||||
self.mainBox = wx.BoxSizer(wx.VERTICAL)
|
||||
label = wx.StaticText(self.panel, -1, _(u"Recipient"))
|
||||
self.cb = wx.ComboBox(self.panel, -1, choices=users, value=users[0], size=wx.DefaultSize)
|
||||
self.createTextArea(message, text="")
|
||||
self.mainBox.Add(self.cb, 0, wx.ALL, 5)
|
||||
self.mainBox.Add(self.textBox, 0, wx.ALL, 5)
|
||||
self.spellcheck = wx.Button(self.panel, -1, _("Spelling correction"), size=wx.DefaultSize)
|
||||
self.attach = wx.Button(self.panel, -1, _(u"Attach audio"), size=wx.DefaultSize)
|
||||
self.shortenButton = wx.Button(self.panel, -1, _(u"Shorten URL"), size=wx.DefaultSize)
|
||||
self.unshortenButton = wx.Button(self.panel, -1, _(u"Expand URL"), size=wx.DefaultSize)
|
||||
self.shortenButton.Disable()
|
||||
self.unshortenButton.Disable()
|
||||
self.translateButton = wx.Button(self.panel, -1, _(u"Translate message"), size=wx.DefaultSize)
|
||||
self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Send"), size=wx.DefaultSize)
|
||||
self.okButton.SetDefault()
|
||||
cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"Close"), size=wx.DefaultSize)
|
||||
self.buttonsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.buttonsBox.Add(self.spellcheck, 0, wx.ALL, 5)
|
||||
self.buttonsBox.Add(self.attach, 0, wx.ALL, 5)
|
||||
self.mainBox.Add(self.buttonsBox, 0, wx.ALL, 5)
|
||||
self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.buttonsBox1.Add(self.shortenButton, 0, wx.ALL, 5)
|
||||
self.buttonsBox1.Add(self.unshortenButton, 0, wx.ALL, 5)
|
||||
self.buttonsBox1.Add(self.translateButton, 0, wx.ALL, 5)
|
||||
self.mainBox.Add(self.buttonsBox1, 0, wx.ALL, 5)
|
||||
self.buttonsBox3 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.buttonsBox3.Add(self.okButton, 0, wx.ALL, 5)
|
||||
self.buttonsBox3.Add(cancelButton, 0, wx.ALL, 5)
|
||||
self.mainBox.Add(self.buttonsBox3, 0, wx.ALL, 5)
|
||||
self.panel.SetSizer(self.mainBox)
|
||||
|
||||
def __init__(self, message, title, users):
|
||||
super(dm, self).__init__()
|
||||
self.createControls(message, title, users)
|
||||
# self.onTimer(wx.EVT_CHAR_HOOK)
|
||||
self.SetClientSize(self.mainBox.CalcMin())
|
||||
|
||||
class reply(tweet):
|
||||
def __init__(self, message, title, text):
|
||||
super(reply, self).__init__(message, title, text)
|
||||
self.text.SetInsertionPoint(len(self.text.GetValue()))
|
||||
self.mentionAll = wx.Button(self, -1, _(u"Mention to all"), size=wx.DefaultSize)
|
||||
self.mentionAll.Disable()
|
||||
self.buttonsBox1.Add(self.mentionAll, 0, wx.ALL, 5)
|
||||
self.buttonsBox1.Layout()
|
||||
self.mainBox.Layout()
|
||||
self.SetClientSize(self.mainBox.CalcMin())
|
||||
|
||||
class viewTweet(wx.Dialog):
|
||||
def __init__(self, tweet):
|
||||
super(viewTweet, self).__init__(None, size=(850,850))
|
||||
self.SetTitle(_(u"Tweet - %i characters ") % (len(tweet)))
|
||||
panel = wx.Panel(self)
|
||||
label = wx.StaticText(panel, -1, _(u"Tweet"))
|
||||
self.text = wx.TextCtrl(panel, -1, tweet, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180))
|
||||
dc = wx.WindowDC(self.text)
|
||||
dc.SetFont(self.text.GetFont())
|
||||
(x, y, z) = dc.GetMultiLineTextExtent("0"*140)
|
||||
self.text.SetSize((x, y))
|
||||
self.text.SetFocus()
|
||||
textBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
textBox.Add(label, 0, wx.ALL, 5)
|
||||
textBox.Add(self.text, 1, wx.EXPAND, 5)
|
||||
mainBox = wx.BoxSizer(wx.VERTICAL)
|
||||
mainBox.Add(textBox, 0, wx.ALL, 5)
|
||||
spellcheck = wx.Button(panel, -1, _("Spelling correction"), size=wx.DefaultSize)
|
||||
self.unshortenButton = wx.Button(panel, -1, _(u"Expand URL"), size=wx.DefaultSize)
|
||||
self.unshortenButton.Disable()
|
||||
translateButton = wx.Button(panel, -1, _(u"Translate message"), size=wx.DefaultSize)
|
||||
cancelButton = wx.Button(panel, wx.ID_CANCEL, _(u"Close"), size=wx.DefaultSize)
|
||||
buttonsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
buttonsBox.Add(spellcheck, 0, wx.ALL, 5)
|
||||
buttonsBox.Add(self.unshortenButton, 0, wx.ALL, 5)
|
||||
buttonsBox.Add(translateButton, 0, wx.ALL, 5)
|
||||
buttonsBox.Add(cancelButton, 0, wx.ALL, 5)
|
||||
mainBox.Add(buttonsBox, 0, wx.ALL, 5)
|
||||
selectId = wx.NewId()
|
||||
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
|
||||
self.accel_tbl = wx.AcceleratorTable([
|
||||
(wx.ACCEL_CTRL, ord('A'), selectId),
|
||||
])
|
||||
self.SetAcceleratorTable(self.accel_tbl)
|
||||
panel.SetSizer(mainBox)
|
||||
self.SetClientSize(mainBox.CalcMin())
|
||||
|
||||
def onSelect(self, ev):
|
||||
self.text.SelectAll()
|
32
src/wxUI/dialogs/search.py
Normal file
32
src/wxUI/dialogs/search.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import baseDialog
|
||||
import wx
|
||||
|
||||
class searchDialog(baseDialog.BaseWXDialog):
|
||||
def __init__(self):
|
||||
super(searchDialog, self).__init__(None, -1)
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.SetTitle(_(u"Search on Twitter"))
|
||||
label = wx.StaticText(panel, -1, _(u"Search"))
|
||||
self.term = wx.TextCtrl(panel, -1,)
|
||||
dc = wx.WindowDC(self.term)
|
||||
dc.SetFont(self.term.GetFont())
|
||||
self.term.SetSize(dc.GetTextExtent("0"*40))
|
||||
sizer.Add(label, 0, wx.ALL, 5)
|
||||
sizer.Add(self.term, 0, wx.ALL, 5)
|
||||
self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
|
||||
self.users = wx.RadioButton(panel, -1, _(u"Users"))
|
||||
radioSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
radioSizer.Add(self.tweets, 0, wx.ALL, 5)
|
||||
radioSizer.Add(self.users, 0, wx.ALL, 5)
|
||||
sizer.Add(radioSizer, 0, wx.ALL, 5)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
|
||||
btnsizer = wx.BoxSizer()
|
||||
btnsizer.Add(ok, 0, wx.ALL, 5)
|
||||
btnsizer.Add(cancel, 0, wx.ALL, 5)
|
||||
sizer.Add(btnsizer, 0, wx.ALL, 5)
|
||||
panel.SetSizer(sizer)
|
||||
self.SetClientSize(sizer.CalcMin())
|
28
src/wxUI/dialogs/show_user.py
Normal file
28
src/wxUI/dialogs/show_user.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
|
||||
class showUserProfile(wx.Dialog):
|
||||
def __init__(self, screen_name):
|
||||
super(showUserProfile, self).__init__(self, None, -1)
|
||||
self.SetTitle(_(u"Information for %s") % (screen_name))
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
static = wx.StaticText(panel, -1, _(u"Details"))
|
||||
sizer.Add(static, 0, wx.ALL, 5)
|
||||
text = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE|wx.TE_READONLY)
|
||||
text.SetFocus()
|
||||
sizer.Add(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)
|
||||
text.ChangeValue(self.compose_string())
|
||||
text.SetSize(text.GetBestSize())
|
||||
panel.SetSizer(sizer)
|
||||
self.SetClientSize(sizer.CalcMin())
|
||||
|
||||
def get_response(self):
|
||||
return self.ShowModal()
|
75
src/wxUI/dialogs/update_profile.py
Normal file
75
src/wxUI/dialogs/update_profile.py
Normal file
@@ -0,0 +1,75 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
|
||||
class updateProfile(wx.Dialog):
|
||||
def __init__(self, parent):
|
||||
super(updateProfile, 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.upload_image.Bind(wx.EVT_BUTTON, self.onUpload_picture)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"Update profile"))
|
||||
ok.Bind(wx.EVT_BUTTON, self.onUpdateProfile)
|
||||
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(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 onUpload_picture(self, ev):
|
||||
if self.upload_image.GetLabel() == _(u"Discard image"):
|
||||
self.upload_image.SetLabel(_(u"Upload a picture"))
|
||||
self.controller.clear_file()
|
||||
else:
|
||||
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
|
||||
self.controller.get_file(openFileDialog.GetPath())
|
||||
self.upload_image.SetLabel(_(u"Discard image"))
|
||||
ev.Skip()
|
||||
|
||||
def get_response(self):
|
||||
return self.ShowModal()
|
35
src/wxUI/dialogs/urlList.py
Normal file
35
src/wxUI/dialogs/urlList.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# -*- 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()
|
29
src/wxUI/dialogs/utils.py
Normal file
29
src/wxUI/dialogs/utils.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
|
||||
class selectUserDialog(wx.Dialog):
|
||||
def __init__(self, users, *args, **kwargs):
|
||||
super(selectUserDialog, self).__init__(self, None, -1, *args, **kwargs)
|
||||
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()
|
||||
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_selection(self):
|
||||
return self.cb.GetValue()
|
||||
|
||||
def get_response(self):
|
||||
return self.ShowModal()
|
62
src/wxUI/sysTrayIcon.py
Normal file
62
src/wxUI/sysTrayIcon.py
Normal file
@@ -0,0 +1,62 @@
|
||||
# -*- 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, frame):
|
||||
super(SysTrayIcon, self).__init__()
|
||||
self.frame=frame
|
||||
icon=wx.Icon(os.path.join(paths.app_path(), "icon.ico"), wx.BITMAP_TYPE_ICO)
|
||||
self.SetIcon(icon, application.name)
|
||||
self.menu=wx.Menu()
|
||||
item=self.menu.Append(wx.ID_ANY, _(u"Tweet"))
|
||||
self.Bind(wx.EVT_MENU, frame.compose, item)
|
||||
item=self.menu.Append(wx.ID_ANY, _(u"Preferences"))
|
||||
self.Bind(wx.EVT_MENU, frame.preferences, item)
|
||||
item=self.menu.Append(wx.ID_ANY, _(u"Update profile"))
|
||||
self.Bind(wx.EVT_MENU, frame.update_profile, item)
|
||||
item=self.menu.Append(wx.ID_ANY, _(u"Show / hide"))
|
||||
self.Bind(wx.EVT_MENU, frame.show_hide, item)
|
||||
item=self.menu.Append(wx.ID_ANY, _(u"Documentation"))
|
||||
self.Bind(wx.EVT_MENU, frame.onManual, item)
|
||||
item=self.menu.Append(wx.ID_ANY, _(u"Check for updates"))
|
||||
self.Bind(wx.EVT_MENU, frame.onCheckForUpdates, item)
|
||||
item=self.menu.Append(wx.ID_ANY, _(u"Exit"))
|
||||
self.Bind(wx.EVT_MENU, frame.close, item)
|
||||
self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self.onRightClick)
|
||||
self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.onLeftClick)
|
||||
|
||||
def onRightClick(self, evt):
|
||||
self.PopupMenu(self.menu)
|
||||
|
||||
def onLeftClick(self, evt):
|
||||
if (self.frame.showing):
|
||||
self.frame.SetFocus()
|
||||
else:
|
||||
self.frame.onShow_hide()
|
||||
|
||||
def Destroy(self):
|
||||
self.menu.Destroy()
|
||||
super(SysTrayIcon, self).Destroy()
|
175
src/wxUI/view.py
Normal file
175
src/wxUI/view.py
Normal file
@@ -0,0 +1,175 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import wx
|
||||
|
||||
class mainFrame(wx.Frame):
|
||||
""" Main class of the Frame. This is the Main Window."""
|
||||
|
||||
### MENU
|
||||
def makeMenus(self):
|
||||
""" Creates, bind and returns the menu bar for the application. Also in this function, the accel table is created."""
|
||||
menuBar = wx.MenuBar()
|
||||
|
||||
# Application menu
|
||||
app = wx.Menu()
|
||||
updateProfile = app.Append(wx.NewId(), _(u"&Update profile"))
|
||||
# self.Bind(wx.EVT_MENU, self.controller.update_profile, updateProfile)
|
||||
show_hide = app.Append(wx.NewId(), _(u"&Hide window"))
|
||||
# self.Bind(wx.EVT_MENU, self.controller.show_hide, show_hide)
|
||||
search = app.Append(wx.NewId(), _(u"&Search"))
|
||||
self.Bind(wx.EVT_MENU, self.controller.search, search)
|
||||
lists = app.Append(wx.NewId(), _(u"&Lists manager"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.list_manager, lists)
|
||||
sounds_tutorial = app.Append(wx.NewId(), _(u"Sounds &tutorial"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.learn_sounds, sounds_tutorial)
|
||||
keystroke_editor = app.Append(wx.NewId(), _(u"&Edit keystrokes"))
|
||||
self.Bind(wx.EVT_MENU, self.controller.edit_keystrokes, keystroke_editor)
|
||||
prefs = app.Append(wx.ID_PREFERENCES, _(u"&Preferences"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.preferences, prefs)
|
||||
close = app.Append(wx.ID_EXIT, _(u"E&xit"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.close, close)
|
||||
|
||||
# Tweet menu
|
||||
tweet = wx.Menu()
|
||||
compose = tweet.Append(wx.NewId(), _(u"&Tweet"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.compose, compose)
|
||||
response = tweet.Append(wx.NewId(), _(u"Re&ply"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.reply, response)
|
||||
retweet = tweet.Append(wx.NewId(), _(u"&Retweet"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.retweet, retweet)
|
||||
fav = tweet.Append(wx.NewId(), _(u"Add to &favourites"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.fav, fav)
|
||||
unfav = tweet.Append(wx.NewId(), _(u"Remove from favo&urites"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.unfav, unfav)
|
||||
view = tweet.Append(wx.NewId(), _(u"&Show tweet"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.view, view)
|
||||
delete = tweet.Append(wx.NewId(), _(u"&Delete"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.delete, delete)
|
||||
|
||||
# User menu
|
||||
user = wx.Menu()
|
||||
follow = user.Append(wx.NewId(), _(u"&Follow"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onFollow, follow)
|
||||
unfollow = user.Append(wx.NewId(), _(u"&Unfollow"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onUnfollow, unfollow)
|
||||
mute = user.Append(wx.NewId(), _(u"&Mute"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onMute, mute)
|
||||
unmute = user.Append(wx.NewId(), _(u"U&nmute"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onUnmute, unmute)
|
||||
report = user.Append(wx.NewId(), _(u"&Report as spam"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onReport, report)
|
||||
block = user.Append(wx.NewId(), _(u"&Block"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onBlock, block)
|
||||
unblock = user.Append(wx.NewId(), _(u"Unb&lock"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onUnblock, unblock)
|
||||
dm = user.Append(wx.NewId(), _(u"Direct me&ssage"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.dm, dm)
|
||||
addToList = user.Append(wx.NewId(), _(u"&Add to list"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.add_to_list, addToList)
|
||||
removeFromList = user.Append(wx.NewId(), _(u"R&emove from list"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.remove_from_list, removeFromList)
|
||||
viewLists = user.Append(wx.NewId(), _(u"&View lists"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.view_user_lists, viewLists)
|
||||
details = user.Append(wx.NewId(), _(u"Show user &profile"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.details, details)
|
||||
timeline = user.Append(wx.NewId(), _(u"&Timeline"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.open_timeline, timeline)
|
||||
favs = user.Append(wx.NewId(), _(u"V&iew favourites"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.favs_timeline, favs)
|
||||
|
||||
# buffer menu
|
||||
buffer = wx.Menu()
|
||||
mute = buffer.Append(wx.NewId(), _(u"&Mute"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.toggle_mute, mute)
|
||||
autoread = buffer.Append(wx.NewId(), _(u"&Autoread tweets for this buffer"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.toggle_autoread, autoread)
|
||||
clear = buffer.Append(wx.NewId(), _(u"&Clear buffer"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.clear_list, clear)
|
||||
deleteTl = buffer.Append(wx.NewId(), _(u"&Remove buffer"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.delete_buffer, deleteTl)
|
||||
|
||||
# Help Menu
|
||||
help = wx.Menu()
|
||||
doc = help.Append(-1, _(u"&Documentation"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onManual, doc)
|
||||
changelog = help.Append(wx.NewId(), _(u"&What's new in this version?"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onChangelog, changelog)
|
||||
check_for_updates = help.Append(wx.NewId(), _(u"&Check for updates"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onCheckForUpdates, check_for_updates)
|
||||
reportError = help.Append(wx.NewId(), _(u"&Report an error"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onReportBug, reportError)
|
||||
visit_website = help.Append(-1, _(u"TW Blue &website"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onVisit_website, visit_website)
|
||||
about = help.Append(-1, _(u"About &TW Blue"))
|
||||
# self.view.Bind(wx.EVT_MENU, self.onAbout, about)
|
||||
|
||||
# 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(help, _(u"&Help"))
|
||||
|
||||
self.accel_tbl = wx.AcceleratorTable([
|
||||
(wx.ACCEL_CTRL, ord('N'), compose.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('R'), response.GetId()),
|
||||
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('R'), retweet.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('F'), fav.GetId()),
|
||||
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('F'), unfav.GetId()),
|
||||
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('V'), view.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('D'), dm.GetId()),
|
||||
|
||||
(wx.ACCEL_CTRL, ord('Q'), close.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('S'), follow.GetId()),
|
||||
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('S'), unfollow.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('K'), block.GetId()),
|
||||
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('K'), report.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('I'), timeline.GetId()),
|
||||
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('I'), deleteTl.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('M'), show_hide.GetId()),
|
||||
(wx.ACCEL_CTRL, ord('P'), updateProfile.GetId()),
|
||||
])
|
||||
|
||||
self.SetAcceleratorTable(self.accel_tbl)
|
||||
return menuBar
|
||||
|
||||
### MAIN
|
||||
def __init__(self, controller):
|
||||
""" Main function of this class."""
|
||||
super(mainFrame, self).__init__(None, -1, "TW Blue", size=(1600, 1600))
|
||||
self.controller = controller
|
||||
self.panel = wx.Panel(self)
|
||||
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.SetTitle("TW Blue")
|
||||
self.SetMenuBar(self.makeMenus())
|
||||
self.nb = wx.Treebook(self.panel, wx.NewId())
|
||||
self.buffers = {}
|
||||
self.SetMenuBar(self.makeMenus())
|
||||
|
||||
def add_buffer(self, buffer, name):
|
||||
self.nb.AddPage(buffer, name)
|
||||
self.buffers[name] = buffer.GetId()
|
||||
|
||||
def insert_buffer(self, buffer, name, pos):
|
||||
self.nb.InsertSubPage(pos, buffer, name)
|
||||
self.buffers[name] = buffer.GetId()
|
||||
|
||||
def prepare(self):
|
||||
self.sizer.Add(self.nb, 0, wx.ALL, 5)
|
||||
self.panel.SetSizer(self.sizer)
|
||||
self.SetClientSize(self.sizer.CalcMin())
|
||||
|
||||
def search(self, name_, account):
|
||||
for i in range(0, self.nb.GetPageCount()):
|
||||
if self.nb.GetPage(i).name == name_ and self.nb.GetPage(i).account == account: return i
|
||||
|
||||
def get_current_buffer(self):
|
||||
return self.nb.GetCurrentPage()
|
||||
|
||||
def get_buffer(self, pos):
|
||||
return self.GetPage(pos)
|
||||
|
||||
def get_buffer_by_id(self, id):
|
||||
return self.nb.FindWindowById(id)
|
||||
|
||||
def show(self):
|
||||
self.Show()
|
Reference in New Issue
Block a user