diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 175a2144..7bce481e 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -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_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.seekLeft, menuitem=self.view.seekLeft) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.seekRight, menuitem=self.view.seekRight) if widgetUtils.toolkit == "wx": 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) @@ -478,6 +480,18 @@ class Controller(object): output.speak(_(u"{0} not found.").format(string,), True) 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): editor = keystrokeEditor.KeystrokeEditor() if editor.changed == True: diff --git a/src/keymaps/Windows 10.keymap b/src/keymaps/Windows 10.keymap index a0862697..95a60ab8 100644 --- a/src/keymaps/Windows 10.keymap +++ b/src/keymaps/Windows 10.keymap @@ -15,7 +15,7 @@ show_hide = string(default="alt+win+w") post_tweet = string(default="alt+win+n") post_reply = string(default="control+win+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") remove_from_favourites = string(default="alt+shift+win+f") follow = string(default="alt+win+s") diff --git a/src/sound.py b/src/sound.py index 34ef40e9..5d63dc5a 100644 --- a/src/sound.py +++ b/src/sound.py @@ -117,6 +117,22 @@ class URLStream(object): log.debug("Transformed URL: %s. Prepared" % (self.url,)) 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): if announce: output.speak(_(u"Playing...")) diff --git a/src/wxUI/view.py b/src/wxUI/view.py index c729f8eb..52d06091 100644 --- a/src/wxUI/view.py +++ b/src/wxUI/view.py @@ -57,6 +57,11 @@ class mainFrame(wx.Frame): self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer")) 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 = wx.Menu() self.doc = help.Append(-1, _(u"&Documentation")) @@ -72,6 +77,7 @@ class mainFrame(wx.Frame): menuBar.Append(tweet, _(u"&Tweet")) menuBar.Append(user, _(u"&User")) menuBar.Append(buffer, _(u"&Buffer")) + menuBar.Append(audio, _(u"&Audio")) menuBar.Append(help, _(u"&Help")) self.accel_tbl = wx.AcceleratorTable([ @@ -88,7 +94,10 @@ class mainFrame(wx.Frame): (wx.ACCEL_CTRL, ord('I'), self.timeline.GetId()), (wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord('I'), self.deleteTl.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, wx.WXK_RIGHT, self.seekRight.GetId()), +(wx.ACCEL_CTRL, ord(' '), self.seekLeft.GetId()), ]) self.SetAcceleratorTable(self.accel_tbl)