Exemple #1
0
 def printMusic(self):
     doc = self.actionCollection.music_document_select.currentDocument()
     if doc and doc.document():
         ### temporarily disable printing on Mac OS X
         import sys
         if sys.platform.startswith('darwin'):
             from PyQt5.QtCore import QUrl
             from PyQt5.QtGui import QMessageBox
             result = QMessageBox.warning(
                 self.mainwindow(), _("Print Music"),
                 _("Unfortunately, this version of Frescobaldi is unable to print "
                   "PDF documents on Mac OS X due to various technical reasons.\n\n"
                   "Do you want to open the file in the default viewer for printing instead? "
                   "(remember to close it again to avoid access problems)\n\n"
                   "Choose Yes if you want that, No if you want to try the built-in "
                   "printing functionality anyway, or Cancel to cancel printing."
                   ), QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
             if result == QMessageBox.Yes:
                 import helpers
                 helpers.openUrl(QUrl.fromLocalFile(doc.filename()), "pdf")
                 return
             elif result == QMessageBox.Cancel:
                 return
         ### end temporarily disable printing on Mac OS X
         import popplerprint
         popplerprint.printDocument(doc, self)
Exemple #2
0
 def openLilyPondDatadir(self):
     """Menu action Open LilyPond Data Directory."""
     info = documentinfo.lilyinfo(self.mainwindow().currentDocument())
     datadir = info.datadir()
     if datadir:
         import helpers
         helpers.openUrl(QUrl.fromLocalFile(datadir))
Exemple #3
0
 def printMusic(self):
     doc = self.actionCollection.music_document_select.currentDocument()
     if doc and doc.document():
         ### temporarily disable printing on Mac OS X
         import sys
         if sys.platform.startswith('darwin'):
             from PyQt4.QtCore import QUrl
             from PyQt4.QtGui import QMessageBox
             result =  QMessageBox.warning(self.mainwindow(),
                 _("Print Music"), _(
                 "Unfortunately, this version of Frescobaldi is unable to print "
                 "PDF documents on Mac OS X due to various technical reasons.\n\n"
                 "Do you want to open the file in the default viewer for printing instead? "
                 "(remember to close it again to avoid access problems)\n\n"
                 "Choose Yes if you want that, No if you want to try the built-in "
                 "printing functionality anyway, or Cancel to cancel printing."),
                 QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
             if result == QMessageBox.Yes:
                 import helpers
                 helpers.openUrl(QUrl.fromLocalFile(doc.filename()), "pdf")
                 return
             elif result == QMessageBox.Cancel:
                 return
         ### end temporarily disable printing on Mac OS X
         import popplerprint
         popplerprint.printDocument(doc, self)
Exemple #4
0
 def slotLinkClicked(self, ev, page, link):
     """Called when the use clicks a link.
     
     If the links is a textedit link, opens the document and puts the cursor there.
     Otherwise, call the helpers module to open the destination.
     
     """
     if ev.button() == Qt.RightButton:
         return
     cursor = self._links.cursor(link, True)
     if cursor:
         if ev.modifiers() & Qt.ShiftModifier:
             import editinplace
             editinplace.edit(self, cursor, ev.globalPos())
         else:
             import browseriface
             mainwindow = self.parent().mainwindow()
             self._clicking_link = True
             browseriface.get(mainwindow).setTextCursor(cursor,
                                                        findOpenView=True)
             self._clicking_link = False
             import widgets.blink
             widgets.blink.Blinker.blink_cursor(mainwindow.currentView())
             mainwindow.activateWindow()
             mainwindow.currentView().setFocus()
     elif (isinstance(link, popplerqt5.Poppler.LinkBrowse)
           and not link.url().startswith('textedit:')):
         helpers.openUrl(QUrl(link.url()))
     elif (isinstance(link, popplerqt5.Poppler.LinkGoto)
           and not link.isExternal()):
         self.view.gotoPageNumber(link.destination().pageNumber() - 1)
Exemple #5
0
    def slotLinkClicked(self, ev, page, link):
        """Called when the use clicks a link.

        If the links is a textedit link, opens the document and puts the cursor there.
        Otherwise, call the helpers module to open the destination.

        """
        if ev.button() == Qt.RightButton:
            return
        cursor = self._links.cursor(link, True)
        if cursor:
            if ev.modifiers() & Qt.ShiftModifier:
                import editinplace
                editinplace.edit(self, cursor, ev.globalPos())
            else:
                import browseriface
                mainwindow = self.parent().mainwindow()
                self._clicking_link = True
                browseriface.get(mainwindow).setTextCursor(cursor, findOpenView=True)
                self._clicking_link = False
                import widgets.blink
                widgets.blink.Blinker.blink_cursor(mainwindow.currentView())
                mainwindow.activateWindow()
                mainwindow.currentView().setFocus()
        elif (isinstance(link, popplerqt5.Poppler.LinkBrowse)
              and not link.url().startswith('textedit:')):
            helpers.openUrl(QUrl(link.url()))
        elif (isinstance(link, popplerqt5.Poppler.LinkGoto)
              and not link.isExternal()):
            self.view.gotoPageNumber(link.destination().pageNumber() - 1)
Exemple #6
0
 def openLilyPondDatadir(self):
     """Menu action Open LilyPond Data Directory."""
     info = documentinfo.lilyinfo(self.mainwindow().currentDocument())
     datadir = info.datadir()
     if datadir:
         import helpers
         helpers.openUrl(QUrl.fromLocalFile(datadir))
Exemple #7
0
def email(subject, body):
    """Opens the e-mail composer with the given subject and body, with version information added to it."""
    subject = "[{0} {1}] {2}".format(appinfo.appname, appinfo.version, subject)
    body = "{0}\n\n{1}\n\n".format(debuginfo.version_info_string(' -- '), body)
    url = QUrl("mailto:" + appinfo.maintainer_email)
    url.addQueryItem("subject", subject)
    url.addQueryItem("body", body)
    helpers.openUrl(url, "email")
Exemple #8
0
def email(subject, body):
    """Opens the e-mail composer with the given subject and body, with version information added to it."""
    subject = "[{0} {1}] {2}".format(appinfo.appname, appinfo.version, subject)
    body = "{0}\n\n{1}\n\n".format(debuginfo.version_info_string(' -- '), body)
    url = QUrl("mailto:" + appinfo.maintainer_email)
    url.addQueryItem("subject", subject)
    url.addQueryItem("body", body)
    helpers.openUrl(url, "email")
Exemple #9
0
def email(subject, body, recipient=None):
    """Opens the e-mail composer with the given subject and body, with version information added to it."""
    subject = "[{0} {1}] {2}".format(appinfo.appname, appinfo.version, subject)
    body = "{0}\n\n{1}\n\n".format(debuginfo.version_info_string('\n'), body)
    address = recipient or appinfo.maintainer_email
    url = QUrl("mailto:" + address)
    query = QUrlQuery()
    query.addQueryItem("subject", subject)
    query.addQueryItem("body", body)
    url.setQuery(query)
    helpers.openUrl(url, "email")
Exemple #10
0
def email(subject, body, recipient=None):
    """Opens the e-mail composer with the given subject and body, with version information added to it."""
    subject = "[{0} {1}] {2}".format(appinfo.appname, appinfo.version, subject)
    body = "{0}\n\n{1}\n\n".format(debuginfo.version_info_string('\n'), body)
    address = recipient or appinfo.maintainer_email
    url = QUrl("mailto:" + address)
    query = QUrlQuery()
    query.addQueryItem("subject", subject)
    query.addQueryItem("body", body)
    url.setQuery(query)
    helpers.openUrl(url, "email")
Exemple #11
0
 def setCursor(self, url):
     """set cursor in source by clicked textedit link""" 
     t = textedit.link(url)
     if t:
         doc = self.document(t.filename, True)
         cursor = QtGui.QTextCursor(doc)
         b = doc.findBlockByNumber(t.line - 1)
         p = b.position() + t.column
         cursor.setPosition(p)
         mainwindow = self.mainwindow()
         mainwindow.setTextCursor(cursor)
         import widgets.blink
         widgets.blink.Blinker.blink_cursor(mainwindow.currentView())
         mainwindow.activateWindow()
         mainwindow.currentView().setFocus()
     else:
         import helpers
         helpers.openUrl(QtCore.QUrl(url))
Exemple #12
0
 def slotLinkClicked(self, ev, page, link):
     """Called when the use clicks a link.
     
     If the links is a textedit link, opens the document and puts the cursor there.
     Otherwise, call the helpers module to open the destination.
     
     """
     cursor = self._links.cursor(link, True)
     if cursor:
         mainwindow = self.parent().mainwindow()
         mainwindow.setTextCursor(cursor, findOpenView=True)
         import widgets.blink
         widgets.blink.Blinker.blink_cursor(mainwindow.currentView())
         
     elif (ev.button() != Qt.RightButton
           and isinstance(link, popplerqt4.Poppler.LinkBrowse)
           and not link.url().startswith('textedit:')):
         helpers.openUrl(QUrl(link.url()))
Exemple #13
0
 def slotNewWindow(self, url):
     helpers.openUrl(url)
Exemple #14
0
 def open_in_browser():
     import helpers
     helpers.openUrl(QUrl(link.url()))
Exemple #15
0
 def openLink(self, url):
     helpers.openUrl(QUrl(url))
Exemple #16
0
 def slotUnsupported(self, reply):
     helpers.openUrl(reply.url())
Exemple #17
0
 def slotAnchorClicked(self, url):
     url = self.source().resolved(url)
     if url.scheme() == "help":
         self.setSource(url)
     else:
         helpers.openUrl(url)
Exemple #18
0
 def actionTriggered(self, action):
     import helpers
     helpers.openUrl(QUrl.fromLocalFile(action.filename))
Exemple #19
0
 def openCurrentDirectory(self):
     helpers.openUrl(QUrl.fromLocalFile(self.currentDirectory()), "directory")
Exemple #20
0
 def openCommandPrompt(self):
     helpers.openUrl(QUrl.fromLocalFile(self.currentDirectory()), "shell")
Exemple #21
0
 def actionTriggered(self, action):
     import helpers
     helpers.openUrl(QUrl.fromLocalFile(action.filename))
Exemple #22
0
 def openLink(self, url):
     helpers.openUrl(QUrl(url))
Exemple #23
0
 def open_in_browser():
     import helpers
     helpers.openUrl(QUrl(link.url()))
Exemple #24
0
 def slotUnsupported(self, reply):
     helpers.openUrl(reply.url())
Exemple #25
0
    def click(self, url):
        """set cursor in source by clicked textedit link"""
        if not self.view.doTextEdit(url, True):
            import helpers

            helpers.openUrl(QUrl(url))
Exemple #26
0
 def click(self, url):
     """set cursor in source by clicked textedit link"""
     if not self.view.doTextEdit(url, True):
         import helpers
         helpers.openUrl(QtCore.QUrl(url))
Exemple #27
0
 def slotNewWindow(self, url):
     helpers.openUrl(url)
Exemple #28
0
 def openCurrentDirectory(self):
     helpers.openUrl(QUrl.fromLocalFile(self.currentDirectory()),
                     "directory")
Exemple #29
0
 def openCommandPrompt(self):
     helpers.openUrl(QUrl.fromLocalFile(self.currentDirectory()), "shell")