# HG changeset patch
# User Adrian Buehlmann <adr...@cadifra.com>
# Date 1252362036 -7200
# Node ID db98aea2165b38e8465e8a394d064324543fb55a
# Parent  fd72b0d5d36313d4252f112897b9f2db86cd4269
commit: toggle_view: kill dict

by relying on uniform naming pattern of attributes

diff --git a/hggtk/commit.py b/hggtk/commit.py
--- a/hggtk/commit.py
+++ b/hggtk/commit.py
@@ -358,16 +358,15 @@ class GCommit(GStatus):
         return menu
 
     def toggle_view(self, button, type):
-        sn, fr  = {'parents':  ('showparents',  self.parents_frame),
-                   'advanced': ('showadvanced', self.advanced_frame), 
-                  }[type]
         show = button.get_active()
-        if show != getattr(self, sn):
+        statename = 'show' + type
+        if getattr(self, statename) != show:
+            frame = getattr(self, type + '_frame')
             if show:
-                fr.show()
+                frame.show()
             else:
-                fr.hide()
-            setattr(self, sn, show)
+                frame.hide()
+            setattr(self, statename, 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

Reply via email to