[Python-checkins] r62858 - sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py

guilherme.polo python-checkins at python.org
Thu May 8 14:22:56 CEST 2008


Author: guilherme.polo
Date: Thu May  8 14:22:56 2008
New Revision: 62858

Log:
Some janitor work on _format_layoutdict

Modified:
   sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py

Modified: sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py	(original)
+++ sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py	Thu May  8 14:22:56 2008
@@ -128,13 +128,11 @@
       Menubutton.indicator -side right"""
     script = []
 
-    if child:
-        sublayouts = [layout.pop("children")] # sublayouts needing processing
-        func = sublayouts.pop
-    else:
-        func = layout.iteritems # will find sublayouts for processing
+    # If child is set, we will be dealing with subylayouts needing processing,
+    # otherwise we will try to find sublayouts for processing
+    layouts = layout.pop("children") if child else layout.iteritems()
 
-    for elem, opts in func():
+    for elem, opts in layouts:
         opts = opts or {}
         fopts = ' '.join(map(str, _format_optdict(opts, ignore="children")))
         head = "%s%s%s" % (' ' * indent, elem, (" %s" % fopts) if fopts else '')
@@ -376,10 +374,10 @@
     
         if parent:
             self.tk.call(self._name, "theme", "create", themeName,
-                "-parent", parent, "-settings", script)
+                         "-parent", parent, "-settings", script)
         else:
             self.tk.call(self._name, "theme", "create", themeName, 
-                "-settings", script)
+                         "-settings", script)
 
 
     def theme_settings(self, themeName, settings):


More information about the Python-checkins mailing list