dabo Commit
Revision 6896
Date: 2011-10-12 15:38:59 -0700 (Wed, 12 Oct 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6896
Changed:
U trunk/dabo/dApp.py
U trunk/dabo/ui/uiwx/dFormMixin.py
U trunk/dabo/ui/uiwx/uiApp.py
Log:
Added ReleasePreferenceDialog property, default to True to match the old
behavior. Setting it to False allows keeping the preference dialog in
memory, only hiding it in between showings, for better performance.
Diff:
Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py 2011-10-12 21:51:40 UTC (rev 6895)
+++ trunk/dabo/dApp.py 2011-10-12 22:38:59 UTC (rev 6896)
@@ -1613,6 +1613,14 @@
self._preferenceDialogClass = val
+ def _getReleasePreferenceDialog(self):
+ ret = self._releasePreferenceDialog = getattr(self,
"_releasePreferenceDialog", True)
+ return ret
+
+ def _setReleasePreferenceDialog(self, val):
+ self._releasePreferenceDialog = bool(val)
+
+
def _getRemoteProxy(self):
if self.SourceURL:
try:
@@ -1850,6 +1858,13 @@
method, if any. Otherwise, the preference dialog will
be instantiated and
shown when the user chooses to see the preferences."""))
+ ReleasePreferenceDialog = property(_getReleasePreferenceDialog,
_setReleasePreferenceDialog, None,
+ _("""If False, the preference dialog will remain hidden
in memory after closed,
+ resulting in better performance when bringing up the
dialog more than once.
+
+ Note that you'll still have to handle intercepting your
dialog's Close event and
+ hiding it instead of releasing, or you'll be battling
dead object errors."""))
+
_RemoteProxy = property(_getRemoteProxy, None, None,
_("""If this bizobj is being run remotely, returns a
reference to the RemoteConnector
object that will handle communication with the server.
(read-only) (RemoteConnector)"""))
Modified: trunk/dabo/ui/uiwx/dFormMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dFormMixin.py 2011-10-12 21:51:40 UTC (rev 6895)
+++ trunk/dabo/ui/uiwx/dFormMixin.py 2011-10-12 22:38:59 UTC (rev 6896)
@@ -420,6 +420,9 @@
return False
# Run any cleanup code
self.closing()
+ pd = getattr(self, "_prefDialog", None)
+ if pd:
+ pd.release()
# Kill the form
self.Close(force=True)
# pkm: I've found that modal dialogs need Destroy():
Modified: trunk/dabo/ui/uiwx/uiApp.py
===================================================================
--- trunk/dabo/ui/uiwx/uiApp.py 2011-10-12 21:51:40 UTC (rev 6895)
+++ trunk/dabo/ui/uiwx/uiApp.py 2011-10-12 22:38:59 UTC (rev 6896)
@@ -804,7 +804,9 @@
af.onEditPreferences(evt)
except AttributeError:
if self.PreferenceDialogClass:
- dlgPref = self.PreferenceDialogClass(af)
+ dlgPref = getattr(af, "_prefDialog", None)
+ if dlgPref is None:
+ dlgPref = af._prefDialog =
self.PreferenceDialogClass(af)
if isinstance(dlgPref, PreferenceDialog):
if af:
af.fillPreferenceDialog(dlgPref)
@@ -833,8 +835,9 @@
if k in keysToRevert:
k.AutoPersist =
True
try:
- if dlgPref.Modal:
+ if self.dApp.ReleasePreferenceDialog
and dlgPref.Modal:
dlgPref.release()
+ del (af._prefDialog)
except dabo.ui.deadObjectException:
pass
else:
_______________________________________________
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]