本文整理汇总了Python中PyQt5.QtGui.QDesktopServices.openUrl方法的典型用法代码示例。如果您正苦于以下问题:Python QDesktopServices.openUrl方法的具体用法?Python QDesktopServices.openUrl怎么用?Python QDesktopServices.openUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QDesktopServices
的用法示例。
在下文中一共展示了QDesktopServices.openUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connectSlots
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
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)
示例2: _update_dwarf
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
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()
示例3: openWebUI
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
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'])))
示例4: mousePressEvent
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
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))
示例5: hyperlink_activated
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def hyperlink_activated(self, link):
QDesktopServices.openUrl(QUrl(link))
示例6: on_action_open_log_file_triggered
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def on_action_open_log_file_triggered(self, checked):
if os.path.exists(self.app_config.log_file):
ret = QDesktopServices.openUrl(QUrl("file:///%s" % self.app_config.log_file))
if not ret:
self.warnMsg('Could not open "%s" file using a default OS application.' % self.app_config.log_file)
示例7: on_lblMessage_linkActivated
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def on_lblMessage_linkActivated(self, link):
if link.lower().find('http') >= 0:
QDesktopServices.openUrl(QUrl(link))
else:
for m_id in self.app_messages:
if str(m_id) == link:
self.del_app_message(int(link))
break
示例8: on_edt_recipients_anchorClicked
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def on_edt_recipients_anchorClicked(self, link):
if self.fn_show_address_on_hw:
url = link.url()
if re.match('^\d+$', url):
row_idx = int(url)
if 0 <= row_idx < len(self.tx_outputs):
self.fn_show_address_on_hw(self.tx_outputs[row_idx].address_ref)
else:
QDesktopServices.openUrl(link)
示例9: _openUrl
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def _openUrl(self, url: QUrl) -> None:
QDesktopServices.openUrl(url)
示例10: startAuthorizationFlow
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def startAuthorizationFlow(self, force_browser_logout: bool = False) -> None:
"""Start the flow to become authenticated. This will start a new webbrowser tap, prompting the user to login."""
Logger.log("d", "Starting new OAuth2 flow...")
# Create the tokens needed for the code challenge (PKCE) extension for OAuth2.
# This is needed because the CuraDrivePlugin is a untrusted (open source) client.
# More details can be found at https://tools.ietf.org/html/rfc7636.
verification_code = self._auth_helpers.generateVerificationCode()
challenge_code = self._auth_helpers.generateVerificationCodeChallenge(verification_code)
state = AuthorizationHelpers.generateVerificationCode()
# Create the query dict needed for the OAuth2 flow.
query_parameters_dict = {
"client_id": self._settings.CLIENT_ID,
"redirect_uri": self._settings.CALLBACK_URL,
"scope": self._settings.CLIENT_SCOPES,
"response_type": "code",
"state": state, # Forever in our Hearts, RIP "(.Y.)" (2018-2020)
"code_challenge": challenge_code,
"code_challenge_method": "S512"
}
# Start a local web server to receive the callback URL on.
try:
self._server.start(verification_code, state)
except OSError:
Logger.logException("w", "Unable to create authorization request server")
Message(i18n_catalog.i18nc("@info", "Unable to start a new sign in process. Check if another sign in attempt is still active."),
title=i18n_catalog.i18nc("@info:title", "Warning")).show()
return
auth_url = self._generate_auth_url(query_parameters_dict, force_browser_logout)
# Open the authorization page in a new browser window.
QDesktopServices.openUrl(QUrl(auth_url))
示例11: _showConfigurationFolder
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def _showConfigurationFolder(self):
path = Resources.getConfigStoragePath()
QDesktopServices.openUrl(QUrl.fromLocalFile( path ))
示例12: openPrintJobControlPanel
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def openPrintJobControlPanel(self) -> None:
QDesktopServices.openUrl(QUrl(self.clusterCloudUrl))
示例13: openPrinterControlPanel
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def openPrinterControlPanel(self) -> None:
QDesktopServices.openUrl(QUrl(self.clusterCloudUrl))
示例14: _onConfigureClicked
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def _onConfigureClicked(self, messageId: str, actionId: str) -> None:
QDesktopServices.openUrl(QUrl("http://{}/print_jobs".format(self._address)))
self.hide()
示例15: openPrintJobControlPanel
# 需要导入模块: from PyQt5.QtGui import QDesktopServices [as 别名]
# 或者: from PyQt5.QtGui.QDesktopServices import openUrl [as 别名]
def openPrintJobControlPanel(self) -> None:
QDesktopServices.openUrl(QUrl("http://" + self._address + "/print_jobs"))