コード例 #1
0
ファイル: mainwindow.py プロジェクト: mbsrz1972/frescobaldi
 def populateRecentFilesMenu(self):
     self.menu_recent_files.clear()
     for url in recentfiles.urls():
         f = url.toLocalFile()
         dirname, basename = os.path.split(f)
         text = "{0}  ({1})".format(basename, util.homify(dirname))
         self.menu_recent_files.addAction(text).url = url
     util.addAccelerators(self.menu_recent_files.actions())
コード例 #2
0
ファイル: header.py プロジェクト: mbsrz1972/frescobaldi
 def translateUI(self):
     msg = _("Click to enter a value.")
     self.htmlView.setHtml(titles_html.format(
         copyrightmsg = _("bottom of first page"),
         taglinemsg = _("bottom of last page"),
         **dict((name, "<a title='{0}' href='{1}'>{2}</a>".format(msg, name, desc))
                 for name, desc in headers())))
     for name, desc in headers():
         self.labels[name].setText(desc + ":")
     # add accelerators to names, avoiding the tab names
     tabwidget = self.window().tabs
     used = filter(None, (util.getAccelerator(tabwidget.widget(i).title())
                          for i in range(tabwidget.count())))
     util.addAccelerators([self.labels[name] for name, desc in headers()], used)
コード例 #3
0
ファイル: menu.py プロジェクト: mbsrz1972/frescobaldi
 def populate(self):
     ac = manager.get(self.parentWidget()).actionCollection
     ag = self._actionGroup
     for a in ag.actions():
         if a is not ac.session_none:
             self.removeAction(a)
             ag.removeAction(a)
     ac.session_none.setChecked(not sessions.currentSession())
     for name in sessions.sessionNames():
         a = self.addAction(name.replace("&", "&&"))
         a.setCheckable(True)
         if name == sessions.currentSession():
             a.setChecked(True)
         a.setObjectName(name)
         ag.addAction(a)
     util.addAccelerators(self.actions())
コード例 #4
0
ファイル: __init__.py プロジェクト: mbsrz1972/frescobaldi
 def __init__(self, mainwindow):
     self.actionCollection = ac = Actions()
     actioncollectionmanager.manager(mainwindow).addActionCollection(ac)
     m = self.language_menu = QMenu()
     g = self.language_group = QActionGroup(None)
     for name in sorted(ly.pitch.pitchInfo.keys()):
         a = m.addAction(name.title())
         a.setObjectName(name)
         a.setCheckable(True)
         g.addAction(a)
     util.addAccelerators(m.actions())
     ac.pitch_language.setMenu(m)
     m.aboutToShow.connect(self.setLanguageMenu)
     g.triggered.connect(self.changeLanguage)
     ac.pitch_rel2abs.triggered.connect(self.rel2abs)
     ac.pitch_abs2rel.triggered.connect(self.abs2rel)
     ac.pitch_transpose.triggered.connect(self.transpose)
コード例 #5
0
ファイル: menu.py プロジェクト: mbsrz1972/frescobaldi
 def populate(self):
     """Populates the menu with snippet actions."""
     from . import model, snippets, actions
     last = self.insertBeforeAction()
     shortcuts = self.tool().snippetActions
     groups = {}
     for name in sorted(model.model().names()):
         variables = snippets.get(name).variables
         group = self.snippetGroup(variables)
         if group:
             action = actions.action(name, self.mainwindow(), shortcuts)
             self.visitAction(action, variables)
             groups.setdefault(group, []).append(action)
     for group in sorted(groups):
         for action in groups[group]:
             self.insertAction(last, action)
         self.insertSeparator(last)
     util.addAccelerators(self.actions())
コード例 #6
0
ファイル: result_menu.py プロジェクト: mbsrz1972/frescobaldi
 def populate(self):
     self.clear()
     doc = self.parentWidget().currentDocument()
     if doc:
         import resultfiles
         files = resultfiles.results(doc).files()
         first = True
         for group in util.group_files(files,
                 ('pdf', 'mid midi', 'svg svgz', 'png', '!ly ily lyi')):
             if group:
                 if not first:
                     self.addSeparator()
                 first = False
                 for f in group:
                     name = os.path.split(f)[1]
                     a = self.addAction(name)
                     a.setIcon(icons.file_type(f))
                     a.filename = f
         if not self.actions():
             a = self.addAction(_("No files available"))
             a.setEnabled(False)
         else:
             util.addAccelerators(self.actions())