Merge branch 'next-gen' of github.com:manuelcortez/twblue into next-gen

This commit is contained in:
Jose Manuel Delicado 2016-08-13 12:37:06 +02:00
commit b535c996d6
4 changed files with 40 additions and 1 deletions

View File

@ -175,6 +175,8 @@ class Controller(object):
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_timeline, self.view.timeline) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_timeline, self.view.timeline)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_favs_timeline, self.view.favs) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_favs_timeline, self.view.favs)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_conversation, menuitem=self.view.view_conversation) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_conversation, menuitem=self.view.view_conversation)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.seekLeft, menuitem=self.view.seekLeft)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.seekRight, menuitem=self.view.seekRight)
if widgetUtils.toolkit == "wx": if widgetUtils.toolkit == "wx":
widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed) widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.report_error, self.view.reportError) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.report_error, self.view.reportError)
@ -478,6 +480,18 @@ class Controller(object):
output.speak(_(u"{0} not found.").format(string,), True) output.speak(_(u"{0} not found.").format(string,), True)
page.buffer.list.select_item(start) page.buffer.list.select_item(start)
def seekLeft(self, *args, **kwargs):
try:
sound.URLPlayer.seek(-5)
except:
output.speak("Unable to seek.",True)
def seekRight(self, *args, **kwargs):
try:
sound.URLPlayer.seek(5)
except:
output.speak("Unable to seek.",True)
def edit_keystrokes(self, *args, **kwargs): def edit_keystrokes(self, *args, **kwargs):
editor = keystrokeEditor.KeystrokeEditor() editor = keystrokeEditor.KeystrokeEditor()
if editor.changed == True: if editor.changed == True:

View File

@ -15,7 +15,7 @@ show_hide = string(default="alt+win+w")
post_tweet = string(default="alt+win+n") post_tweet = string(default="alt+win+n")
post_reply = string(default="control+win+r") post_reply = string(default="control+win+r")
post_retweet = string(default="alt+win+shift+r") post_retweet = string(default="alt+win+shift+r")
send_dm = string(default="alt+win+d") send_dm = string(default="alt+win+shift+d")
add_to_favourites = string(default="alt+win+f") add_to_favourites = string(default="alt+win+f")
remove_from_favourites = string(default="alt+shift+win+f") remove_from_favourites = string(default="alt+shift+win+f")
follow = string(default="alt+win+s") follow = string(default="alt+win+s")

View File

@ -117,6 +117,22 @@ class URLStream(object):
log.debug("Transformed URL: %s. Prepared" % (self.url,)) log.debug("Transformed URL: %s. Prepared" % (self.url,))
self.prepared = True self.prepared = True
def seek(self,step):
pos=self.stream.get_position()
pos=self.stream.bytes_to_seconds(pos)
pos+=step
pos=self.stream.seconds_to_bytes(pos)
if pos<0:
pos=0
self.stream.set_position(pos)
def playpause(self):
if self.stream.is_playing==True:
self.stream.pause()
else:
self.stream.play()
def play(self, url=None, volume=1.0, stream=None,announce=True): def play(self, url=None, volume=1.0, stream=None,announce=True):
if announce: if announce:
output.speak(_(u"Playing...")) output.speak(_(u"Playing..."))

View File

@ -57,6 +57,11 @@ class mainFrame(wx.Frame):
self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer")) self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer"))
self.deleteTl = buffer.Append(wx.NewId(), _(u"&Destroy")) self.deleteTl = buffer.Append(wx.NewId(), _(u"&Destroy"))
# audio menu
audio = wx.Menu()
self.seekLeft = audio.Append(wx.NewId(), _(u"&Seek back 5 seconds"))
self.seekRight = audio.Append(wx.NewId(), _(u"&Seek forward 5 seconds"))
# Help Menu # Help Menu
help = wx.Menu() help = wx.Menu()
self.doc = help.Append(-1, _(u"&Documentation")) self.doc = help.Append(-1, _(u"&Documentation"))
@ -72,6 +77,7 @@ class mainFrame(wx.Frame):
menuBar.Append(tweet, _(u"&Tweet")) menuBar.Append(tweet, _(u"&Tweet"))
menuBar.Append(user, _(u"&User")) menuBar.Append(user, _(u"&User"))
menuBar.Append(buffer, _(u"&Buffer")) menuBar.Append(buffer, _(u"&Buffer"))
menuBar.Append(audio, _(u"&Audio"))
menuBar.Append(help, _(u"&Help")) menuBar.Append(help, _(u"&Help"))
self.accel_tbl = wx.AcceleratorTable([ self.accel_tbl = wx.AcceleratorTable([
@ -88,7 +94,10 @@ class mainFrame(wx.Frame):
(wx.ACCEL_CTRL, ord('I'), self.timeline.GetId()), (wx.ACCEL_CTRL, ord('I'), self.timeline.GetId()),
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('I'), self.deleteTl.GetId()), (wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('I'), self.deleteTl.GetId()),
(wx.ACCEL_CTRL, ord('M'), self.show_hide.GetId()), (wx.ACCEL_CTRL, ord('M'), self.show_hide.GetId()),
(wx.ACCEL_CTRL, wx.WXK_LEFT, self.seekLeft.GetId()),
(wx.ACCEL_CTRL, ord('P'), self.updateProfile.GetId()), (wx.ACCEL_CTRL, ord('P'), self.updateProfile.GetId()),
(wx.ACCEL_CTRL, wx.WXK_RIGHT, self.seekRight.GetId()),
(wx.ACCEL_CTRL, ord(' '), self.seekLeft.GetId()),
]) ])
self.SetAcceleratorTable(self.accel_tbl) self.SetAcceleratorTable(self.accel_tbl)