dabo Commit
Revision 5581
Date: 2010-01-03 07:15:13 -0800 (Sun, 03 Jan 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5581
Changed:
U trunk/dabo/dApp.py
U trunk/dabo/ui/uiwx/__init__.py
Log:
Added the UIAppClass property to dApp. It can be set to a custom subclass of
dabo.ui.uiApp, to enable developers to add ui toolkit-specific behaviors.
Diff:
Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py 2009-12-30 15:57:01 UTC (rev 5580)
+++ trunk/dabo/dApp.py 2010-01-03 15:15:13 UTC (rev 5581)
@@ -327,11 +327,10 @@
self._initUI()
if self.UI is not None:
if self.showSplashScreen:
- #self.uiApp = dabo.ui.uiApp(self,
callback=self.initUIApp)
- self.uiApp = dabo.ui.getUiApp(self,
callback=self.initUIApp, forceNew=True)
+ self.uiApp = dabo.ui.getUiApp(self,
self.UIAppClass, callback=self.initUIApp, forceNew=True)
else:
#self.uiApp = dabo.ui.uiApp(self,
callback=None)
- self.uiApp = dabo.ui.getUiApp(self,
callback=None, forceNew=True)
+ self.uiApp = dabo.ui.getUiApp(self,
self.UIAppClass, callback=None, forceNew=True)
self.initUIApp()
else:
self.uiApp = None
@@ -364,6 +363,7 @@
for frm in self.formsToOpen:
frm(self.MainForm).show()
+
def initUIApp(self):
"""Callback from the initial app setup. Used to allow the
splash screen, if any, to be shown quickly.
@@ -1587,6 +1587,16 @@
raise RuntimeError(_("The UI cannot be reset once
assigned."))
+ def _getUIAppClass(self):
+ try:
+ return self._uiAppClass
+ except AttributeError:
+ return None
+
+ def _setUIAppClass(self, val):
+ self._uiAppClass = val
+
+
def _getUserSettingProvider(self):
try:
ret = self._userSettingProvider
@@ -1752,6 +1762,15 @@
This is the user interface library, such as 'wx' or
'tk'. Note that
'wx' is the only supported user interface library at
this point."""))
+ UIAppClass = property(_getUIAppClass, _setUIAppClass, None,
+ _("""The name of the ui-specific app subclass to
instantiate.
+
+ This will allow ui toolkit-specific behaviors to be
added to a Dabo
+ application. It MUST be either defined in the
application subclass, or
+ passed in the call to create the app object, since the
UI App cannot
+ be changed once the app is running. Defaults to
dabo.ui.uiApp
+ if not specified. (dabo.ui.uiApp)"""))
+
UserSettingProvider = property(_getUserSettingProvider,
_setUserSettingProvider, None,
_("""Specifies the reference to the object providing
user preference persistence.
Modified: trunk/dabo/ui/uiwx/__init__.py
===================================================================
--- trunk/dabo/ui/uiwx/__init__.py 2009-12-30 15:57:01 UTC (rev 5580)
+++ trunk/dabo/ui/uiwx/__init__.py 2010-01-03 15:15:13 UTC (rev 5581)
@@ -219,16 +219,18 @@
artConstants["file"] = artConstants.get("normalfile")
-def getUiApp(app, callback=None, forceNew=False):
+def getUiApp(app, uiAppClass=None, callback=None, forceNew=False):
"""This returns an instance of uiApp. If one is already running, that
instance is returned. Otherwise, a new instance is created.
"""
+ if uiAppClass is None:
+ uiAppClass = uiApp
if forceNew:
ret = None
else:
ret = wx.GetApp()
if ret is None:
- ret = uiApp(app, callback)
+ ret = uiAppClass(app, callback)
else:
# existing app; fire the callback, if any
if callback is not None:
_______________________________________________
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]