]> granicus.if.org Git - python/commitdiff
Added missed calls of splitlist().
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 1 Jun 2014 08:21:55 +0000 (11:21 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 1 Jun 2014 08:21:55 +0000 (11:21 +0300)
Lib/tkinter/font.py
Lib/tkinter/test/test_ttk/test_functions.py
Lib/tkinter/ttk.py

index 49292412f0dac0ff6e568ee9671b3c8facb5597e..2096093a2c089c42f8c69c19f03c62c7b5e54965 100644 (file)
@@ -81,7 +81,8 @@ class Font:
         if exists:
             self.delete_font = False
             # confirm font exists
-            if self.name not in root.tk.call("font", "names"):
+            if self.name not in root.tk.splitlist(
+                    root.tk.call("font", "names")):
                 raise tkinter._tkinter.TclError(
                     "named font %s does not already exist" % (self.name,))
             # if font config info supplied, apply it
index 8dd87533ff59be64d267270f2f34db00469833d4..41e6311ac17c7abfa7f7ff00102686e8ca8e0b72 100644 (file)
@@ -407,8 +407,6 @@ class InternalFunctionsTest(unittest.TestCase):
             ('name', 'no_minus', 'value'))
         self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
             ('something', '-children')) # no children
-        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
-            ('something', '-children', 'value')) # invalid children
 
 
     def test_val_or_dict(self):
index 81f909c98450172ee4319f90ce3d2ed61f337506..c6ca9a55f823c18b25ca6cf8326ea06b3d347e42 100644 (file)
@@ -275,6 +275,7 @@ def _list_from_statespec(stuple):
 def _list_from_layouttuple(tk, ltuple):
     """Construct a list from the tuple returned by ttk::layout, this is
     somewhat the reverse of _format_layoutlist."""
+    ltuple = tk.splitlist(ltuple)
     res = []
 
     indx = 0
@@ -293,8 +294,6 @@ def _list_from_layouttuple(tk, ltuple):
             indx += 2
 
             if opt == 'children':
-                if not tk.wantobjects():
-                    val = tk.splitlist(val)
                 val = _list_from_layouttuple(tk, val)
 
             opts[opt] = val
@@ -408,8 +407,8 @@ class Style(object):
             return _list_from_statespec(self.tk.splitlist(
                 self.tk.call(self._name, "map", style, '-%s' % query_opt)))
 
-        return _dict_from_tcltuple(
-            self.tk.call(self._name, "map", style, *(_format_mapdict(kw))))
+        return _dict_from_tcltuple(self.tk.splitlist(
+            self.tk.call(self._name, "map", style, *(_format_mapdict(kw)))))
 
 
     def lookup(self, style, option, state=None, default=None):
@@ -463,8 +462,8 @@ class Style(object):
             lspec = "null" # could be any other word, but this may make sense
                            # when calling layout(style) later
 
-        return _list_from_layouttuple(self.tk, self.tk.splitlist(
-            self.tk.call(self._name, "layout", style, lspec)))
+        return _list_from_layouttuple(self.tk,
+            self.tk.call(self._name, "layout", style, lspec))
 
 
     def element_create(self, elementname, etype, *args, **kw):