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] 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())