daboide Commit
Revision 894
Date: 2007-10-12 08:52:44 -0700 (Fri, 12 Oct 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/daboide/changeset/894
Changed:
U trunk/ClassDesignerPropSheet.py
Log:
Modified to use the new HotKeyEditor class.
Diff:
Modified: trunk/ClassDesignerPropSheet.py
===================================================================
--- trunk/ClassDesignerPropSheet.py 2007-10-07 18:31:01 UTC (rev 893)
+++ trunk/ClassDesignerPropSheet.py 2007-10-12 15:52:44 UTC (rev 894)
@@ -46,7 +46,7 @@
self._selected = []
# Holds a reference to the custom editor method
self._custEditor = None
- self.setInitialSizing()
+ dabo.ui.callAfter(self.setInitialSizing)
dabo.ui.callAfter(self.layout)
@@ -590,69 +590,20 @@
def editHotKey(self, objs, prop, val):
obj = objs[0]
- class HotKeyDialog(dabo.ui.dOkCancelDialog):
- def addControls(self):
- self.Caption = "HotKey Editor"
- self.keyCode = -1
- self.keyChar = ""
- self.keyText = ""
- sz = self.Sizer
- sz.append(dabo.ui.dLabel(self, Caption="Press
the desired key combination"),
- border=10, halign="center")
- sz.appendSpacer(10)
- bsz = dabo.ui.dBorderSizer(self, "v")
- self.hkLabel = dabo.ui.dLabel(self, Caption="
"*80, FontSize=16, FontBold=True)
- bsz.append1x(self.hkLabel, halign="center",
border=10)
- sz.append(bsz, halign="center")
- # Pass key events from the OK/Cancel buttons up
to the form
- self.CancelButton.bindEvent(dEvents.KeyUp,
self.onKeyUp)
- self.OKButton.bindEvent(dEvents.KeyUp,
self.onKeyUp)
-
- def setKey(self, key):
- self.hotKeyString = self.hkLabel.Caption = key
- self.changed = False
-
- def onKeyUp(self, evt):
- self.kcd = evt.keyCode
- if self.kcd in (306, 307, 308, 400):
- # Just the modifier keys being released
- return
- if self.kcd in (dKeys.key_Tab, dKeys.key_Left,
dKeys.key_Right,
- dKeys.key_Up,
dKeys.key_Down, dKeys.key_Return):
- # Navigation keys; ignore
- return
- self.kcr = evt.keyChar
- if 342 <= self.kcd <= 356:
- # Function keys
- self.kcr = "F%s" % ((self.kcd-341), )
- self.ctl = dabo.ui.isControlDown() or
dabo.ui.isCommandDown()
- self.shift = dabo.ui.isShiftDown()
- self.alt = dabo.ui.isAltDown()
- if self.kcr is not None:
- ctlTxt = {True: "Ctrl+", False:
""}[self.ctl]
- shiftTxt = {True: "Shift+", False:
""}[self.shift]
- altTxt = {True: "Alt+", False:
""}[self.alt]
- self.keyText = ctlTxt + altTxt +
shiftTxt + self.kcr.upper()
- else:
- self.keyText = ""
- self.kcr = ""
- self.hkLabel.Caption = self.keyText
- self.layout()
- self.changed = True
-
- dlg = HotKeyDialog(self)
+ from dabo.ui.dialogs.HotKeyEditor import HotKeyEditor
+ dlg = HotKeyEditor(self)
dlg.setKey(obj.HotKey)
dlg.Centered = True
dlg.show()
- if dlg.Accepted and dlg.changed:
- obj.HotKey = dlg.keyText
+ if dlg.Accepted and dlg.Changed:
+ obj.HotKey = dlg.KeyText
# Set the sub-props
- obj.HotKeyChar = dlg.kcr.upper()
- obj.HotKeyControl = dlg.ctl
- obj.HotKeyShift = dlg.shift
- obj.HotKeyAlt = dlg.alt
- self.updateVal(prop, dlg.keyText, unicode)
- self.propGrid.CurrentValue = dlg.keyText
+ obj.HotKeyChar = dlg.KeyChar.upper()
+ obj.HotKeyControl = dlg.Ctrl
+ obj.HotKeyShift = dlg.Shift
+ obj.HotKeyAlt = dlg.Alt
+ self.updateVal(prop, dlg.KeyText, unicode)
+ self.propGrid.CurrentValue = dlg.KeyText
self.propGrid.refresh()
dlg.release()
_______________________________________________
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]