From 34b8bc6b5853b72404131991acfd572bf7a45cce Mon Sep 17 00:00:00 2001 From: Anna Date: Wed, 19 May 2010 11:27:14 -0400 Subject: [PATCH] Made pane navigation buttons work regardless of focus --- TODO | 1 + mytwitter.py | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index ce7ff0c..638a786 100644 --- a/TODO +++ b/TODO @@ -17,3 +17,4 @@ bugs: considerable tweaks to python-twitter) * "ValueError: list.remove(x): x not in list" when trying to close a tab (error recurred after adding conversation support). Tabs can be reordered, then closed, as a workaround. * Links must be right-clicked on to activate - can't left-click on the link directly. This seems to be a pygtk issue +* Double-quotes are not parsed correctly in tweets diff --git a/mytwitter.py b/mytwitter.py index 800e074..312bad1 100755 --- a/mytwitter.py +++ b/mytwitter.py @@ -432,13 +432,37 @@ class MyTwitter(): keyname = gtk.gdk.keyval_name(event.keyval) if keyname == 'w' and event.state & gtk.gdk.CONTROL_MASK: self.close_current_tab() - elif (keyname == 'Tab' and event.state & gtk.gdk.SHIFT_MASK and event.state & gtk.gdk.CONTROL_MASK) or (keyname == 'ISO_Left_Tab' and event.state & gtk.gdk.CONTROL_MASK) or (keyname == 'Page_Up' and event.state & gtk.gdk.CONTROL_MASK): + + # Ctrl + Shift + Tab or Ctrl + PgUp or Ctrl + Left should go to prev tab + elif event.state & gtk.gdk.CONTROL_MASK and ((keyname == 'Tab' and event.state & gtk.gdk.SHIFT_MASK) or keyname == 'ISO_Left_Tab' or keyname == 'Page_Up' or keyname == 'Left'): self.tweet_notebook.prev_page() return True - elif (keyname == 'Tab' and event.state & gtk.gdk.CONTROL_MASK) or (keyname == 'Page_Down' and event.state & gtk.gdk.CONTROL_MASK): + + # Ctrl + Tab or Ctrl + PgDown or Ctrl + Right should go to next tab + elif event.state & gtk.gdk.CONTROL_MASK and (keyname == 'Tab' or keyname == 'Page_Down' or keyname == 'Right'): self.tweet_notebook.next_page() return True + else: + scrolltype = None + if keyname == 'Page_Down': + scrolltype = gtk.SCROLL_PAGE_FORWARD + elif keyname == 'Page_Up': + scrolltype = gtk.SCROLL_PAGE_BACKWARD + elif keyname == 'Up': + scrolltype = gtk.SCROLL_STEP_BACKWARD + elif keyname == 'Down': + scrolltype = gtk.SCROLL_STEP_FORWARD + elif keyname == 'Home': + scrolltype = gtk.SCROLL_START + elif keyname == 'End': + scrolltype = gtk.SCROLL_END + + if scrolltype: + self.tweet_notebook.get_nth_page(self.tweet_notebook.get_current_page()).emit('scroll-child', scrolltype, False) + return True + + def close_current_tab(self): current_pane = self.tweet_notebook.get_nth_page(self.tweet_notebook.get_current_page())