dabo Commit
Revision 3200
Date: 2007-06-22 11:07:20 -0700 (Fri, 22 Jun 2007)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/3200

Changed:
U   trunk/dabo/dApp.py
U   trunk/dabo/ui/uiwx/uiApp.py

Log:
Added property dApp.PreferenceDialogClass so developers can write their own
user-preference dialog and then when the user chooses to show it, dApp will
handle that.

Removed the delegation to uiApp, as that should never be necessary.


Diff:
Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py  2007-06-22 17:00:34 UTC (rev 3199)
+++ trunk/dabo/dApp.py  2007-06-22 18:07:20 UTC (rev 3200)
@@ -646,11 +646,19 @@
                self.uiApp.onEditFindAgain(evt)
        def onShowSizerLines(self, evt):
                self.uiApp.onShowSizerLines(evt)
+
        def onEditPreferences(self, evt):
                try:
                        self.ActiveForm.onEditPreferences(evt)
                except:
-                       self.uiApp.onEditPreferences(evt)
+                       if self.PreferenceDialogClass:
+                               dlgPref = self.PreferenceDialogClass()
+                               dlgPref.show()
+                               if dlgPref.Modal:
+                                       dlgPref.release()
+                       else:
+                               dabo.infoLog.write(_("Stub: 
dApp.onEditPreferences()"))
+
        # These handle MRU menu requests
        def addToMRU(self, menu, prmpt, bindfunc=None, *args, **kwargs):
                self.uiApp.addToMRU(menu, prmpt, bindfunc, *args, **kwargs)
@@ -863,6 +871,13 @@
                        return "?"
 
 
+       def _getPreferenceDialogClass(self):
+               return getattr(self, "_preferenceDialogClass", None)
+
+       def _setPreferenceDialogClass(self, val):
+               self._preferenceDialogClass = val
+
+
        def _getSearchDelay(self):
                try:
                        return self._searchDelay
@@ -1038,6 +1053,13 @@
                        _("""Returns the platform we are running on. This will 
be 
                        one of 'Mac', 'Win' or 'GTK'.  (str)""") )
 
+       PreferenceDialogClass = property(_getPreferenceDialogClass, 
_setPreferenceDialogClass, None,
+                       _("""Specifies the dialog to use for the application's 
user preferences.
+
+                       If None, the application will try to run the active 
form's onEditPreferences()
+                       method, if any. Otherwise, the preference dialog will 
be instantiated and 
+                       shown when the user chooses to see the preferences."""))
+
        SearchDelay = property(_getSearchDelay, _setSearchDelay, None,
                        _("""Specifies the delay before incrementeal searching 
begins.  (int)
 

Modified: trunk/dabo/ui/uiwx/uiApp.py
===================================================================
--- trunk/dabo/ui/uiwx/uiApp.py 2007-06-22 17:00:34 UTC (rev 3199)
+++ trunk/dabo/ui/uiwx/uiApp.py 2007-06-22 18:07:20 UTC (rev 3200)
@@ -450,11 +450,7 @@
                                win = None
                return ret
                
-               
-       def onEditPreferences(self, evt):
-               dabo.infoLog.write(_("Stub: uiApp.onEditPreferences()"))
 
-
        def onEditUndo(self, evt):
                if self.ActiveForm:
                        hasCode = self.ActiveForm.onEditUndo(evt)




_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]

Reply via email to