Example #1
0
 def title(name):
     """Return a translated title for the name."""
     try:
         name = {
             # untranslated standard menu names
             'file': 'menu title|&File',
             'edit': 'menu title|&Edit',
             'view': 'menu title|&View',
             'insert': 'menu title|&Insert',
             'music': 'menu title|&Music',
             'lilypond': 'menu title|&LilyPond',
             'tools': 'menu title|&Tools',
             'window': 'menu title|&Window',
             'session': 'menu title|&Session',
             'help': 'menu title|&Help',
         }[name]
     except KeyError:
         pass
     if name.startswith('!'):
         removeAccel = False
         name = name[1:]
     else:
         removeAccel = True
     try:
         ctxt, msg = name.split('|', 1)
         translation = _(ctxt, msg)
     except ValueError:
         translation = _(name)
     if removeAccel:
         translation = qutil.removeAccelerator(translation).strip('.')
     return translation
Example #2
0
 def title(name):
     """Return a translated title for the name."""
     try:
         name = {
             # untranslated standard menu names
             'file': 'menu title|&File',
             'edit': 'menu title|&Edit',
             'view': 'menu title|&View',
             'snippets': 'menu title|Sn&ippets',
             'music': 'menu title|&Music',
             'lilypond': 'menu title|&LilyPond',
             'tools': 'menu title|&Tools',
             'window': 'menu title|&Window',
             'session': 'menu title|&Session',
             'help': 'menu title|&Help',
         }[name]
     except KeyError:
         pass
     if name.startswith('!'):
         removeAccel = False
         name = name[1:]
     else:
         removeAccel = True
     try:
         ctxt, msg = name.split('|', 1)
         translation = _(ctxt, msg)
     except ValueError:
         translation = _(name)
     if removeAccel:
         translation = qutil.removeAccelerator(translation).strip('.')
     return translation
Example #3
0
 def title(name):
     """Return a translated title for the name."""
     try:
         name = {
             # untranslated standard menu names
             "file": "menu title|&File",
             "edit": "menu title|&Edit",
             "view": "menu title|&View",
             "snippets": "menu title|Sn&ippets",
             "music": "menu title|&Music",
             "lilypond": "menu title|&LilyPond",
             "tools": "menu title|&Tools",
             "window": "menu title|&Window",
             "session": "menu title|&Session",
             "help": "menu title|&Help",
         }[name]
     except KeyError:
         pass
     if name.startswith("!"):
         removeAccel = False
         name = name[1:]
     else:
         removeAccel = True
     try:
         ctxt, msg = name.split("|", 1)
         translation = _(ctxt, msg)
     except ValueError:
         translation = _(name)
     if removeAccel:
         translation = qutil.removeAccelerator(translation).strip(".")
     return translation
Example #4
0
 def __init__(self, action, collection, name):
     QTreeWidgetItem.__init__(self)
     self.collection = collection
     self.name = name
     self.setIcon(0, action.icon())
     self.setText(0, qutil.removeAccelerator(action.text()))
     self._shortcuts = {}
Example #5
0
 def build_menu_item(action):
     """Return a QTreeWidgetItem with children for all the actions in the submenu."""
     menuitem = QTreeWidgetItem()
     text = qutil.removeAccelerator(action.text())
     menuitem.setText(0, _("Menu {name}").format(name=text))
     add_actions(menuitem, action.menu().actions())
     return menuitem
Example #6
0
 def build_menu_item(action):
     """Return a QTreeWidgetItem with children for all the actions in the submenu."""
     menuitem = QTreeWidgetItem()
     text = qutil.removeAccelerator(action.text())
     menuitem.setText(0, _("Menu {name}").format(name=text))
     add_actions(menuitem, action.menu().actions())
     return menuitem
Example #7
0
 def __init__(self, action, collection, name):
     QTreeWidgetItem.__init__(self)
     self.collection = collection
     self.name = name
     self.setIcon(0, action.icon())
     self.setText(0, qutil.removeAccelerator(action.text()))
     self._shortcuts = {}
 def findShortcutConflict(self, shortcut, skip):
     """Find the possible shortcut conflict and return the conflict name.
     
     skip must be a tuple (collection, name).
     it's the action to skip (the action that is about to be changed).
     
     """
     if shortcut:
         for data in self.iterShortcuts(skip):
             s1 = data[0]
             if s1.matches(shortcut) or shortcut.matches(s1):
                 return qutil.removeAccelerator(data[-1].text())
     return None
 def findShortcutConflict(self, shortcut, skip):
     """Find the possible shortcut conflict and return the conflict name.
     
     skip must be a tuple (collection, name).
     it's the action to skip (the action that is about to be changed).
     
     """
     if shortcut:
         for data in self.iterShortcuts(skip):
             s1 = data[0]
             if s1.matches(shortcut) or shortcut.matches(s1):
                 return qutil.removeAccelerator(data[-1].text())
     return None
Example #10
0
 def findShortcutConflict(self, shortcut):
     """Find the possible shortcut conflict and return the conflict name."""
     if shortcut:
         item = self.tree.currentItem()
         if not isinstance(item, ShortcutItem):
             return None
         scheme = self.scheme.currentScheme()
         for i in self.items():
             a = i.action(scheme)
             if i != item and a.shortcuts():
                 for s1 in a.shortcuts():
                     if s1.matches(shortcut) or shortcut.matches(s1):
                         return qutil.removeAccelerator(a.text())
     return None
Example #11
0
 def findShortcutConflict(self, shortcut):
     """Find the possible shortcut conflict and return the conflict name."""
     if shortcut:
         item = self.tree.currentItem()
         if not isinstance(item, ShortcutItem):
             return None
         scheme = self.scheme.currentScheme()
         for i in self.items():
             a = i.action(scheme)
             if i != item and a.shortcuts():
                 for s1 in a.shortcuts():
                     if s1.matches(shortcut) or shortcut.matches(s1):
                         return qutil.removeAccelerator(a.text())
     return None