Exemplo n.º 1
0
	def _setHotKey(self, evt):
		dlg = HotKeyEditor(self)
		itm = self._selectedItem
		origKey = itm.hotkey
		dlg.setKey(origKey)
		dlg.show()
		if dlg.Accepted:
			hk = dlg.KeyText
			change = (hk != origKey)
			dupeItem = None
			if change:
				dupeItem = self._hotKeyMap.get(hk)
				if dupeItem and (dupeItem is not itm):
					msg = _("This key combination is assigned to the menu command '%s'. " +
							"Do you wish to re-assign it to the command '%s'?") % (cleanMenuCaption(dupeItem.Caption, "&_"),
							cleanMenuCaption(itm.Caption, "&_"))
					change = dabo.ui.areYouSure(msg, title=_("Duplicate Keystroke"), defaultNo=True,
							cancelButton=False)
			if change:
				if dupeItem:
					# Un-assign that hotkey
					dupeItem.HotKey = None
					# Clear it from the tree
					nd = self.menuKeyAssignmentTree.nodeForObject(dupeItem)
					if nd:
						nd.hotkey = None
				if origKey:
					self._hotKeyMap.pop(origKey)
				if hk:
					# Set the internal key map.
					self._hotKeyMap[hk] = itm.Object
				self.txtMenuCurrentHotKey.Value = itm.hotkey = itm.Object.HotKey = hk
				itm.pref.setValue("hotkey", hk)
		dlg.release()
		self.pgMenuKeys.update()
Exemplo n.º 2
0
 def editHotKey(self, objs, prop, val):
     obj = objs[0]
     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:
         keyText = dlg.KeyText
         if keyText is None:
             keyText = ""
         # Setting the HotKey prop should update the related sub-props.
         obj.HotKey = keyText
         self.updateVal(prop, keyText, unicode)
         self.propGrid.CurrentValue = keyText
         self.propGrid.refresh()
     dlg.release()
	def editHotKey(self, objs, prop, val):
		obj = objs[0]
		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:
			keyText = dlg.KeyText
			if keyText is None:
				keyText = ""
			# Setting the HotKey prop should update the related sub-props.
			obj.HotKey = keyText
			self.updateVal(prop, keyText, unicode)
			self.propGrid.CurrentValue = keyText
			self.propGrid.refresh()
		dlg.release()