本文整理匯總了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))