# HG changeset patch # User Adrian Buehlmann <adr...@cadifra.com> # Date 1253895404 -7200 # Node ID 520fc5eab122276c1e60dbe9277553cf17f25a9d # Parent 394ad9ad61f34e8c08a084d70e8466f9e7c8df5a update: use add_button with gtk.RESPONSE_OK for "Update"
The button with the response id gtk.RESPONSE_OK is the 'default response button' (on Windows, this is called the default button, see also gtk.Dialog.set_default_response). The default response button gets a special button frame, so that the user recognizes it as the default button. This is the button that is executed when return is hit after dialog open. The use case here is: select a changeset in history dialog, then do "Update" from context menu -> update dialog opens with the changeset selected as target. Hitting the <return> (or <enter>) key then updates to that revision and closes the dialog. diff --git a/tortoisehg/hgtk/update.py b/tortoisehg/hgtk/update.py --- a/tortoisehg/hgtk/update.py +++ b/tortoisehg/hgtk/update.py @@ -45,9 +45,7 @@ class UpdateDialog(gtk.Dialog): self.set_title(_('Update - %s') % reponame) # add dialog buttons - self.updatebtn = gtk.Button(_('Update')) - self.updatebtn.connect('clicked', lambda b: self.update(repo)) - self.action_area.pack_end(self.updatebtn) + self.updatebtn = self.add_button(_('Update'), gtk.RESPONSE_OK) self.closebtn = self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CLOSE) # layout table for fixed items @@ -145,7 +143,9 @@ class UpdateDialog(gtk.Dialog): self.revcombo.connect('changed', lambda b: self.update_summaries()) def dialog_response(self, dialog, response_id): - if not self.cmd.is_alive(): + if response_id == gtk.RESPONSE_OK: + self.update(self.repo) + elif not self.cmd.is_alive(): self.destroy() def delete_event(self, dialog, event): ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Tortoisehg-develop mailing list Tortoisehg-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop