Ejemplo n.º 1
0
    def mouseClickLinkIcon(self):
        """Follows the link"""
        if self.cmlRef.link is None:
            return

        # http://... an external browser will be invoked
        # https://... an external browser will be invoked
        # [file:]absolute path
        # [file:]relative path. The relative is tried to the current file
        #                       and then to the project root
        if self.cmlRef.link.startswith('http://') or \
           self.cmlRef.link.startswith('https://'):
            QDesktopServices.openUrl(QUrl(self.cmlRef.link))
            return

        fileName, anchorOrLine = resolveLinkPath(
            self.cmlRef.link, self.getEditor().getFileName())
        if fileName:
            GlobalData().mainWindow.openFile(fileName, anchorOrLine)
Ejemplo n.º 2
0
 def openInBrowser(self):
     """Triggered when a selected URL should be opened in a browser"""
     url = self.selectedText.strip()
     if url.lower().startswith("www."):
         url = "http://" + url
     QDesktopServices.openUrl(QUrl(url))