Move TWBlue to WX project phoenix (#207)

Move TWBlue to WX Python Phoenix
This commit is contained in:
Manuel Cortez 2018-03-19 01:55:09 -06:00 committed by GitHub
commit 199a06c6e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 55 additions and 51 deletions

View File

@ -31,7 +31,6 @@ Although most dependencies can be found in the windows-dependencies directory, w
* [Python,](http://python.org) version 2.7.14 * [Python,](http://python.org) version 2.7.14
If you want to build both x86 and x64 binaries, you can install python x86 to C:\python27 and python x64 to C:\python27x64, for example. If you want to build both x86 and x64 binaries, you can install python x86 to C:\python27 and python x64 to C:\python27x64, for example.
* [wxPython](http://www.wxpython.org) for Python 2.7, version 3.0.2.0
* [Python windows extensions (pywin32)](http://www.sourceforge.net/projects/pywin32/) for python 2.7, build 221 * [Python windows extensions (pywin32)](http://www.sourceforge.net/projects/pywin32/) for python 2.7, build 221
* [PyEnchant,](http://pythonhosted.org/pyenchant/) version 1.6.6. * [PyEnchant,](http://pythonhosted.org/pyenchant/) version 1.6.6.
x64 version has been built by TWBlue developers, so you only will find it in windows-dependencies folder x64 version has been built by TWBlue developers, so you only will find it in windows-dependencies folder
@ -57,6 +56,7 @@ setuptools installs a script, called easy_install. You can find it in the python
The -z switch unzips the package, instead of installing it compressed. If you add the --upgrade switch, you can upgrade a package to its latest version. The following packages need to be installed: The -z switch unzips the package, instead of installing it compressed. If you add the --upgrade switch, you can upgrade a package to its latest version. The following packages need to be installed:
* wxpython
* pypubsub==3.3.0 * pypubsub==3.3.0
* configobj * configobj
* requests-oauthlib * requests-oauthlib
@ -74,7 +74,7 @@ setuptools installs a script, called easy_install. You can find it in the python
easy_install will automatically get the additional libraries that these packages need to work properly. easy_install will automatically get the additional libraries that these packages need to work properly.
Run the following command to quickly install and upgrade all packages and their dependencies: Run the following command to quickly install and upgrade all packages and their dependencies:
easy_install -Z --upgrade six configobj markdown future requests oauthlib requests-oauthlib requests-toolbelt pypubsub==3.3.0 pygeocoder arrow python-dateutil futures winpaths PySocks win_inet_pton yandex.translate idna chardet urllib3 youtube-dl python-vlc easy_install -Z --upgrade wxpython six configobj markdown future requests oauthlib requests-oauthlib requests-toolbelt pypubsub==3.3.0 pygeocoder arrow python-dateutil futures winpaths PySocks win_inet_pton yandex.translate idna chardet urllib3 youtube-dl python-vlc
#### Other dependencies #### Other dependencies

View File

@ -610,7 +610,7 @@ class baseBufferController(bufferController):
# fix this: # fix this:
original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()]["created_at"], "ddd MMM D H:m:s Z YYYY", locale="en") original_date = arrow.get(self.session.db[self.name][self.buffer.list.get_selected()]["created_at"], "ddd MMM D H:m:s Z YYYY", locale="en")
ts = original_date.humanize(locale=languageHandler.getLanguage()) ts = original_date.humanize(locale=languageHandler.getLanguage())
self.buffer.list.list.SetStringItem(self.buffer.list.get_selected(), 2, ts) self.buffer.list.list.SetItem(self.buffer.list.get_selected(), 2, ts)
if self.session.settings['sound']['indicate_audio'] and utils.is_audio(tweet): if self.session.settings['sound']['indicate_audio'] and utils.is_audio(tweet):
self.session.sound.play("audio.ogg") self.session.sound.play("audio.ogg")
if self.session.settings['sound']['indicate_geo'] and utils.is_geocoded(tweet): if self.session.settings['sound']['indicate_geo'] and utils.is_geocoded(tweet):

View File

@ -29,8 +29,6 @@ class basicTweet(object):
self.message = getattr(message, messageType)(title, caption, text, *args, **kwargs) self.message = getattr(message, messageType)(title, caption, text, *args, **kwargs)
widgetUtils.connect_event(self.message.spellcheck, widgetUtils.BUTTON_PRESSED, self.spellcheck) widgetUtils.connect_event(self.message.spellcheck, widgetUtils.BUTTON_PRESSED, self.spellcheck)
widgetUtils.connect_event(self.message.attach, widgetUtils.BUTTON_PRESSED, self.attach) widgetUtils.connect_event(self.message.attach, widgetUtils.BUTTON_PRESSED, self.attach)
# if system == "Windows":
# if messageType != "dm":
widgetUtils.connect_event(self.message.text, widgetUtils.ENTERED_TEXT, self.text_processor) widgetUtils.connect_event(self.message.text, widgetUtils.ENTERED_TEXT, self.text_processor)
widgetUtils.connect_event(self.message.shortenButton, widgetUtils.BUTTON_PRESSED, self.shorten) widgetUtils.connect_event(self.message.shortenButton, widgetUtils.BUTTON_PRESSED, self.shorten)
widgetUtils.connect_event(self.message.unshortenButton, widgetUtils.BUTTON_PRESSED, self.unshorten) widgetUtils.connect_event(self.message.unshortenButton, widgetUtils.BUTTON_PRESSED, self.unshorten)
@ -201,6 +199,7 @@ class viewTweet(basicTweet):
param tweetList: If is_tweet is set to True, this could be a list of quoted tweets. param tweetList: If is_tweet is set to True, this could be a list of quoted tweets.
param is_tweet: True or false, depending wether the passed object is a tweet or not.""" param is_tweet: True or false, depending wether the passed object is a tweet or not."""
if is_tweet == True: if is_tweet == True:
self.title = _(u"Tweet")
image_description = [] image_description = []
text = "" text = ""
for i in xrange(0, len(tweetList)): for i in xrange(0, len(tweetList)):
@ -255,6 +254,7 @@ class viewTweet(basicTweet):
self.message.set_title(len(text)) self.message.set_title(len(text))
[self.message.set_image_description(i) for i in image_description] [self.message.set_image_description(i) for i in image_description]
else: else:
self.title = _(u"View item")
text = tweet text = tweet
self.message = message.viewNonTweet(text) self.message = message.viewNonTweet(text)
widgetUtils.connect_event(self.message.spellcheck, widgetUtils.BUTTON_PRESSED, self.spellcheck) widgetUtils.connect_event(self.message.spellcheck, widgetUtils.BUTTON_PRESSED, self.spellcheck)

View File

@ -37,9 +37,9 @@ class list(object):
if self.system == "Windows": if self.system == "Windows":
if reversed == False: items = self.list.GetItemCount() if reversed == False: items = self.list.GetItemCount()
else: items = 0 else: items = 0
self.list.InsertStringItem(items, item[0]) self.list.InsertItem(items, item[0])
for i in xrange(1, len(self.columns)): for i in range(1, len(self.columns)):
self.list.SetStringItem(items, i, item[i]) self.list.SetItem(items, i, item[i])
else: else:
self.list.Append(" ".join(item)) self.list.Append(" ".join(item))

View File

@ -1,4 +1,5 @@
import wx import wx
import wx.adv
import paths import paths
import languageHandler import languageHandler
import sys import sys
@ -52,8 +53,8 @@ NOTEBOOK_PAGE_CHANGED = wx.EVT_TREEBOOK_PAGE_CHANGED
RADIOBUTTON = wx.EVT_RADIOBUTTON RADIOBUTTON = wx.EVT_RADIOBUTTON
# Taskbar mouse clicks. # Taskbar mouse clicks.
TASKBAR_RIGHT_CLICK = wx.EVT_TASKBAR_RIGHT_DOWN TASKBAR_RIGHT_CLICK = wx.adv.EVT_TASKBAR_RIGHT_DOWN
TASKBAR_LEFT_CLICK = wx.EVT_TASKBAR_LEFT_DOWN TASKBAR_LEFT_CLICK = wx.adv.EVT_TASKBAR_LEFT_DOWN
def exit_application(): def exit_application():
""" Closes the current window cleanly. """ """ Closes the current window cleanly. """

View File

@ -305,7 +305,7 @@ class viewTweet(widgetUtils.BaseDialog):
self.text = wx.TextCtrl(panel, -1, text, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180)) self.text = wx.TextCtrl(panel, -1, text, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180))
dc = wx.WindowDC(self.text) dc = wx.WindowDC(self.text)
dc.SetFont(self.text.GetFont()) dc.SetFont(self.text.GetFont())
(x, y, z) = dc.GetMultiLineTextExtent("0"*140) (x, y) = dc.GetMultiLineTextExtent("0"*140)
self.text.SetSize((x, y)) self.text.SetSize((x, y))
self.text.SetFocus() self.text.SetFocus()
textBox = wx.BoxSizer(wx.HORIZONTAL) textBox = wx.BoxSizer(wx.HORIZONTAL)
@ -317,7 +317,7 @@ class viewTweet(widgetUtils.BaseDialog):
self.image_description = wx.TextCtrl(panel, -1, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180)) self.image_description = wx.TextCtrl(panel, -1, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180))
dc = wx.WindowDC(self.image_description) dc = wx.WindowDC(self.image_description)
dc.SetFont(self.image_description.GetFont()) dc.SetFont(self.image_description.GetFont())
(x, y, z) = dc.GetMultiLineTextExtent("0"*450) (x, y) = dc.GetMultiLineTextExtent("0"*450)
self.image_description.SetSize((x, y)) self.image_description.SetSize((x, y))
self.image_description.Enable(False) self.image_description.Enable(False)
iBox = wx.BoxSizer(wx.HORIZONTAL) iBox = wx.BoxSizer(wx.HORIZONTAL)
@ -398,7 +398,7 @@ class viewNonTweet(widgetUtils.BaseDialog):
self.text = wx.TextCtrl(parent=panel, id=-1, value=text, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180)) self.text = wx.TextCtrl(parent=panel, id=-1, value=text, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180))
dc = wx.WindowDC(self.text) dc = wx.WindowDC(self.text)
dc.SetFont(self.text.GetFont()) dc.SetFont(self.text.GetFont())
(x, y, z) = dc.GetMultiLineTextExtent("0"*140) (x, y) = dc.GetMultiLineTextExtent("0"*140)
self.text.SetSize((x, y)) self.text.SetSize((x, y))
self.text.SetFocus() self.text.SetFocus()
textBox = wx.BoxSizer(wx.HORIZONTAL) textBox = wx.BoxSizer(wx.HORIZONTAL)

