Beispiel #1
0
    def __init__(self, mainwindow):
        """Instantiate the Panel Manager.

        In this method you should also load the modules that implement
        panel tools.

        """
        self._panels = []

        # add the the panel stubs here
        self.loadPanel("quickinsert.QuickInsertPanel")
        self.loadPanel("musicview.MusicViewPanel")
        self.loadPanel("svgview.SvgViewPanel")
        self.loadPanel("viewers.manuscript.ManuscriptViewPanel")
        self.loadPanel("logtool.LogTool")
        self.loadPanel("docbrowser.HelpBrowser")
        self.loadPanel("snippet.tool.SnippetTool")
        self.loadPanel("miditool.MidiTool")
        self.loadPanel("midiinput.tool.MidiInputTool")
        self.loadPanel("charmap.CharMap")
        self.loadPanel("doclist.DocumentList")
        self.loadPanel("outline.OutlinePanel")
        self.loadPanel("layoutcontrol.LayoutControlOptions")

        # The Object editor is highly experimental and should be
        # commented out for stable releases.
        if app.is_git_controlled() or QSettings().value(
                "experimental-features", False, bool):
            self.loadPanel("objecteditor.ObjectEditor")
        self.createActions()

        # make some default arrangements
        mainwindow.tabifyDockWidget(self.musicview, self.docbrowser)
        mainwindow.tabifyDockWidget(self.musicview, self.svgview)
Beispiel #2
0
def menu_file(mainwindow):
    m = Menu(_("menu title", "&File"), mainwindow)
    ac = mainwindow.actionCollection

    m.addAction(ac.file_new)
    m.addMenu(snippet.menu.TemplateMenu(mainwindow))
    m.addSeparator()
    m.addAction(ac.file_open)
    m.addAction(ac.file_open_recent)
    m.addAction(ac.file_close)
    m.addMenu(menu_file_close(mainwindow))
    m.addAction(ac.file_save)
    m.addMenu(menu_file_save(mainwindow))
    m.addSeparator()
    m.addMenu(menu_file_import(mainwindow))
    m.addMenu(menu_file_print(mainwindow))
    m.addSeparator()
    m.addAction(ac.file_reload)
    m.addAction(ac.file_reload_all)
    m.addAction(ac.file_external_changes)
    m.addSeparator()
    m.addAction(ac.file_quit)
    if app.is_git_controlled():
        m.addAction(ac.file_restart)
    return m
Beispiel #3
0
    def __init__(self, mainwindow):
        """Instantiate the Panel Manager.

        In this method you should also load the modules that implement
        panel tools.

        """
        self._panels = []

        # add the the panel stubs here
        self.loadPanel("quickinsert.QuickInsertPanel")
        self.loadPanel("musicview.MusicViewPanel")
        self.loadPanel("svgview.SvgViewPanel")
        self.loadPanel("viewers.manuscript.ManuscriptViewPanel")
        self.loadPanel("logtool.LogTool")
        self.loadPanel("docbrowser.HelpBrowser")
        self.loadPanel("snippet.tool.SnippetTool")
        self.loadPanel("miditool.MidiTool")
        self.loadPanel("midiinput.tool.MidiInputTool")
        self.loadPanel("charmap.CharMap")
        self.loadPanel("doclist.DocumentList")
        self.loadPanel("outline.OutlinePanel")
        self.loadPanel("layoutcontrol.LayoutControlOptions")

        # The Object editor is highly experimental and should be
        # commented out for stable releases.
        if app.is_git_controlled() or QSettings().value("experimental-features", False, bool):
            self.loadPanel("objecteditor.ObjectEditor")
        self.createActions()

        # make some default arrangements
        mainwindow.tabifyDockWidget(self.musicview, self.docbrowser)
        mainwindow.tabifyDockWidget(self.musicview, self.svgview)
Beispiel #4
0
 def svgLoaded(self):
     if not self.url().isEmpty() and not self.url().path().endswith(".html"):
         frame = self.page().mainFrame()
         frame.addToJavaScriptWindowObject("pyLinks", self.jslink)
         frame.evaluateJavaScript(getJsScript('pointandclick.js'))
         #for now only editable in dev (git) or when the user explicitly allows experimental features
         if app.is_git_controlled() or QSettings().value("experimental-features", False, bool):
             frame.evaluateJavaScript(getJsScript('editsvg.js'))
