本文整理汇总了Python中PythonQt.QtGui.QDesktopServices.openUrl方法的典型用法代码示例。如果您正苦于以下问题:Python QDesktopServices.openUrl方法的具体用法?Python QDesktopServices.openUrl怎么用?Python QDesktopServices.openUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PythonQt.QtGui.QDesktopServices
的用法示例。
在下文中一共展示了QDesktopServices.openUrl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startAuthenticationProcess
# 需要导入模块: from PythonQt.QtGui import QDesktopServices [as 别名]
# 或者: from PythonQt.QtGui.QDesktopServices import openUrl [as 别名]
def startAuthenticationProcess(self):
self.settingsDialog.group_account.widget_authorize.button_authenticate.setEnabled(False)
self.flow = dropbox.oauth.DropboxOAuth2FlowNoRedirect('sfacmqvdb9dn66r', 'hx8meda636xgsox')
authorize_url = QUrl(self.flow.start())
QDesktopServices.openUrl(authorize_url)
try:
code = raw_input("Enter the authorization code from the dropbox website:")
except NameError:
code = input("Enter the authorization code from the dropbox website:")
if code:
try:
oauth2_result = self.flow.finish(code)
self.access_token = oauth2_result.access_token
self.client = dropbox.Dropbox(self.access_token)
account = self.client.users_get_current_account()
self.user_id = account.account_id
self.display_name = account.name.display_name
except dropbox.auth.AccessError:
if "win" in sys.platform: #Workaround for crash on windows
self.parentWidget.hide()
self.settingsDialog.hide()
QMessageBox.critical(self.settingsDialog, "Failed to authenticate", "Failed to authenticate with Dropbox. Wrong code?")
if "win" in sys.platform:
self.settingsDialog.show()
self.parentWidget.show()
self.saveSettings()
self.updateUi()
示例2: SearchFinished
# 需要导入模块: from PythonQt.QtGui import QDesktopServices [as 别名]
# 或者: from PythonQt.QtGui.QDesktopServices import openUrl [as 别名]
def SearchFinished():
data = json.loads(str(reply.readAll()))
feed = data["feed"]
try:
print feed["entry"][0]["media$group"]["media$player"][0]["url"]
youtube_url = feed["entry"][0]["media$group"]["media$player"][0]["url"]
QDesktopServices.openUrl(QUrl.fromEncoded(str(youtube_url)))
except Exception, e:
print e
示例3: startAuthenticationProcess
# 需要导入模块: from PythonQt.QtGui import QDesktopServices [as 别名]
# 或者: from PythonQt.QtGui.QDesktopServices import openUrl [as 别名]
def startAuthenticationProcess(self):
self.saveSettings()
self.loadSettings()
self.settingsDialog.group_account.button_authenticate.setEnabled(False)
self.settingsDialog.group_account.label_code.setEnabled(True)
self.settingsDialog.group_account.input_code.setEnabled(True)
self.settingsDialog.group_account.button_code.setEnabled(True)
auth_url = self.imgur.authorization_url('pin')
QDesktopServices.openUrl(QUrl(auth_url))
self.settingsDialog.group_account.button_code.connect("clicked()", self.pinEntered)
示例4: startAuthenticationProcess
# 需要导入模块: from PythonQt.QtGui import QDesktopServices [as 别名]
# 或者: from PythonQt.QtGui.QDesktopServices import openUrl [as 别名]
def startAuthenticationProcess(self):
self.saveSettings()
self.loadSettings()
auth_url = self.imgur.authorization_url('pin')
QDesktopServices.openUrl(QUrl(auth_url))
pin = raw_input("Enter PIN from imgur website:")
if pin:
try:
self.access_token, self.refresh_token = self.imgur.exchange_pin(pin)
except KeyError as e:
QMessageBox.critical(self.settingsDialog, "Imgur key error", "Failed to exchange pin. " + e.message)
self.access_token, self.username = self.imgur.refresh_access_token()
self.saveSettings()
self.updateUi()
示例5: Homepage
# 需要导入模块: from PythonQt.QtGui import QDesktopServices [as 别名]
# 或者: from PythonQt.QtGui.QDesktopServices import openUrl [as 别名]
def Homepage(self):
QDesktopServices.openUrl(self.HOMEPAGE_URL)
示例6: on_downloaddirButton_clicked
# 需要导入模块: from PythonQt.QtGui import QDesktopServices [as 别名]
# 或者: from PythonQt.QtGui.QDesktopServices import openUrl [as 别名]
def on_downloaddirButton_clicked(self):
QDesktopServices.openUrl(QUrl(self.downloaddir))