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

guilherme.polo python-checkins at python.org
Wed May 7 13:43:28 CEST 2008


Author: guilherme.polo
Date: Wed May  7 13:43:28 2008
New Revision: 62817

Log:
method set of Treeview is fixed now, this should complete the Treeview widget.

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	Wed May  7 13:43:28 2008
@@ -181,7 +181,7 @@
 
     return '\n'.join(script)
 
-def _dict_from_tcltuple(t):
+def _dict_from_tcltuple(t, cut_minus=True):
     """Break tuple in pairs, format it properly, then build the return 
     dict.
 
@@ -197,10 +197,11 @@
             if value[0].typename == "StateSpec":
                 value = [[str(value[0]).split(), value[1]]]
 
-        opts.append((opt, value))
+        opts.append((str(opt), value))
     
-    # note that the '-' prefixing options will be removed
-    return dict((str(opt[0])[1:], opt[1]) for opt in opts)
+    # note that the supposed '-' prefixing options will be removed if 
+    # cut_minus is True.
+    return dict((opt[1 if cut_minus else 0:], val) for opt, val in opts)
 
 def _val_or_dict(options, func, *args):
     """Format options then call func with args and options and return 
@@ -1169,8 +1170,11 @@
         for the specified item. With two arguments, returns the current
         value of the specified column. With three arguments, sets the
         value of given column in given item to the specified value."""
-        # XXX Wrong return
-        return self.tk.call(self._w, "set", item, column, value)
+        res = self.tk.call(self._w, "set", item, column, value)
+        if column is None and value is None:
+            return _dict_from_tcltuple(res, False)
+        else:
+            return res
 
 
     def tag_bind(self, tagName, sequence=None, script=None):


More information about the Python-checkins mailing list