[Pkg-bazaar-commits] ./bzr-gtk/unstable r278: Merged Daniel Schierbeck's branch with HIG-related fixes.

Szilveszter Farkas (Phanatic) Szilveszter.Farkas at gmail.com
Fri Apr 10 07:49:50 UTC 2009


------------------------------------------------------------
revno: 278
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: trunk
timestamp: Mon 2007-09-17 23:23:30 +0200
message:
  Merged Daniel Schierbeck's branch with HIG-related fixes.
modified:
  NEWS
  annotate/gannotate.py
  olive/__init__.py
  olive/menu.py
  tags.py
  viz/branchwin.py
    ------------------------------------------------------------
    revno: 275.1.1
    committer: Daniel Schierbeck <daniel.schierbeck at gmail.com>
    branch nick: bzr-gtk
    timestamp: Fri 2007-09-14 11:19:47 +0200
    message:
      Close branch visualization window when 'destroy' message is received.
    modified:
      viz/branchwin.py
    ------------------------------------------------------------
    revno: 275.1.2
    committer: Daniel Schierbeck <daniel.schierbeck at gmail.com>
    branch nick: bzr-gtk
    timestamp: Fri 2007-09-14 11:31:19 +0200
    message:
      Close annotation window when 'destroy' signal is received.
    modified:
      annotate/gannotate.py
    ------------------------------------------------------------
    revno: 275.1.3
    committer: Daniel Schierbeck <daniel.schierbeck at gmail.com>
    branch nick: bzr-gtk
    timestamp: Fri 2007-09-14 11:32:19 +0200
    message:
      Close tags window when 'destroy' signal is received.
    modified:
      tags.py
    ------------------------------------------------------------
    revno: 275.1.4
    committer: Daniel Schierbeck <daniel.schierbeck at gmail.com>
    branch nick: bzr-gtk
    timestamp: Fri 2007-09-14 15:09:28 +0200
    message:
      Made 'destroy' signal callback use main_quit instead of the deprecated mainquit.
    modified:
      annotate/gannotate.py
      tags.py
      viz/branchwin.py
    ------------------------------------------------------------
    revno: 275.1.5
    committer: Daniel Schierbeck <daniel.schierbeck at gmail.com>
    branch nick: bzr-gtk
    timestamp: Fri 2007-09-14 17:56:39 +0200
    message:
      Made windows close correctly on Ctrl-W and made the application quit on Ctrl-Q.
    modified:
      annotate/gannotate.py
      tags.py
      viz/branchwin.py
    ------------------------------------------------------------
    revno: 275.1.6
    committer: Daniel Schierbeck <daniel.schierbeck at gmail.com>
    branch nick: feature.destroy-windows
    timestamp: Sat 2007-09-15 16:42:19 +0200
    message:
      Made Ctrl-W call gtk.main_quit if the window has no parent.
    modified:
      annotate/gannotate.py
      olive/__init__.py
      viz/branchwin.py
    ------------------------------------------------------------
    revno: 275.1.7
    committer: Daniel Schierbeck <daniel.schierbeck at gmail.com>
    branch nick: feature.destroy-windows
    timestamp: Sun 2007-09-16 22:57:13 +0200
    message:
      Added NEWS entry for the resolution of bug #139559.
    modified:
      NEWS
    ------------------------------------------------------------
    revno: 275.1.8
    committer: Daniel Schierbeck <daniel.schierbeck at gmail.com>
    branch nick: feature.destroy-windows
    timestamp: Mon 2007-09-17 23:14:04 +0200
    message:
      Fixed bug in the Olive context menu
    modified:
      olive/menu.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2007-09-17 20:20:43 +0000
