示例#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 vcs.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)
示例#2
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 vcs.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)
示例#3
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 vcs.app_is_git_controlled() or QSettings().value("experimental-features", False, bool):
             frame.evaluateJavaScript(getJsScript("editsvg.js"))
示例#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 vcs.app_is_git_controlled() or QtCore.QSettings().value("experimental-features", False, bool):
             frame.evaluateJavaScript(getJsScript('editsvg.js')) 
示例#5
0
def menu_file_export(mainwindow):
    m = Menu(_("submenu title", "&Export"), mainwindow)
    ac = mainwindow.actionCollection
    acfe = file_export.FileExport.instance(mainwindow).actionCollection
    
    if vcs.app_is_git_controlled():
        m.addAction(acfe.export_musicxml)
    m.addAction(ac.export_colored_html)
    return m
示例#6
0
def menu_file_export(mainwindow):
    m = Menu(_("submenu title", "&Export"), mainwindow)
    ac = mainwindow.actionCollection
    acfe = file_export.FileExport.instance(mainwindow).actionCollection
    
    if vcs.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
示例#7
0
def menu_file_export(mainwindow):
    m = Menu(_("submenu title", "&Export"), mainwindow)
    ac = mainwindow.actionCollection
    acfe = file_export.FileExport.instance(mainwindow).actionCollection
    
    if vcs.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
示例#8
0
def menu_file_export(mainwindow):
    m = Menu(_("submenu title", "&Export"), mainwindow)
    ac = mainwindow.actionCollection
    acfe = file_export.FileExport.instance(mainwindow).actionCollection

    m.addAction(acfe.export_audio)
    if vcs.app_is_git_controlled():
        m.addAction(acfe.export_musicxml)
    m.addAction(ac.export_colored_html)
    return m
示例#9
0
def menu_tools_pitch(mainwindow):
    m = Menu(_('submenu title', "&Pitch"), mainwindow)
    m.setIcon(icons.get('tools-pitch'))
    ac = pitch.Pitch.instance(mainwindow).actionCollection
    
    m.addAction(ac.pitch_language)
    m.addSeparator()
    m.addAction(ac.pitch_rel2abs)
    m.addAction(ac.pitch_abs2rel)
    m.addSeparator()
    m.addAction(ac.pitch_transpose)
    m.addAction(ac.pitch_modal_transpose)
    if vcs.app_is_git_controlled() or QSettings().value("experimental-features", False, bool):
        m.addAction(ac.pitch_mode_shift)
    return m
示例#10
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 vcs.app_is_git_controlled():
        from vcs.menu import GitMenu
        m.addMenu(GitMenu(mainwindow))
    m.addMenu(menu_help(mainwindow))
示例#11
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 vcs.app_is_git_controlled():
        from vcs.menu import GitMenu
        m.addMenu(GitMenu(mainwindow))
    m.addMenu(menu_help(mainwindow))
示例#12
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(
        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 vcs.app_is_git_controlled():
        m.addAction(ac.file_restart)
    return m
示例#13
0
 def updateWindowTitle(self):
     doc = self.currentDocument()
     name = []
     if sessions.currentSession():
         name.append(sessions.currentSession() + ':')
     if doc:
         if doc.url().isEmpty():
             name.append(doc.documentName())
         elif doc.url().toLocalFile():
             name.append(util.homify(doc.url().toLocalFile()))
         else:
             name.append(doc.url().toString())
         if doc.isModified():
             # L10N: state of document in window titlebar
             name.append(_("[modified]"))
     
     window_title = app.caption(" ".join(name))
     
     if vcs.app_is_git_controlled():
         window_title += " " + vcs.app_active_branch_window_title()
     
     self.setWindowTitle(window_title)
示例#14
0
    def updateWindowTitle(self):
        doc = self.currentDocument()
        name = []
        if sessions.currentSession():
            name.append(sessions.currentSession() + ':')
        if doc:
            if doc.url().isEmpty():
                name.append(doc.documentName())
            elif doc.url().toLocalFile():
                name.append(util.homify(doc.url().toLocalFile()))
            else:
                name.append(doc.url().toString())
            if doc.isModified():
                # L10N: state of document in window titlebar
                name.append(_("[modified]"))

        window_title = app.caption(" ".join(name))

        if vcs.app_is_git_controlled():
            window_title += " " + vcs.app_active_branch_window_title()

        self.setWindowTitle(window_title)
示例#15
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.addAction(scorewiz.ScoreWizard.instance(mainwindow).actionCollection.newwithwiz)
    m.addSeparator()
    m.addAction(ac.file_open)
    m.addAction(ac.file_open_recent)
    m.addAction(ac.file_insert_file)
    m.addAction(documentactions.get(mainwindow).actionCollection.file_open_file_at_cursor)
    m.addSeparator()
    m.addAction(ac.file_save)
    m.addAction(ac.file_save_as)
    m.addAction(ac.file_save_copy_as)
    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 vcs.app_is_git_controlled():
        m.addAction(ac.file_restart)
    return m
示例#16
0
文件: app.py 项目: zsalch/frescobaldi
def is_git_controlled():
    global _is_git_controlled
    if _is_git_controlled is None:
        import vcs
        _is_git_controlled = vcs.app_is_git_controlled()
    return _is_git_controlled
示例#17
0
def is_git_controlled():
    global _is_git_controlled
    if _is_git_controlled is None:
        import vcs
        _is_git_controlled = vcs.app_is_git_controlled()
    return _is_git_controlled