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)
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))
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)
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)
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")
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")
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))
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()))
def slotNewWindow(self, url): helpers.openUrl(url)
def open_in_browser(): import helpers helpers.openUrl(QUrl(link.url()))
def openLink(self, url): helpers.openUrl(QUrl(url))
def slotUnsupported(self, reply): helpers.openUrl(reply.url())
def slotAnchorClicked(self, url): url = self.source().resolved(url) if url.scheme() == "help": self.setSource(url) else: helpers.openUrl(url)
def actionTriggered(self, action): import helpers helpers.openUrl(QUrl.fromLocalFile(action.filename))
def openCurrentDirectory(self): helpers.openUrl(QUrl.fromLocalFile(self.currentDirectory()), "directory")
def openCommandPrompt(self): helpers.openUrl(QUrl.fromLocalFile(self.currentDirectory()), "shell")
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))
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))