Beispiel #5
0
def menu_file_export(mainwindow):
    m = Menu(_("submenu title", "&Export"), mainwindow)
    ac = mainwindow.actionCollection
    acfe = file_export.FileExport.instance(mainwindow).actionCollection

    if app.is_git_controlled() or QSettings().value("experimental-features", False, bool):
        m.addAction(acfe.export_audio)
        m.addAction(acfe.export_musicxml)
    m.addAction(ac.export_colored_html)
    return m
Beispiel #6
0
def menu_file_export(mainwindow):
    m = Menu(_("submenu title", "&Export"), mainwindow)
    ac = mainwindow.actionCollection
    acfe = file_export.FileExport.instance(mainwindow).actionCollection

    if app.is_git_controlled() or QSettings().value("experimental-features", False, bool):
        m.addAction(acfe.export_audio)
        m.addAction(acfe.export_musicxml)
    m.addAction(ac.export_colored_html)
    return m
Beispiel #7
0
def createMenus(mainwindow):
    """Adds all the menus to the mainwindow's menubar."""
    m = mainwindow.menuBar()

    m.addMenu(menu_file(mainwindow))
    m.addMenu(menu_edit(mainwindow))
    m.addMenu(menu_view(mainwindow))
    m.addMenu(menu_music(mainwindow))
    m.addMenu(menu_snippets(mainwindow))
    m.addMenu(menu_lilypond(mainwindow))
    m.addMenu(menu_tools(mainwindow))
    m.addMenu(menu_document(mainwindow))
    m.addMenu(menu_window(mainwindow))
    m.addMenu(menu_session(mainwindow))
    if app.is_git_controlled():
        from vcs.menu import GitMenu
        m.addMenu(GitMenu(mainwindow))
    m.addMenu(menu_help(mainwindow))
Beispiel #8
0
def createMenus(mainwindow):
    """Adds all the menus to the mainwindow's menubar."""
    m = mainwindow.menuBar()

    m.addMenu(menu_file(mainwindow))
    m.addMenu(menu_edit(mainwindow))
    m.addMenu(menu_view(mainwindow))
    m.addMenu(menu_music(mainwindow))
    m.addMenu(menu_snippets(mainwindow))
    m.addMenu(menu_lilypond(mainwindow))
    m.addMenu(menu_tools(mainwindow))
    m.addMenu(menu_document(mainwindow))
    m.addMenu(menu_window(mainwindow))
    m.addMenu(menu_session(mainwindow))
    if app.is_git_controlled():
        from vcs.menu import GitMenu
        m.addMenu(GitMenu(mainwindow))
    m.addMenu(menu_help(mainwindow))
Beispiel #9
0
def version_info_named():
    """Yield all the relevant names and their version string."""
    yield appinfo.appname, appinfo.version
    yield "Python", python_version()
    if app.is_git_controlled():
        import vcs
        repo = vcs.app_repo
        yield "Git branch", repo.active_branch()
        commit = repo.run_command('log', ['-n', '1', '--format=format:%h'])
        yield "on commit", commit[0]
    yield "python-ly", ly_version()
    yield "Qt", qt_version()
    yield "PyQt", pyqt_version()
    yield "sip", sip_version()
    yield "poppler", poppler_version()
    yield "python-poppler-qt", python_poppler_version()
    yield "OS", operating_system()
    if sys.platform.startswith('darwin'):
        yield "installation kind", mac_installation_kind()
