Update of /cvsroot/pythonreports/PythonReports/PythonReports
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15994
Modified Files:
design.py
Log Message:
create automatic hotkeys in insertion menus
Index: design.py
===================================================================
RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** design.py 2 Nov 2006 18:42:21 -0000 1.2
--- design.py 2 Nov 2006 19:55:38 -0000 1.3
***************
*** 2,5 ****
--- 2,6 ----
"""History (most recent first):
+ 02-nov-2006 [als] create automatic hotkeys in insertion menus
02-nov-2006 [als] pop up menus on right-click and insert key in the list
31-oct-2006 [als] boolean property checkbuttons have grey background;
***************
*** 787,796 ****
_menu = Menu(self.report_menu, tearoff=False)
self.insert_menus[_tag] = _menu
for (_child, _restrict) in validator.children:
self.element_validators[(_tag, _child.tag)] = (_child, _restrict)
self.buildInsertionMenus(_child)
if _child.tag not in self.FIXED_TAGS:
! # FIXED_TAGS cannot be inserted
! self._build_menu_item(_menu, _child.tag,
command=lambda tag=_child.tag: self.insertNode(tag))
--- 788,806 ----
_menu = Menu(self.report_menu, tearoff=False)
self.insert_menus[_tag] = _menu
+ _hotkeys = set()
for (_child, _restrict) in validator.children:
self.element_validators[(_tag, _child.tag)] = (_child, _restrict)
self.buildInsertionMenus(_child)
+ # FIXED_TAGS cannot be inserted
if _child.tag not in self.FIXED_TAGS:
! # find the first letter of the element tag
! # not used as a hot key yet
! for (_underline, _letter) in enumerate(_child.tag):
! if _letter not in _hotkeys:
! _hotkeys.add(_letter)
! break
! else:
! _underline = -1
! self._build_menu_item(_menu, _child.tag, underline=_underline,
command=lambda tag=_child.tag: self.insertNode(tag))
|