[Pkg-bazaar-commits] ./bzr-gtk/unstable r563: Merge of fix for history mode handling + replacing signals with more appropriate ones

Jasper Groenewegen colbrac at xs4all.nl
Fri Apr 10 07:50:42 UTC 2009


------------------------------------------------------------
revno: 563
committer: Jasper Groenewegen <colbrac at xs4all.nl>
branch nick: trunk
timestamp: Tue 2008-07-22 23:40:52 +0200
message:
  Merge of fix for history mode handling + replacing signals with more appropriate ones
modified:
  NEWS
  olive/__init__.py
  olive/window.py
    ------------------------------------------------------------
    revno: 560.3.1
    committer: Jasper Groenewegen <colbrac at xs4all.nl>
    branch nick: improve-history
    timestamp: Sun 2008-07-20 20:53:25 +0200
    message:
      Change locationbar bits (event signals, handling)
      Change key-press-event's to activate's
      Automatically switch to selected history view (fixes LP:144963)
    modified:
      olive/__init__.py
      olive/window.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-07-22 19:46:47 +0000
+++ b/NEWS	2008-07-22 21:40:52 +0000
@@ -54,6 +54,8 @@
 
   * Remove question for setting default push location. (Jasper Groenewegen, #151818)
 
+  * Automatically change to history mode on selecting a revision from the list. (Jasper Groenewegen, #144963)
+
  CHANGES
 
   * Moved notify icon code to separate script. (Jelmer Vernooij)

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2008-07-20 16:29:18 +0000
+++ b/olive/__init__.py	2008-07-20 18:53:25 +0000
@@ -312,6 +312,7 @@
             if response == gtk.RESPONSE_OK:
                 if revb.selected_revno is not None:
                     self.entry_history.set_text(revb.selected_revno)
+                    self.on_entry_history_revno_activate()
             
             revb.destroy()
     
@@ -342,6 +343,8 @@
             # History Mode activated
             self.entry_history.set_sensitive(True)
             self.button_history.set_sensitive(True)
+            if self.entry_history.get_text() != "":
+                self.on_entry_history_revno_activate()
         else:
             # History Mode deactivated
             self.entry_history.set_sensitive(False)
@@ -351,27 +354,18 @@
             self.on_button_location_jump_clicked(widget)
     
     @show_bzr_error
-    def on_entry_history_revno_key_press_event(self, widget, event):
+    def on_entry_history_revno_activate(self, widget=None):
         """ Key pressed handler for the history entry. """
-        if event.keyval == gtk.gdk.keyval_from_name('Return') or event.keyval == gtk.gdk.keyval_from_name('KP_Enter'):
-            # Return was hit, so we have to load that specific revision
-            # Emulate being remote, so inventory should be used
-            path = self.get_path()
-            if not self.remote:
-                self.remote = True
-                self.remote_branch = self.wt.branch
-            
-            revno = int(self.entry_history.get_text())
-            self.remote_revision = self.remote_branch.get_rev_id(revno)
-            if self.set_path(path, True):
-                self.refresh_right()
-    
-    def on_entry_location_key_press_event(self, widget, event):
-        """ Key pressed handler for the location entry. """
-        if event.keyval == gtk.gdk.keyval_from_name('Return') or event.keyval == gtk.gdk.keyval_from_name('KP_Enter'):
-            # Return was hit, so we have to jump
-            self.on_button_location_jump_clicked(widget)
-    
+        path = self.get_path()
+        if not self.remote:
+            self.remote = True
+            self.remote_branch = self.wt.branch
+        
+        revno = int(self.entry_history.get_text())
+        self.remote_revision = self.remote_branch.get_rev_id(revno)
+        if self.set_path(path, True):
+            self.refresh_right()
+
     def on_menuitem_add_files_activate(self, widget):
         """ Add file(s)... menu handler. """
         from bzrlib.plugins.gtk.olive.add import AddDialog

=== modified file 'olive/window.py'
--- a/olive/window.py	2008-07-20 16:02:18 +0000
+++ b/olive/window.py	2008-07-20 18:53:25 +0000
@@ -335,7 +335,7 @@
         self.locationbar.pack_start(self.button_location_up, False, False, 0)
         
         self.entry_location = gtk.Entry()
-        self.entry_location.connect("key-press-event", self.signal.on_entry_location_key_press_event)
+        self.entry_location.connect("activate", self.signal.on_button_location_jump_clicked)
         self.locationbar.pack_start(self.entry_location, True, True, 0)
         
         self.image_location_error = gtk.Image()
@@ -356,7 +356,7 @@
         self.entry_history_revno = gtk.Entry()
         self.entry_history_revno.set_property("width-request", 75)
         self.entry_history_revno.set_sensitive(False)
-        self.entry_history_revno.connect("key-press-event", self.signal.on_entry_history_revno_key_press_event)
+        self.entry_history_revno.connect("activate", self.signal.on_entry_history_revno_activate)
         self.locationbar.pack_start(self.entry_history_revno, False, False, 0)
         
         self.button_history_browse = gtk.Button()



More information about the Pkg-bazaar-commits mailing list