示例#1
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)
示例#2
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)
示例#3
0
 def edit():
     import editinplace
     editinplace.edit(panel.widget(), cursor, position)
示例#4
0
 def edit():
     import editinplace
     editinplace.edit(self._panel.widget(), cursor, position)