View File

@ -5,93 +5,93 @@ class basePanelMenu(wx.Menu):
def __init__(self): def __init__(self):
super(basePanelMenu, self).__init__() super(basePanelMenu, self).__init__()
self.retweet = wx.MenuItem(self, wx.NewId(), _(u"&Retweet")) self.retweet = wx.MenuItem(self, wx.NewId(), _(u"&Retweet"))
self.AppendItem(self.retweet) self.Append(self.retweet)
self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply")) self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply"))
self.AppendItem(self.reply) self.Append(self.reply)
self.fav = wx.MenuItem(self, wx.NewId(), _(u"&Like")) self.fav = wx.MenuItem(self, wx.NewId(), _(u"&Like"))
self.AppendItem(self.fav) self.Append(self.fav)
self.unfav = wx.MenuItem(self, wx.NewId(), _(u"&Unlike")) self.unfav = wx.MenuItem(self, wx.NewId(), _(u"&Unlike"))
self.AppendItem(self.unfav) self.Append(self.unfav)
self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL")) self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
self.AppendItem(self.openUrl) self.Append(self.openUrl)
self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio")) self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio"))
self.AppendItem(self.play) self.Append(self.play)
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet")) self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet"))
self.AppendItem(self.view) self.Append(self.view)
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.AppendItem(self.copy) self.Append(self.copy)
self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete")) self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
self.AppendItem(self.remove) self.Append(self.remove)
self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions...")) self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions..."))
self.AppendItem(self.userActions) self.Append(self.userActions)
class dmPanelMenu(wx.Menu): class dmPanelMenu(wx.Menu):
def __init__(self): def __init__(self):
super(dmPanelMenu, self).__init__() super(dmPanelMenu, self).__init__()
self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply")) self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply"))
self.AppendItem(self.reply) self.Append(self.reply)
self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL")) self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
self.AppendItem(self.openUrl) self.Append(self.openUrl)
self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio")) self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio"))
self.AppendItem(self.play) self.Append(self.play)
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show direct message")) self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show direct message"))
self.AppendItem(self.view) self.Append(self.view)
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.AppendItem(self.copy) self.Append(self.copy)
self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete")) self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
self.AppendItem(self.remove) self.Append(self.remove)
self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions...")) self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions..."))
self.AppendItem(self.userActions) self.Append(self.userActions)
class sentPanelMenu(wx.Menu): class sentPanelMenu(wx.Menu):
def __init__(self): def __init__(self):
super(sentPanelMenu, self).__init__() super(sentPanelMenu, self).__init__()
self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL")) self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
self.AppendItem(self.openUrl) self.Append(self.openUrl)
self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio")) self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio"))
self.AppendItem(self.play) self.Append(self.play)
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet")) self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet"))
self.AppendItem(self.view) self.Append(self.view)
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.AppendItem(self.copy) self.Append(self.copy)
self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete")) self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
self.AppendItem(self.remove) self.Append(self.remove)
class eventsPanelMenu(wx.Menu): class eventsPanelMenu(wx.Menu):
def __init__(self): def __init__(self):
super(eventsPanelMenu, self).__init__() super(eventsPanelMenu, self).__init__()
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show event")) self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show event"))
self.AppendItem(self.view) self.Append(self.view)
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.AppendItem(self.copy) self.Append(self.copy)
self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete")) self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete"))
self.AppendItem(self.remove) self.Append(self.remove)
class peoplePanelMenu(wx.Menu): class peoplePanelMenu(wx.Menu):
def __init__(self): def __init__(self):
super(peoplePanelMenu, self).__init__() super(peoplePanelMenu, self).__init__()
self.reply = wx.MenuItem(self, wx.NewId(), _(u"Direct &message")) self.reply = wx.MenuItem(self, wx.NewId(), _(u"Direct &message"))
self.AppendItem(self.reply) self.Append(self.reply)
self.lists = wx.MenuItem(self, wx.NewId(), _(u"&View lists")) self.lists = wx.MenuItem(self, wx.NewId(), _(u"&View lists"))
self.AppendItem(self.lists) self.Append(self.lists)
self.lists.Enable(False) self.lists.Enable(False)
self.details = wx.MenuItem(self, wx.NewId(), _(u"Show user &profile")) self.details = wx.MenuItem(self, wx.NewId(), _(u"Show user &profile"))
self.AppendItem(self.details) self.Append(self.details)
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show user")) self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show user"))
self.AppendItem(self.view) self.Append(self.view)
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.AppendItem(self.copy) self.Append(self.copy)
self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions...")) self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions..."))
self.AppendItem(self.userActions) self.Append(self.userActions)
class trendsPanelMenu(wx.Menu): class trendsPanelMenu(wx.Menu):
def __init__(self): def __init__(self):
super(trendsPanelMenu, self).__init__() super(trendsPanelMenu, self).__init__()
self.search_topic = wx.MenuItem(self, wx.NewId(), _(u"Search topic")) self.search_topic = wx.MenuItem(self, wx.NewId(), _(u"Search topic"))
self.AppendItem(self.search_topic) self.Append(self.search_topic)
self.tweetThisTrend = wx.MenuItem(self, wx.NewId(), _(u"&Tweet about this trend")) self.tweetThisTrend = wx.MenuItem(self, wx.NewId(), _(u"&Tweet about this trend"))
self.AppendItem(self.tweetThisTrend) self.Append(self.tweetThisTrend)
self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show item")) self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show item"))
self.AppendItem(self.view) self.Append(self.view)
self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard"))
self.AppendItem(self.copy) self.Append(self.copy)

