Python PyQt5.QtGui.QDesktopServices.openUrl() Examples

The following are 30 code examples of PyQt5.QtGui.QDesktopServices.openUrl(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtGui.QDesktopServices , or try the search function .
Example #1
Source File: tdmgr.py    From tdm with GNU General Public License v3.0 6 votes vote down vote up
def openWebUI(self):
        if self.device and self.device.p.get('IPAddress'):
            url = QUrl("http://{}".format(self.device.p['IPAddress']))

            try:
                webui = QWebEngineView()
                webui.load(url)

                frm_webui = QFrame()
                frm_webui.setWindowTitle("WebUI [{}]".format(self.device.p['FriendlyName1']))
                frm_webui.setFrameShape(QFrame.StyledPanel)
                frm_webui.setLayout(VLayout(0))
                frm_webui.layout().addWidget(webui)
                frm_webui.destroyed.connect(self.updateMDI)

                self.mdi.addSubWindow(frm_webui)
                self.mdi.setViewMode(QMdiArea.TabbedView)
                frm_webui.setWindowState(Qt.WindowMaximized)

            except NameError:
                QDesktopServices.openUrl(QUrl("http://{}".format(self.device.p['IPAddress']))) 
Example #2
Source File: main.py    From PyQt5-Apps with GNU General Public License v3.0 6 votes vote down vote up
def connectSlots(self):
        """connect slots with buttons/
        short cuts/signals
        """
        # home tab
        self.download.clicked.connect(self.downloadSound)
        self.download.setShortcut("CTRL+L")

        self.search.clicked.connect(self.searchInfo)
        self.search.setShortcut("CTRL+Return")

        self.toolButton.clicked.connect(
            lambda: QDesktopServices.openUrl(QUrl.fromLocalFile("./sound"))
        )

        # self.clearBtn.clicked.connect(self.clearAllDownloaded) 
Example #3
Source File: welcome_window.py    From Dwarf with GNU General Public License v3.0 6 votes vote down vote up
def _update_dwarf(self):
        path_to_version = os.path.join(self._base_path, os.pardir, os.pardir, 'VERSION')
        if not os.path.exists(path_to_version):
            if utils.is_connected():
                try:
                    # file exists in dwarf >2.0.0 wich means update from 1.x to 2.x
                    request = requests.get('https://raw.githubusercontent.com/iGio90/Dwarf/master/VERSION')
                    if request.ok:
                        utils.show_message_box('This update will break your Dwarf installation!\nSee GitHub for more infos')
                        from PyQt5.QtCore import QUrl
                        from PyQt5.QtGui import QDesktopServices
                        QDesktopServices.openUrl(QUrl('https://github.com/iGio90/Dwarf'))
                        return
                except:
                    pass

        self._update_thread = DwarfUpdateThread(self)
        self._update_thread.on_finished.connect(self._update_finished)
        if not self._update_thread.isRunning():
            self._update_thread.start() 
Example #4
Source File: app.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def _menu_documentation(self):
        QDesktopServices.openUrl(QUrl('http://www.giovanni-rocca.com/dwarf/')) 
Example #5
Source File: Utilities.py    From Uranium with GNU Lesser General Public License v3.0 5 votes vote down vote up
def openUrl(self, target_url: str, allowed_schemes: List[str]) -> bool:
        """
        Opens the target_url if it has an allowed and valid scheme. This function can be called inside QML files.

        :param target_url: The URL string to be opened e.g. 'https://example.org'
        :param allowed_schemes: A list of the schemes that are allowed to be opened e.g. ['http', 'https']
        :return: True if the URL opens successfully, False if an invalid scheme is used
        """
        if self._urlHasValidScheme(target_url, allowed_schemes):
            QDesktopServices.openUrl(QUrl(target_url))
            return True
        return False 
Example #6
Source File: LocalFileOutputDevice.py    From Uranium with GNU Lesser General Public License v3.0 5 votes vote down vote up
def _onMessageActionTriggered(self, message, action):
        if action == "open_folder" and hasattr(message, "_folder"):
            QDesktopServices.openUrl(QUrl.fromLocalFile(message._folder)) 
Example #7
Source File: UpdateChecker.py    From Uranium with GNU Lesser General Public License v3.0 5 votes vote down vote up
def _onActionTriggered(self, message, action):
        """Callback function for the "download" button on the update notification.

        This function is here is because the custom Signal in Uranium keeps a list of weak references to its
        connections, so the callback functions need to be long-lived. The UpdateCheckerJob is short-lived so
        this function cannot be there.
        """
        if action == "download":
            if self._download_url is not None:
                QDesktopServices.openUrl(QUrl(self._download_url))
        elif action == "new_features":
            QDesktopServices.openUrl(QUrl(Application.getInstance().change_log_url)) 
Example #8
Source File: archive_tab.py    From vorta with GNU General Public License v3.0 5 votes vote down vote up
def cell_double_clicked(self, row, column):
        if column == 3:
            archive_name = self.selected_archive_name()
            if not archive_name:
                return

            mount_point = self.mount_points.get(archive_name)

            if mount_point is not None:
                QDesktopServices.openUrl(QtCore.QUrl(f'file:///{mount_point}')) 
Example #9
Source File: updater.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def releases_page(self) -> None:
        QDesktopServices.openUrl(self.releases_url) 
Example #10
Source File: notifications.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def playMedia(self) -> None:
        if os.path.isfile(self.filename):
            QDesktopServices.openUrl(QUrl.fromLocalFile(self.filename)) 
Example #11
Source File: videocutter.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def viewLogs() -> None:
        QDesktopServices.openUrl(QUrl.fromLocalFile(logging.getLoggerClass().root.handlers[0].baseFilename)) 
Example #12
Source File: desktop.py    From parsec-cloud with GNU Affero General Public License v3.0 5 votes vote down vote up
def open_file(path):
    QDesktopServices.openUrl(QUrl.fromLocalFile(QFileInfo(path).absoluteFilePath())) 
Example #13
Source File: desktop.py    From parsec-cloud with GNU Affero General Public License v3.0 5 votes vote down vote up
def open_url(url):
    QDesktopServices.openUrl(QUrl(url)) 
Example #14
Source File: gui.py    From lanzou-gui with MIT License 5 votes vote down vote up
def open_wiki_url(self):
        # 打开使用说明页面
        url = QUrl('https://github.com/rachpt/lanzou-gui/wiki')
        if not QDesktopServices.openUrl(url):
            self.show_status('Could not open wiki page!', 5000) 
Example #15
Source File: app.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def _menu_github(self):
        QDesktopServices.openUrl(QUrl('https://github.com/iGio90/Dwarf')) 
Example #16
Source File: app.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def _menu_api(self):
        QDesktopServices.openUrl(QUrl('https://igio90.github.io/Dwarf/')) 
Example #17
Source File: DiscoverRepetierAction.py    From RepetierIntegration with GNU Affero General Public License v3.0 5 votes vote down vote up
def openWebPage(self, url: str) -> None:
        QDesktopServices.openUrl(QUrl(url)) 
Example #18
Source File: app.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def _menu_slack(self):
        QDesktopServices.openUrl(
            QUrl('https://join.slack.com/t/resecret/shared_invite'
                 '/enQtMzc1NTg4MzE3NjA1LTlkNzYxNTIwYTc2ZTYyOWY1MT'
                 'Q1NzBiN2ZhYjQwYmY0ZmRhODQ0NDE3NmRmZjFiMmE1MDYwN'
                 'WJlNDVjZDcwNGE')) 
Example #19
Source File: RepetierOutputDevice.py    From RepetierIntegration with GNU Affero General Public License v3.0 5 votes vote down vote up
def _openRepetierPrint(self, message_id: Optional[str] = None, action_id: Optional[str] = None) -> None:
        QDesktopServices.openUrl(QUrl(self._base_url)) 
Example #20
Source File: main.py    From mint-amazon-tagger with GNU General Public License v3.0 5 votes vote down vote up
def open_amazon_order_id(self, order_id):
        if order_id:
            QDesktopServices.openUrl(QUrl(
                amazon.get_invoice_url(order_id))) 
Example #21
Source File: qt.py    From mint-amazon-tagger with GNU General Public License v3.0 5 votes vote down vote up
def open_amazon_order_id(self, order_id):
        if order_id:
            QDesktopServices.openUrl(QUrl(
                amazon.get_invoice_url(order_id))) 
Example #22
Source File: util.py    From artisan with GNU General Public License v3.0 5 votes vote down vote up
def sendLog():
    config.logger.info("util:sendLog()")
    from email import encoders, generator
    from email.mime.base import MIMEBase
    from email.mime.multipart import MIMEMultipart
    from email.mime.text import MIMEText
    message = MIMEMultipart()
    if config.app_window.plus_email is not None:
        message['From'] = config.app_window.plus_email
    message["To"] = "{}@{}".format(config.log_file_account,config.log_file_domain)
    message["Subject"] = "artisan.plus client log"
    message["X-Unsent"] = "1"
    #message["X-Uniform-Type-Identifier"] = "com.apple.mail-draft"
    message.attach(MIMEText("Please find attached the artisan.plus log file written by Artisan!\nPlease forward this email to {}\n--\n".format(message["To"]), "plain"))
    with open(config.log_file_path, "rb") as attachment:
        # Add file as application/octet-stream
        # Email client can usually download this automatically as attachment
        part = MIMEBase("application", "octet-stream")
        part.set_payload(attachment.read())
    # Encode file in ASCII characters to send by email
    encoders.encode_base64(part)
    # Add header as key/value pair to attachment part
    part.add_header(
        "Content-Disposition",
        "attachment; filename= {}{}".format(config.log_file,".log"))
    # Add attachment to message and convert message to string
    message.attach(part)    
    # Save message to file tmp file
    tmpfile = QDir(QDir.tempPath()).filePath("plus-log.eml")
    try:
        os.remove(tmpfile)
    except OSError:
        pass
    with open(tmpfile, 'w') as outfile:
        gen = generator.Generator(outfile)
        gen.flatten(message)
    QDesktopServices.openUrl(QUrl.fromLocalFile(tmpfile)) 
Example #23
Source File: DirectoryTreeView.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def on_open_explorer_action_triggered(self):
        file_path = self.model().get_file_path(self.rootIndex())
        QDesktopServices.openUrl(QUrl.fromLocalFile(file_path)) 
Example #24
Source File: desktop.py    From gridsync with GNU General Public License v3.0 5 votes vote down vote up
def _desktop_open(path):
    QDesktopServices.openUrl(QUrl.fromLocalFile(path)) 
Example #25
Source File: main.py    From crazyflie-clients-python with GNU General Public License v2.0 5 votes vote down vote up
def _open_config_folder(self):
        QDesktopServices.openUrl(
            QUrl("file:///" +
                 QDir.toNativeSeparators(cfclient.config_path))) 
Example #26
Source File: __init__.py    From corrscope with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def on_open_config_dir(self):
        appdata_uri = qc.QUrl.fromLocalFile(str(paths.appdata_dir))
        QDesktopServices.openUrl(appdata_uri) 
Example #27
Source File: __init__.py    From corrscope with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def on_action_website(self):
        website_url = r"https://github.com/corrscope/corrscope/"
        QDesktopServices.openUrl(qc.QUrl(website_url)) 
Example #28
Source File: __init__.py    From corrscope with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def on_action_help(self):
        help_url = r"https://corrscope.github.io/corrscope/"
        QDesktopServices.openUrl(qc.QUrl(help_url)) 
Example #29
Source File: NotClusterHostMessage.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
def _onConfigureClicked(self, messageId: str, actionId: str) -> None:
        QDesktopServices.openUrl(QUrl("http://{}/print_jobs".format(self._address)))
        self.hide() 
Example #30
Source File: HelpButton.py    From pyleecan with Apache License 2.0 5 votes vote down vote up
def mousePressEvent(self, event=None):
        """Open the help link in the default browser

        Parameters
        ----------
        self :
            A HelpButton object
        event :
             (Default value = None)

        Returns
        -------

        """
        QDesktopServices.openUrl(QUrl(self.url))