# HG changeset patch # User Adrian Buehlmann <adr...@cadifra.com> # Date 1252356527 -7200 # Node ID 10ed24d3dc956b88812ba95a3e5482f7f23778f1 # Parent 407307f66e2054c64506367fb8beabf2d8c1ec7a commit: simplify toggle_view
don't call show or hide functions, if the state hasn't changed anyway diff --git a/hggtk/commit.py b/hggtk/commit.py --- a/hggtk/commit.py +++ b/hggtk/commit.py @@ -357,18 +357,16 @@ class GCommit(GStatus): return menu def toggle_view(self, button, type): - if type == 'parents': - self.showparents = button.get_active() - if self.showparents: - self.parents_frame.show() + sn, fr = {'parents': ('showparents', self.parents_frame), + 'advanced': ('showadvanced', self.advanced_frame), + }[type] + show = button.get_active() + if show != getattr(self, sn): + if show: + fr.show() else: - self.parents_frame.hide() - elif type == 'advanced': - self.showadvanced = button.get_active() - if self.showadvanced: - self.advanced_frame.show() - else: - self.advanced_frame.hide() + fr.hide() + setattr(self, sn, show) def changed_cb(self, combobox): model = combobox.get_model() ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Tortoisehg-develop mailing list Tortoisehg-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop