dabo Commit
Revision 5296
Date: 2009-07-13 14:58:32 -0700 (Mon, 13 Jul 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5296
Changed:
U trunk/dabo/ui/uiwx/dRadioList.py
Log:
After resetting the Choices, first try to reassign the active button based on
Key,
then String, and finally Position. Enforce string value being in the choices by
raising ValueError instead of just printing a message to the log.
Diff:
Modified: trunk/dabo/ui/uiwx/dRadioList.py
===================================================================
--- trunk/dabo/ui/uiwx/dRadioList.py 2009-07-13 21:11:08 UTC (rev 5295)
+++ trunk/dabo/ui/uiwx/dRadioList.py 2009-07-13 21:58:32 UTC (rev 5296)
@@ -345,7 +345,7 @@
self._checkSizer(forceRecreate=True)
# Save the current values for possible re-setting
afterwards.
old_length = len(self.Choices)
- sv = (self.StringValue, self.KeyValue,
self.PositionValue)
+ sv = (self.KeyValue, self.StringValue,
self.PositionValue)
[itm.release() for itm in self._items]
self._choices = choices
self._items = []
@@ -364,11 +364,14 @@
self._items.append(btn)
if old_length:
- # Try each saved value
- self.StringValue = sv[0]
- if self.StringValue != sv[0]:
- self.KeyValue = sv[1]
- if self.KeyValue != sv[1]:
+ # Try each saved value to restore which button
is active:
+ if self.Keys:
+ self.KeyValue = sv[0]
+
+ if not self.Keys or self.KeyValue != sv[0]:
+ try:
+ self.StringValue = sv[1]
+ except ValueError:
self.PositionValue = sv[2]
if self.PositionValue != sv[2]:
# Bail!
@@ -495,7 +498,7 @@
except IndexError:
if val is not None:
# No such string.
- dabo.errorLog.write(_("No radio button
matching '%s' was found.") % val)
+ raise ValueError, _("No radio button
matching '%s' was found.") % val
else:
self._properties["StringValue"] = val
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]