View File

@ -19,11 +19,12 @@
############################################################ ############################################################
import wx import wx
import wx.adv
import application import application
import paths import paths
import os import os
class SysTrayIcon(wx.TaskBarIcon): class SysTrayIcon(wx.adv.TaskBarIcon):
def __init__(self): def __init__(self):
super(SysTrayIcon, self).__init__() super(SysTrayIcon, self).__init__()

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import wx import wx
import wx.adv
import application import application
class mainFrame(wx.Frame): class mainFrame(wx.Frame):
@ -173,7 +174,7 @@ class mainFrame(wx.Frame):
self.nb.DeletePage(pos) self.nb.DeletePage(pos)
def about_dialog(self): def about_dialog(self):
info = wx.AboutDialogInfo() info = wx.adv.AboutDialogInfo()
info.SetName(application.name) info.SetName(application.name)
info.SetVersion(application.version) info.SetVersion(application.version)
info.SetDescription(application.description) info.SetDescription(application.description)
@ -182,7 +183,8 @@ class mainFrame(wx.Frame):
# info.SetLicence(application.licence) # info.SetLicence(application.licence)
for i in application.authors: for i in application.authors:
info.AddDeveloper(i) info.AddDeveloper(i)
wx.AboutBox(info) wx.adv.AboutBox(info)
def set_focus(self): def set_focus(self):
self.SetFocus() self.SetFocus()