dabo Commit
Revision 6386
Date: 2011-02-03 15:39:02 -0800 (Thu, 03 Feb 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6386
Changed:
U trunk/dabo/ui/uiwx/dMenuItem.py
Log:
Applied Jacek's unification of dRadioMenuItem and dCheckMenuItem in ticket
#1388.
Diff:
Modified: trunk/dabo/ui/uiwx/dMenuItem.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenuItem.py 2011-02-03 23:27:11 UTC (rev 6385)
+++ trunk/dabo/ui/uiwx/dMenuItem.py 2011-02-03 23:39:02 UTC (rev 6386)
@@ -209,14 +209,17 @@
DynamicHelpText = makeDynamicProperty(HelpText)
-
-class dCheckMenuItem(dMenuItem):
+class _AbstractExtendedMenuItem(dMenuItem):
"""Creates a checkbox-like item in a menu."""
def __init__(self, parent=None, properties=None, *args, **kwargs):
# Remove the 'Icon' property, as it interferes with the
'selected' display
+ if self.__class__ is _AbstractExtendedMenuItem:
+ raise dabo.dException.dException(
+ "dAbstractExtendedMenuItem class should not be
instantiated directly.")
+ # Remove the 'Icon' property, as it interferes with the
'selected' display
self._extractKey((properties, kwargs), "Icon")
- super(dCheckMenuItem, self).__init__(parent=parent,
properties=properties,
- *args, **kwargs)
+ super(_AbstractExtendedMenuItem, self).__init__(parent=parent,
+ properties=properties, *args, **kwargs)
def _getChecked(self):
@@ -233,27 +236,12 @@
_("Is this menu item checked? (bool)"))
+class dCheckMenuItem(_AbstractExtendedMenuItem):
+ """Creates a checkbox-like item in a menu."""
+ pass
-class dRadioMenuItem(dMenuItem):
+
+class dRadioMenuItem(_AbstractExtendedMenuItem):
"""Creates a radiobox-like item in a menu."""
- def __init__(self, parent=None, properties=None, *args, **kwargs):
- # Remove the 'Icon' property, as it interferes with the
'selected' display
- self._extractKey((properties, kwargs), "Icon")
- super(dRadioMenuItem, self).__init__(parent=parent,
properties=properties,
- *args, **kwargs)
+ pass
-
- def _getChecked(self):
- return self.IsChecked()
-
- def _setChecked(self, val):
- if self._constructed():
- self.Check(val)
- else:
- self._properties["Checked"] = val
-
-
- Checked = property(_getChecked, _setChecked, None,
- _("Is this menu item checked? (bool)"))
-
-
_______________________________________________
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]