Beispiel #10
0
def menu_file(mainwindow):
    m = Menu(_("menu title", "&File"), mainwindow)
    ac = mainwindow.actionCollection

    m.addAction(ac.file_new)
    m.addAction(
        scorewiz.ScoreWizard.instance(mainwindow).actionCollection.scorewiz)
    m.addMenu(snippet.menu.TemplateMenu(mainwindow))
    m.addSeparator()
    m.addAction(ac.file_open)
    m.addAction(ac.file_open_recent)
    m.addAction(ac.file_insert_file)
    m.addSeparator()
    m.addAction(ac.file_save)
    m.addAction(ac.file_save_as)
    m.addAction(ac.file_save_copy_as)
    m.addAction(ac.file_rename)
    m.addAction(
        panelmanager.manager(
            mainwindow).snippettool.actionCollection.file_save_as_template)
    m.addAction(ac.file_save_all)
    m.addSeparator()
    m.addAction(ac.file_reload)
    m.addAction(ac.file_reload_all)
    m.addAction(ac.file_external_changes)
    m.addSeparator()
    m.addMenu(menu_file_import(mainwindow))
    m.addMenu(menu_file_export(mainwindow))
    m.addSeparator()
    m.addAction(
        panelmanager.manager(
            mainwindow).musicview.actionCollection.music_print)
    m.addAction(ac.file_print_source)
    m.addSeparator()
    m.addAction(ac.file_close)
    m.addAction(ac.file_close_other)
    m.addAction(ac.file_close_all)
    m.addSeparator()
    m.addAction(ac.file_quit)
    if app.is_git_controlled():
        m.addAction(ac.file_restart)
    return m
Beispiel #11
0
 def initJavaScript(self):
     """Return a string containing all JavaScript to run in a page."""
     try:
         return self._initJavaScript
     except AttributeError:
         js = []
         qwebchannel_js = QFile(':/qtwebchannel/qwebchannel.js')
         qwebchannel_js.open(QIODevice.ReadOnly)
         js.append(bytes(qwebchannel_js.readAll()).decode('utf-8'))
         js.append(
             "new QWebChannel(qt.webChannelTransport, function (channel) {\n"
             " window.pyLinks = channel.objects.pyLinks;\n"
             "});\n")
         js.append(getJsScript('pointandclick.js'))
         # for now only editable in dev (git) or when the user explicitly allows experimental features
         if app.is_git_controlled() or QSettings().value(
                 "experimental-features", False, bool):
             js.append(getJsScript('editsvg.js'))
         self._initJavaScript = '\n'.join(js)
     return self._initJavaScript
Beispiel #12
0
def version_info_named():
    """Yield all the relevant names and their version string."""
    yield appinfo.appname, appinfo.version
    yield "Python", python_version()
    if app.is_git_controlled():
        import vcs
        repo = vcs.app_repo
        yield "Git branch", repo.active_branch()
        commit = repo.run_command(
            'log',
            ['-n', '1', '--format=format:%h'])
        yield "on commit", commit[0]
    yield "python-ly", ly_version()
    yield "Qt", qt_version()
    yield "PyQt", pyqt_version()
    yield "sip", sip_version()
    yield "poppler", poppler_version()
    yield "python-poppler-qt", python_poppler_version()
    yield "OS", operating_system()
    if sys.platform.startswith('darwin'):
        yield "installation kind", mac_installation_kind()
Beispiel #13
0
def menu_file(mainwindow):
    m = Menu(_("menu title", "&File"), mainwindow)
    ac = mainwindow.actionCollection

    m.addAction(ac.file_new)
    m.addAction(scorewiz.ScoreWizard.instance(mainwindow).actionCollection.scorewiz)
    m.addMenu(snippet.menu.TemplateMenu(mainwindow))
    m.addSeparator()
    m.addAction(ac.file_open)
    m.addAction(ac.file_open_recent)
    m.addAction(ac.file_insert_file)
    m.addSeparator()
    m.addAction(ac.file_save)
    m.addAction(ac.file_save_as)
    m.addAction(ac.file_save_copy_as)
    m.addAction(ac.file_rename)
    m.addAction(panelmanager.manager(mainwindow).snippettool.actionCollection.file_save_as_template)
    m.addAction(ac.file_save_all)
    m.addSeparator()
    m.addAction(ac.file_reload)
    m.addAction(ac.file_reload_all)
    m.addAction(ac.file_external_changes)
    m.addSeparator()
    m.addMenu(menu_file_import(mainwindow))
    m.addMenu(menu_file_export(mainwindow))
    m.addSeparator()
    m.addAction(panelmanager.manager(mainwindow).musicview.actionCollection.music_print)
    m.addAction(ac.file_print_source)
    m.addSeparator()
    m.addAction(ac.file_close)
    m.addAction(ac.file_close_other)
    m.addAction(ac.file_close_all)
    m.addSeparator()
    m.addAction(ac.file_quit)
    if app.is_git_controlled():
        m.addAction(ac.file_restart)
    return m