Session manager deletes invalid sessions; plays audio from any URL when the tweet has more than one

This commit is contained in:
Manuel Cortez 2014-11-26 13:45:24 -06:00
parent 18f7cb6c96
commit 9d64901791
3 changed files with 15 additions and 5 deletions

View File

@ -297,14 +297,21 @@ class basePanel(wx.Panel):
ev.Skip() ev.Skip()
return return
if event == "audio" and len(urls) > 0: 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": elif event == "url":
if len(urls) == 0: return if len(urls) == 0: return
elif len(urls) == 1: elif len(urls) == 1:
output.speak(_(u"Opening URL..."), True) output.speak(_(u"Opening URL..."), True)
webbrowser.open(urls[0]) webbrowser.open(urls[0])
elif len(urls) > 1: 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": elif event == "volume_down":
if config.main["sound"]["volume"] > 0.05: if config.main["sound"]["volume"] > 0.05:
config.main["sound"]["volume"] = config.main["sound"]["volume"]-0.05 config.main["sound"]["volume"] = config.main["sound"]["volume"]-0.05

View File

@ -46,8 +46,7 @@ class urlList(wx.Dialog):
self.SetClientSize(sizer.CalcMin()) self.SetClientSize(sizer.CalcMin())
def onGo(self, ev): def onGo(self, ev):
webbrowser.open(self.lista.GetStringSelection()) self.EndModal(wx.ID_OK)
self.Destroy()
def populate_list(self): def populate_list(self):
for i in self.urls: for i in self.urls:

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import shutil
import time import time
import wx import wx
import manager import manager
@ -55,9 +56,12 @@ class sessionManagerWindow(wx.Dialog):
strconfig = "%s/session.conf" % (paths.config_path(i)) strconfig = "%s/session.conf" % (paths.config_path(i))
config_test = Configuration(strconfig) config_test = Configuration(strconfig)
name = config_test["twitter"]["user_name"] 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.list.insert_item(False, name)
self.sessions.append(i) self.sessions.append(i)
else:
del config_test
shutil.rmtree(path=paths.config_path(i), ignore_errors=True)
if self.list.get_count() > 0: if self.list.get_count() > 0:
self.list.select_item(0) self.list.select_item(0)
self.list.list.SetSize(self.list.list.GetBestSize()) self.list.list.SetSize(self.list.list.GetBestSize())