[Python-checkins] r63908 - in sandbox/trunk/ttk-gsoc: samples/combo_themes.py src/2.x/ttk.py src/3.x/ttk.py
guilherme.polo
python-checkins at python.org
Tue Jun 3 01:49:47 CEST 2008
Author: guilherme.polo
Date: Tue Jun 3 01:49:47 2008
New Revision: 63908
Log:
Better explanation of the previous fix, and yet another fix over the previous fix (looks good now).
Modified:
sandbox/trunk/ttk-gsoc/samples/combo_themes.py
sandbox/trunk/ttk-gsoc/src/2.x/ttk.py
sandbox/trunk/ttk-gsoc/src/3.x/ttk.py
Modified: sandbox/trunk/ttk-gsoc/samples/combo_themes.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/combo_themes.py (original)
+++ sandbox/trunk/ttk-gsoc/samples/combo_themes.py Tue Jun 3 01:49:47 2008
@@ -28,8 +28,7 @@
# Create a readonly Combobox which will display 4 values at max,
# which will cause it to create a scrollbar if there are more
# than 4 values in total.
- themes_combo = ttk.Combobox(self, values=tuple(themes),
- state="readonly", height=4)
+ themes_combo = ttk.Combobox(self, values=themes, state="readonly", height=4)
themes_combo.set(themes[0]) # sets the combobox value to "Pick a theme"
# Combobox widget generates a <<ComboboxSelected>> virtual event
# when the user selects an element. This event is generated after
Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original)
+++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Tue Jun 3 01:49:47 2008
@@ -250,13 +250,14 @@
for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])):
- try: # could be the padding option, a string of ints
- val = map(int, val.split())
- except (AttributeError, ValueError): # just keep the value as is
- pass
-
- if val and hasattr(val, "__len__") and hasattr(val[0], "typename"):
- val = _list_from_statespec(val)
+ try:
+ if ' ' in val: # val could be the padding option
+ val = map(int, val.split())
+ except (AttributeError, TypeError, ValueError):
+ # it is not a bool, neither a string and not even a tuple or list
+ # but still could be a statespec value
+ if val and hasattr(val, "__len__") and hasattr(val[0], "typename"):
+ val = _list_from_statespec(val)
opts.append((str(opt)[opt_start:], val))
Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original)
+++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Tue Jun 3 01:49:47 2008
@@ -250,13 +250,14 @@
for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])):
- try: # could be the padding option, a string of ints
- val = list(map(int, val.split()))
- except (AttributeError, ValueError): # just keep the value as is
- pass
-
- if val and hasattr(val, "__len__") and hasattr(val[0], "typename"):
- val = _list_from_statespec(val)
+ try:
+ if ' ' in val: # could be the padding option
+ val = list(map(int, val.split()))
+ except (AttributeError, TypeError, ValueError):
+ # it is not a bool, neither a string and not even a tuple or list
+ # but still could be a statespec value
+ if val and hasattr(val, "__len__") and hasattr(val[0], "typename"):
+ val = _list_from_statespec(val)
opts.append((str(opt)[opt_start:], val))
More information about the Python-checkins
mailing list