+++ b/NEWS	2007-09-17 21:23:30 +0000
@@ -1,5 +1,10 @@
-0.91.0  IN DEVELOPMENT
-
+0.91.0	UNRELEASED
+
+ UI
+
+  * Added keyboard shortcuts for closing windows and exiting Olive.
+    (#139559, Daniel Schierbeck)
+ 
  BUG FIXES
 
   * Fix the "Complete Diff" entry in DiffWindow to show the whole diff.
@@ -26,7 +31,7 @@
  UI
   
   * Improve Preferences dialog layout. (Jelmer)
- 
+
  INTERNALS:
  
   * Updated pot generator script and regenerated the translation template.

=== modified file 'annotate/gannotate.py'
--- a/annotate/gannotate.py	2007-08-30 23:16:32 +0000
+++ b/annotate/gannotate.py	2007-09-15 14:42:19 +0000
@@ -44,11 +44,14 @@
 class GAnnotateWindow(gtk.Window):
     """Annotate window."""
 
-    def __init__(self, all=False, plain=False):
+    def __init__(self, all=False, plain=False, parent=None):
         self.all = all
         self.plain = plain
+        self._parent = parent
         
         gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
+
+        self.connect("key-press-event", self._on_key_pressed)
         
         self.set_icon(self.render_icon(gtk.STOCK_FIND, gtk.ICON_SIZE_BUTTON))
         self.annotate_colormap = AnnotateColorSaturation()
@@ -391,6 +394,24 @@
             if i + n >= row:
                 return j - i
 
+    def _on_key_pressed(self, widget, event):
+        """ Key press event handler. """
+        keyname = gtk.gdk.keyval_name(event.keyval)
+        func = getattr(self, '_on_key_press_' + keyname, None)
+        if func:
+            return func(event)
+
+    def _on_key_press_w(self, event):
+        if event.state & gtk.gdk.CONTROL_MASK:
+            self.destroy()
+            if self._parent is None:
+                gtk.main_quit()
+
+    def _on_key_press_q(self, event):
+        if event.state & gtk.gdk.CONTROL_MASK:
+            gtk.main_quit()
+    
+
 
 
 class FakeRevision:

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2007-09-14 08:40:45 +0000
+++ b/olive/__init__.py	2007-09-15 14:42:19 +0000
@@ -679,7 +679,7 @@
         branch = self.wt.branch
         file_id = self.wt.path2id(self.wt.relpath(os.path.join(self.path, self.get_selected_right())))
         
-        window = GAnnotateWindow(all=False, plain=False)
+        window = GAnnotateWindow(all=False, plain=False, parent=self.window)
         window.set_title(os.path.join(self.path, self.get_selected_right()) + " - Annotate")
         config = GAnnotateConfig(window)
         window.show()
@@ -742,7 +742,7 @@
     
     def on_menuitem_stats_log_activate(self, widget):
         """ Statistics/Log... menu handler. """
-        window = branchwin.BranchWindow()
+        window = branchwin.BranchWindow(parent=self.window)
         if not self.remote:
             window.set_branch(self.wt.branch, self.wt.branch.last_revision(), None)
         else:

=== modified file 'olive/menu.py'
--- a/olive/menu.py	2007-09-02 15:41:26 +0000
+++ b/olive/menu.py	2007-09-17 21:14:04 +0000
@@ -196,7 +196,7 @@
         branch = wt.branch
         file_id = wt.path2id(wt.relpath(os.path.join(directory, filename)))
         
-        window = GAnnotateWindow(all=False, plain=False)
+        window = GAnnotateWindow(all=False, plain=False, parent=self.app)
         window.set_title(os.path.join(directory, filename) + " - Annotate")
         config = GAnnotateConfig(window)
         window.show()

=== modified file 'tags.py'
--- a/tags.py	2007-07-15 18:39:52 +0000
+++ b/tags.py	2007-09-14 15:56:39 +0000
@@ -34,11 +34,11 @@
     def __init__(self, branch, parent=None):
         """ Initialize the Tags window. """
         gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
-        
+
         # Get arguments
         self.branch = branch
         self._parent = parent
-        
+
         # Create the widgets
         self._button_add = gtk.Button(stock=gtk.STOCK_ADD)
         self._button_remove = gtk.Button(stock=gtk.STOCK_REMOVE)
@@ -60,6 +60,7 @@
         self._button_refresh.connect('clicked', self._on_refresh_clicked)
         self._button_remove.connect('clicked', self._on_remove_clicked)
         self._treeview_tags.connect('cursor-changed', self._on_treeview_changed)
+        self.connect('key-press-event', self._on_key_pressed)
         if parent is None:
             self.connect('delete-event', gtk.main_quit)
         
@@ -177,6 +178,23 @@
         self.destroy()
         if self._parent is None:
             gtk.main_quit()
+
+    def _on_key_pressed(self, widget, event):
+        """ Key press event handler. """
+        keyname = gtk.gdk.keyval_name(event.keyval)
+        func = getattr(self, '_on_key_press_' + keyname, None)
+        if func:
+            return func(event)
+
+    def _on_key_press_w(self, event):
+        if event.state & gtk.gdk.CONTROL_MASK:
+            self.destroy()
+            if self._parent is None:
+                gtk.main_quit()
+
+    def _on_key_press_q(self, event):
+        if event.state & gtk.gdk.CONTROL_MASK:
+            gtk.main_quit()
     
     def _on_refresh_clicked(self, widget):
         """ Refresh button event handler. """

=== modified file 'viz/branchwin.py'
--- a/viz/branchwin.py	2007-08-24 11:48:03 +0000
+++ b/viz/branchwin.py	2007-09-15 14:42:19 +0000
@@ -26,11 +26,15 @@
     for a particular branch.
     """
 
-    def __init__(self):
+    def __init__(self, parent=None):
         gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
         self.set_border_width(0)
         self.set_title("bzrk")
 
+        self._parent = parent
+
+        self.connect('key-press-event', self._on_key_pressed)
+
         # Use three-quarters of the screen by default
         screen = self.get_screen()
         monitor = screen.get_monitor_geometry(0)
@@ -200,6 +204,22 @@
         self.treeview.set_model(self.model)
         return False
     
+    def _on_key_pressed(self, widget, event):
+        """ Key press event handler. """
+        keyname = gtk.gdk.keyval_name(event.keyval)
+        func = getattr(self, '_on_key_press_' + keyname, None)
+        if func:
+            return func(event)
+
+    def _on_key_press_w(self, event):
+        if event.state & gtk.gdk.CONTROL_MASK:
+            self.destroy()
+            if self._parent is None:
+                gtk.main_quit()
+
+    def _on_key_press_q(self, event):
+        if event.state & gtk.gdk.CONTROL_MASK:
+            gtk.main_quit()
     
     def _treeview_cursor_cb(self, *args):
         """Callback for when the treeview cursor changes."""



More information about the Pkg-bazaar-commits mailing list