From 7f673fb9de974ef68a86da1d8c374bad6959fc3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 26 Nov 2014 05:43:13 -0600 Subject: [PATCH 1/7] Show more information about tweets on the ViewTweets dialog --- src/gui/buffers/dm.py | 1 + src/gui/buffers/people.py | 6 ++ src/gui/buffers/user_searches.py | 2 +- src/gui/dialogs/message.py | 102 ++++++++++++++++++++++++++++++- src/gui/main.py | 14 ++++- src/main.py | 49 +++++---------- 6 files changed, 134 insertions(+), 40 deletions(-) diff --git a/src/gui/buffers/dm.py b/src/gui/buffers/dm.py index 468d2f5a..32d277da 100644 --- a/src/gui/buffers/dm.py +++ b/src/gui/buffers/dm.py @@ -30,6 +30,7 @@ class dmPanel(basePanel): super(dmPanel, self).__init__(parent, window, name_buffer, function, argumento=argumento, sound=sound) self.retweetBtn.Disable() self.responseBtn.Disable() + self.type = "direct_message" def destroy_status(self, ev): index = self.list.get_selected() diff --git a/src/gui/buffers/people.py b/src/gui/buffers/people.py index f15e75c1..86367c72 100644 --- a/src/gui/buffers/people.py +++ b/src/gui/buffers/people.py @@ -140,3 +140,9 @@ class peoplePanel(basePanel): def remove_buffer(self): pos = None return pos + + def get_message(self, dialog=False): + if dialog == False: return " ".join(self.compose_function(self.db.settings[self.name_buffer][self.list.get_selected()], self.db)) + else: + list = self.compose_function(self.db.settings[self.name_buffer][self.list.get_selected()], self.db) + return " ".join(list) diff --git a/src/gui/buffers/user_searches.py b/src/gui/buffers/user_searches.py index 83748936..776bd5f4 100644 --- a/src/gui/buffers/user_searches.py +++ b/src/gui/buffers/user_searches.py @@ -40,7 +40,7 @@ class searchUsersPanel(peoplePanel): self.create_list() self.args = args self.kwargs = kwargs - self.type = "timeline" + self.type = "user_search" def start_streams(self): num = twitter.starting.search_users(self.db, self.twitter, self.name_buffer, **self.kwargs) diff --git a/src/gui/dialogs/message.py b/src/gui/dialogs/message.py index b0250166..3a2ae1f5 100644 --- a/src/gui/dialogs/message.py +++ b/src/gui/dialogs/message.py @@ -342,10 +342,10 @@ class reply(tweet): class viewTweet(wx.Dialog): def __init__(self, tweet): super(viewTweet, self).__init__(None, size=(850,850)) - self.SetTitle(_(u"Tweet - %i characters ") % (len(tweet))) + self.SetTitle(_(u"Tweet - %i characters ") % (len(tweet["text"]))) 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)) + self.text = wx.TextCtrl(panel, -1, tweet["text"], 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) @@ -356,6 +356,20 @@ class viewTweet(wx.Dialog): textBox.Add(self.text, 1, wx.EXPAND, 5) mainBox = wx.BoxSizer(wx.VERTICAL) mainBox.Add(textBox, 0, wx.ALL, 5) + rtCountLabel = wx.StaticText(panel, -1, _(u"Retweets: ")) + rtCount = wx.TextCtrl(panel, -1, str(tweet["retweet_count"]), size=wx.DefaultSize, style=wx.TE_READONLY|wx.TE_MULTILINE) + rtBox = wx.BoxSizer(wx.HORIZONTAL) + rtBox.Add(rtCountLabel, 0, wx.ALL, 5) + rtBox.Add(rtCount, 0, wx.ALL, 5) + favsCountLabel = wx.StaticText(panel, -1, _(u"Favourites: ")) + favsCount = wx.TextCtrl(panel, -1, str(tweet["favorite_count"]), size=wx.DefaultSize, style=wx.TE_READONLY|wx.TE_MULTILINE) + favsBox = wx.BoxSizer(wx.HORIZONTAL) + favsBox.Add(favsCountLabel, 0, wx.ALL, 5) + favsBox.Add(favsCount, 0, wx.ALL, 5) + infoBox = wx.BoxSizer(wx.HORIZONTAL) + infoBox.Add(rtBox, 0, wx.ALL, 5) + infoBox.Add(favsBox, 0, wx.ALL, 5) + mainBox.Add(infoBox, 0, wx.ALL, 5) if platform.system() != "Darwin": spellcheck = wx.Button(panel, -1, _("Spelling correction"), size=wx.DefaultSize) spellcheck.Bind(wx.EVT_BUTTON, self.onCheck) @@ -427,3 +441,87 @@ class viewTweet(wx.Dialog): urlList.unshorten(urls, self).ShowModal() self.text.SetFocus() +class viewNonTweet(wx.Dialog): + def __init__(self, tweet): + super(viewNonTweet, self).__init__(None, size=(850,850)) + self.SetTitle(_(u"View")) + panel = wx.Panel(self) + label = wx.StaticText(panel, -1, _(u"Item")) + self.text = wx.TextCtrl(parent=panel, id=-1, value=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) + spellcheck.Bind(wx.EVT_BUTTON, self.onCheck) + self.unshortenButton = wx.Button(panel, -1, _(u"Expand URL"), size=wx.DefaultSize) + self.unshortenButton.Bind(wx.EVT_BUTTON, self.onUnshorten) + self.unshortenButton.Disable() + translateButton = wx.Button(panel, -1, _(u"Translate message"), size=wx.DefaultSize) + translateButton.Bind(wx.EVT_BUTTON, self.onTranslate) + cancelButton = wx.Button(panel, wx.ID_CANCEL, _(u"Close"), size=wx.DefaultSize) + cancelButton.SetDefault() + 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()) + self.check_urls() + + def check_urls(self): + if len(twitter.utils.find_urls_in_text(self.text.GetValue())) > 0: + self.unshortenButton.Enable() + + def onCheck(self, ev): + text = self.text.GetValue() + dlg = spellCheckerGUI.spellCheckerDialog(text, "") + if dlg.ShowModal() == wx.ID_OK: + self.text.ChangeValue(dlg.checker.get_text()) + dlg.Destroy() + + def onTranslate(self, ev): + dlg = translator.gui.translateDialog() + selection = dlg.ShowModal() + if selection != wx.ID_CANCEL: + text_to_translate = self.text.GetValue().encode("utf-8") + source = [x[0] for x in translator.available_languages()][dlg.source_lang.GetSelection()] + dest = [x[0] for x in translator.available_languages()][dlg.dest_lang.GetSelection()] + t = translator.translator.Translator() + t.from_lang = source + t.to_lang = dest + msg = t.translate(text_to_translate) + self.text.ChangeValue(msg) + output.speak(_(u"Translated")) + self.text.SetFocus() + else: + return + dlg.Destroy() + + def onSelect(self, ev): + self.text.SelectAll() + + def onUnshorten(self, ev): + urls = twitter.utils.find_urls_in_text(self.text.GetValue()) + if len(urls) == 0: + output.speak(_(u"There's no URL to be expanded")) + elif len(urls) == 1: + self.text.SetValue(self.text.GetValue().replace(urls[0], url_shortener.unshorten(urls[0]))) + output.speak(_(u"URL expanded")) + elif len(urls) > 1: + urlList.unshorten(urls, self).ShowModal() + self.text.SetFocus() diff --git a/src/gui/main.py b/src/gui/main.py index f71830d9..9df152dc 100644 --- a/src/gui/main.py +++ b/src/gui/main.py @@ -662,8 +662,18 @@ class mainFrame(wx.Frame): self.nb.GetCurrentPage().onRetweet(ev) def view(self, ev=None): - tweet = self.nb.GetCurrentPage().get_message(dialog=True) - dialogs.message.viewTweet(tweet).ShowModal() + tp = self.nb.GetCurrentPage().type + if tp == "buffer" or tp == "timeline" or tp == "favourites_timeline" or tp == "list" or tp == "search": + try: + id = self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["id"] + tweet = self.twitter.twitter.show_status(id=id) + dialogs.message.viewTweet(tweet).ShowModal() + except TwythonError as e: + non_tweet = self.nb.GetCurrentPage().get_message(dialog=True) + dialogs.message.viewNonTweet(non_tweet).ShowModal() + else: + non_tweet = self.nb.GetCurrentPage().get_message(dialog=True) + dialogs.message.viewNonTweet(non_tweet).ShowModal() def fav(self, ev=None): if self.nb.GetCurrentPage().name_buffer != "direct_messages" and self.nb.GetCurrentPage().name_buffer != "followers" and self.nb.GetCurrentPage().name_buffer != "friends": diff --git a/src/main.py b/src/main.py index d00f891f..7b4ed5a3 100644 --- a/src/main.py +++ b/src/main.py @@ -27,11 +27,7 @@ import paths import config import commandline import platform -if platform.system() == "Windows": - from logger import logger as logging -if platform.system() == "Darwin": - import osx_prepare - osx_prepare.setup() +from logger import logger as logging from sessionmanager import manager from sessionmanager import gui as smGUI manager.setup() @@ -41,35 +37,18 @@ if hasattr(sys, 'frozen'): sys.stderr = open(paths.logs_path("stderr.log"), 'w') sys.stdout = open(paths.logs_path("stdout.log"), 'w') -class app(wx.App): - def __init__(self, *args, **kwargs): - super(app, self).__init__(*args, **kwargs) - if platform.system() != "Darwin": - self.start() - else: - self.mac() - - def mac(self): - self.hold_frame = wx.Frame(title="None", parent=None) - self.hold_frame.Show() - wx.CallLater(10, self.start) - - def start(self): - ssmg = smGUI.sessionManagerWindow() - if ssmg.ShowModal() == wx.ID_OK: - frame = gui.main.mainFrame() - frame.Show() - frame.showing = True - if config.main != None and config.main["general"]["hide_gui"] == True and platform.system() == "Windows": - frame.show_hide() - frame.Hide() - self.SetTopWindow(frame) - if hasattr(self, "frame"): self.hold_frame.Hide() - # If the user press on cancel. - else: - self.Exit() - -ap = app() +app = wx.App() +ssmg = smGUI.sessionManagerWindow() +if ssmg.ShowModal() == wx.ID_OK: + frame = gui.main.mainFrame() + frame.Show() + frame.showing = True + if config.main != None and config.main["general"]["hide_gui"] == True and platform.system() == "Windows": + frame.show_hide() + frame.Hide() + app.SetTopWindow(frame) +else: + app.Exit() ### I should uncomment this #if platform.system() != "Windows": # local = wx.Locale(wx.LANGUAGE_DEFAULT) @@ -77,5 +56,5 @@ ap = app() # local.AddCatalog("twblue") #ap = app(redirect=True, useBestVisual=True, filename=paths.logs_path('tracebacks.log')) #wx.CallLater(10, start) -ap.MainLoop() +app.MainLoop() From 18f7cb6c9664cc776661533a70d50fca7123cabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 26 Nov 2014 11:52:36 -0600 Subject: [PATCH 2/7] Replies will not show on list buffers --- src/twitter/buffers/indibidual.py | 8 +++++++- src/twitter/buffers/stream.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/twitter/buffers/indibidual.py b/src/twitter/buffers/indibidual.py index 0da7ecaf..20d1987b 100644 --- a/src/twitter/buffers/indibidual.py +++ b/src/twitter/buffers/indibidual.py @@ -34,7 +34,11 @@ class streamer(TwythonStreamer): tweet_event.SetItem(data) announce = _(u"One tweet from %s in the list %s") % (data["user"]["name"], self.parent.nb.GetPage(i).name_buffer[:-5]) tweet_event.SetAnnounce(announce) - wx.PostEvent(self.parent.nb.GetPage(i), tweet_event) + usr = data["in_reply_to_user_id"] + if (usr != None and usr in self.friends) or data.has_key("retweeted_status"): + wx.PostEvent(self.parent.nb.GetPage(i), tweet_event) + elif usr == None: + wx.PostEvent(self.parent.nb.GetPage(i), tweet_event) except ValueError: pass @@ -42,5 +46,7 @@ class streamer(TwythonStreamer): try: if data.has_key("text"): self.check_tls(data) + elif "friends" in data: + self.friends = data["friends"] except: pass \ No newline at end of file diff --git a/src/twitter/buffers/stream.py b/src/twitter/buffers/stream.py index 86a8c298..4a4435de 100644 --- a/src/twitter/buffers/stream.py +++ b/src/twitter/buffers/stream.py @@ -68,7 +68,7 @@ class streamer(TwythonStreamer): tweet_event.SetItem(data["direct_message"]) text = _(u"One direct message") tweet_event.SetAnnounce(text) - wx.PostEvent(self.parent.search_buffer("buffer", "direct_messages"), tweet_event) + wx.PostEvent(self.parent.search_buffer("direct_message", "direct_messages"), tweet_event) def check_follower(self, data): if data["target"]["screen_name"] == self.db.settings["user_name"] and config.main["other_buffers"]["show_followers"] == True: From 9d6490179178567fe391120a7c401c2e96e50ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 26 Nov 2014 13:45:24 -0600 Subject: [PATCH 3/7] Session manager deletes invalid sessions; plays audio from any URL when the tweet has more than one --- src/gui/buffers/base.py | 11 +++++++++-- src/gui/dialogs/urlList.py | 3 +-- src/sessionmanager/gui.py | 6 +++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/buffers/base.py b/src/gui/buffers/base.py index 619a20f2..8ec2ade2 100644 --- a/src/gui/buffers/base.py +++ b/src/gui/buffers/base.py @@ -297,14 +297,21 @@ class basePanel(wx.Panel): ev.Skip() return if event == "audio" and len(urls) > 0: - self.streamer(urls[0]) + if len(urls) == 1: + self.streamer(urls[0]) + elif len(urls) > 1: + urlList = gui.dialogs.urlList.urlList(urls) + if urlList.ShowModal() == wx.ID_OK: + self.streamer(urls[urlList.lista.GetSelection()]) elif event == "url": if len(urls) == 0: return elif len(urls) == 1: output.speak(_(u"Opening URL..."), True) webbrowser.open(urls[0]) elif len(urls) > 1: - gui.dialogs.urlList.urlList(urls).ShowModal() + urlList = gui.dialogs.urlList.urlList(urls) + if urlList.ShowModal() == wx.ID_OK: + webbrowser.open_new_tab(urls[urlList.lista.GetSelection()]) elif event == "volume_down": if config.main["sound"]["volume"] > 0.05: config.main["sound"]["volume"] = config.main["sound"]["volume"]-0.05 diff --git a/src/gui/dialogs/urlList.py b/src/gui/dialogs/urlList.py index 65aac035..3ed25a14 100644 --- a/src/gui/dialogs/urlList.py +++ b/src/gui/dialogs/urlList.py @@ -46,8 +46,7 @@ class urlList(wx.Dialog): self.SetClientSize(sizer.CalcMin()) def onGo(self, ev): - webbrowser.open(self.lista.GetStringSelection()) - self.Destroy() + self.EndModal(wx.ID_OK) def populate_list(self): for i in self.urls: diff --git a/src/sessionmanager/gui.py b/src/sessionmanager/gui.py index 3407c5f7..799834bf 100644 --- a/src/sessionmanager/gui.py +++ b/src/sessionmanager/gui.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import shutil import time import wx import manager @@ -55,9 +56,12 @@ class sessionManagerWindow(wx.Dialog): strconfig = "%s/session.conf" % (paths.config_path(i)) config_test = Configuration(strconfig) name = config_test["twitter"]["user_name"] - if name != "" and config_test["twitter"]["user_key"] != "" and config_test["twitter"]["user_secret"] != "": + if name != "" or (config_test["twitter"]["user_key"] != "" and config_test["twitter"]["user_secret"] != ""): self.list.insert_item(False, name) self.sessions.append(i) + else: + del config_test + shutil.rmtree(path=paths.config_path(i), ignore_errors=True) if self.list.get_count() > 0: self.list.select_item(0) self.list.list.SetSize(self.list.list.GetBestSize()) From 1b684cd12cf0b7fbad478d06b63fccf67effbfc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 26 Nov 2014 16:38:46 -0600 Subject: [PATCH 4/7] The session manager has a remove account button --- src/sessionmanager/gui.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/sessionmanager/gui.py b/src/sessionmanager/gui.py index 799834bf..16923a05 100644 --- a/src/sessionmanager/gui.py +++ b/src/sessionmanager/gui.py @@ -24,28 +24,26 @@ class sessionManagerWindow(wx.Dialog): label = wx.StaticText(panel, -1, _(u"Select a twitter account to start TW Blue"), size=wx.DefaultSize) listSizer = wx.BoxSizer(wx.HORIZONTAL) self.list = widgets.list(panel, _(u"Account"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT) - self.fill_list() listSizer.Add(label, 0, wx.ALL, 5) listSizer.Add(self.list.list, 0, wx.ALL, 5) sizer.Add(listSizer, 0, wx.ALL, 5) new = wx.Button(panel, -1, _(u"New account"), size=wx.DefaultSize) new.Bind(wx.EVT_BUTTON, self.new_account) + self.removeSession = wx.Button(panel, -1, _(u"Remove session")) + self.removeSession.Disable() + self.removeSession.Bind(wx.EVT_BUTTON, self.remove) ok = wx.Button(panel, wx.ID_OK, size=wx.DefaultSize) ok.SetDefault() ok.Bind(wx.EVT_BUTTON, self.ok) cancel = wx.Button(panel, wx.ID_CANCEL, size=wx.DefaultSize) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(new, 0, wx.ALL, 5) + buttons.Add(self.removeSession, 0, wx.ALL, 5) buttons.Add(ok, 0, wx.ALL, 5) buttons.Add(cancel, 0, wx.ALL, 5) sizer.Add(buttons, 0, wx.ALL, 5) panel.SetSizer(sizer) -# sizer.Layout() -# self.Fit() -# self.SetSize(panel.GetBestSize()) -# panelSizer.Add(panel) -# self.SetSizerAndFit(sizer) -# sizer.Layout() + self.fill_list() min = sizer.CalcMin() self.SetClientSize(min) @@ -65,6 +63,7 @@ class sessionManagerWindow(wx.Dialog): if self.list.get_count() > 0: self.list.select_item(0) self.list.list.SetSize(self.list.list.GetBestSize()) + self.removeSession.Enable() def ok(self, ev): if self.list.get_count() == 0: @@ -78,8 +77,6 @@ class sessionManagerWindow(wx.Dialog): languageHandler.setLanguage(lang) sound.setup() output.setup() -# else: -# self.name = current_session self.EndModal(wx.ID_OK) def new_account(self, ev): @@ -103,3 +100,12 @@ class sessionManagerWindow(wx.Dialog): if self.list.get_count() == 1: self.list.select_item(0) self.sessions.append(location) + + def remove(self, ev): + selected_item = self.list.get_selected() + selected_session = self.sessions[selected_item] + ask = wx.MessageDialog(self, _(u"Do you really want delete this account?"), _(u"Remove account"), wx.YES_NO) + if ask.ShowModal() == wx.ID_YES: + self.sessions.remove(selected_session) + shutil.rmtree(path=paths.config_path(selected_session), ignore_errors=True) + self.list.remove_item(selected_item) \ No newline at end of file From 0f2fbc775a10b081a2efc034bb56292fe6cdde58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 26 Nov 2014 17:26:53 -0600 Subject: [PATCH 5/7] Switch account is now possible from the application menu --- src/gui/main.py | 6 ++++++ src/gui/switchModule.py | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/gui/switchModule.py diff --git a/src/gui/main.py b/src/gui/main.py index 9df152dc..189a72ac 100644 --- a/src/gui/main.py +++ b/src/gui/main.py @@ -32,6 +32,7 @@ import output import platform import urllib2 import sysTrayIcon +import switchModule import languageHandler from sessionmanager import manager from mysc import event @@ -56,6 +57,8 @@ class mainFrame(wx.Frame): # Application menu app = wx.Menu() + switch_account = app.Append(wx.NewId(), _(u"S&witch account")) + self.Bind(wx.EVT_MENU, self.switch_account) updateProfile = app.Append(wx.NewId(), _(u"&Update profile")) self.Bind(wx.EVT_MENU, self.update_profile, updateProfile) show_hide = app.Append(wx.NewId(), _(u"&Hide window")) @@ -970,6 +973,9 @@ class mainFrame(wx.Frame): return page return page + def switch_account(self, ev): + switchModule.switcher(self) + ### Close App def Destroy(self): self.sysTray.Destroy() diff --git a/src/gui/switchModule.py b/src/gui/switchModule.py new file mode 100644 index 00000000..cb58784a --- /dev/null +++ b/src/gui/switchModule.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +import wx +import gui +import config +from sessionmanager import gui as sessionManagerUI + +class switcher(object): + def __init__(self, window): + self.hold_window = window + self.hold_window.Hide() + sessionManagerWindow = sessionManagerUI.sessionManagerWindow() + if sessionManagerWindow.ShowModal() == wx.ID_OK: + self.hold_window.Destroy() + self.window = gui.main.mainFrame() + self.window.Show() + self.window.showing = True + if config.main != None and config.main["general"]["hide_gui"] == True: + self.window.show_hide() + self.window.Hide() + wx.GetApp().SetTopWindow(self.window) + else: + self.window.Show() + \ No newline at end of file From acb8c5acd38f6535b908a65c84c9e7d1a55269df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Thu, 27 Nov 2014 07:18:05 -0600 Subject: [PATCH 6/7] TWBlue starts automatically if there is only an account --- src/gui/main.py | 2 +- src/main.py | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/gui/main.py b/src/gui/main.py index 189a72ac..cacbf5ec 100644 --- a/src/gui/main.py +++ b/src/gui/main.py @@ -504,7 +504,7 @@ class mainFrame(wx.Frame): dlg = dialogs.lists.removeUserListDialog(self) if dlg.ShowModal() == wx.ID_OK: try: - list = self.twitter.twitter.delete_list_member(list_id=self.db.settings["lists"][dlg.get_selected()]["id"], screen_name=user) + list = self.twitter.twitter.delete_list_member(list_id=self.db.settings["lists"][dlg.lista.get_selected()]["id"], screen_name=user) older_list = twitter.utils.find_item(self.db.settings["lists"][dlg.get_selected()]["id"], self.db.settings["lists"]) if list["mode"] == "private": self.db.settings["lists"].pop(older_list) diff --git a/src/main.py b/src/main.py index 7b4ed5a3..7cf5f49c 100644 --- a/src/main.py +++ b/src/main.py @@ -20,7 +20,7 @@ A twitter accessible, easy of use and cross platform application.""" # ############################################################ import wx - +import os ssmg = None import gui import paths @@ -32,14 +32,32 @@ from sessionmanager import manager from sessionmanager import gui as smGUI manager.setup() import sys +import config +import output +import sound +import languageHandler if hasattr(sys, 'frozen'): sys.stderr = open(paths.logs_path("stderr.log"), 'w') sys.stdout = open(paths.logs_path("stdout.log"), 'w') app = wx.App() -ssmg = smGUI.sessionManagerWindow() -if ssmg.ShowModal() == wx.ID_OK: +configured = False +configs = [] +for i in os.listdir(paths.config_path()): + if os.path.isdir(paths.config_path(i)): configs.append(i) +if len(configs) == 1: + manager.manager.set_current_session(configs[0]) + config.MAINFILE = "%s/session.conf" % (manager.manager.get_current_session()) + config.setup() + lang=config.main['general']['language'] + languageHandler.setLanguage(lang) + sound.setup() + output.setup() + configured = True +else: + ssmg = smGUI.sessionManagerWindow() +if configured == True or ssmg.ShowModal() == wx.ID_OK: frame = gui.main.mainFrame() frame.Show() frame.showing = True From 60507e8f6be180ef155c43274971fee776b19a1c Mon Sep 17 00:00:00 2001 From: jmdaweb Date: Thu, 27 Nov 2014 17:31:10 +0100 Subject: [PATCH 7/7] Pressing enter, spacebar or mouse left click should show window if it's not visible --- src/gui/sysTrayIcon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/sysTrayIcon.py b/src/gui/sysTrayIcon.py index d000d2a4..ee57f4a2 100644 --- a/src/gui/sysTrayIcon.py +++ b/src/gui/sysTrayIcon.py @@ -55,7 +55,7 @@ class SysTrayIcon(wx.TaskBarIcon): if (self.frame.showing): self.frame.SetFocus() else: - self.frame.onShow_hide() + self.frame.show_hide() def Destroy(self): self.menu.Destroy()