dabo Commit
Revision 4374
Date: 2008-08-07 12:06:24 -0700 (Thu, 07 Aug 2008)
Author: Nate
Trac: http://svn.dabodev.com/trac/dabo/changeset/4374
Changed:
U trunk/dabo/ui/dialogs/PreferenceDialog.py
Log:
This commit fixes some problems with the menu hot key editor in the preference
pages. First, fixed the issue where the clear key button wasn't getting
updated after clear and set events. Second, if you cleared a key using the
clear key button, that key wasn't clear from the hotkey map so if you tried to
set a control with the cleared key combo, it would give you an erroneous
warning. Fixed that. Last, if you clicked the cancel button, you menu changes
were not rolled back. Fixed that.
Diff:
Modified: trunk/dabo/ui/dialogs/PreferenceDialog.py
===================================================================
--- trunk/dabo/ui/dialogs/PreferenceDialog.py 2008-08-07 18:30:03 UTC (rev
4373)
+++ trunk/dabo/ui/dialogs/PreferenceDialog.py 2008-08-07 19:06:24 UTC (rev
4374)
@@ -31,7 +31,7 @@
# Set up a list of functions to call when the user clicks 'OK'
to accept changes,
# and one for functions to call when the user cancels.
self.callOnAccept = []
- self.callOnCancel = []
+ self.callOnCancel = [self.onRollbackMenuChanges]
# Create a list of preference key objects that will be have
their AutoPersist turned
# off when the dialog is shown, and either canceled or
persisted, depending
# on the user's action.
@@ -146,6 +146,7 @@
self._recurseMenu(mn, nd, menukey)
menuPage.Sizer.append1x(tree, border=10)
root.expand()
+ self._originalHotKeyMap = self._hotKeyMap.copy()
sz = dabo.ui.dGridSizer(MaxCols=2, HGap=5, VGap=10)
lbl = dabo.ui.dLabel(menuPage, Caption=_("Current
Key:"))
@@ -231,6 +232,7 @@
self.txtMenuCurrentHotKey.Value = itm.hotkey =
itm.Object.HotKey = hk
itm.pref.setValue("hotkey", hk)
dlg.release()
+ self.pgMenuKeys.update()
def _canSetHotKey(self):
@@ -240,15 +242,22 @@
def _clearHotKey(self, evt):
itm = self._selectedItem
+ self._hotKeyMap.pop(itm.hotkey)
self.txtMenuCurrentHotKey.Value = itm.hotkey =
itm.Object.HotKey = None
itm.pref.setValue("hotkey", None)
-
+ self.pgMenuKeys.update()
def _canClearHotKey(self):
itm = self._selectedItem
return (itm is not None) and (itm.hotkey not in ("n/a", None))
-
-
+
+
+ def onRollbackMenuChanges(self):
+ km = self._originalHotKeyMap
+ for key in km.keys():
+ km[key].HotKey = key
+
+
def _addFrameworkPages(self):
"""Called when no other code exists to fill the dialog, or when
the class's IncludeFrameworkPages property is True.
_______________________________________________
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]