當前位置: 首頁>>代碼示例>>Python>>正文


Python QDesktopServices.openUrl方法代碼示例

本文整理匯總了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()
開發者ID:olav-st,項目名稱:screencloud-plugins,代碼行數:29,代碼來源:main.py

示例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
開發者ID:ximion,項目名稱:Clementine-LibDanceTag,代碼行數:11,代碼來源:youtube.py

示例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)
開發者ID:Nothing4You,項目名稱:screencloud-plugins,代碼行數:12,代碼來源:main.py

示例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()
開發者ID:Rocik,項目名稱:screencloud-plugins,代碼行數:16,代碼來源:main.py

示例5: Homepage

# 需要導入模塊: from PythonQt.QtGui import QDesktopServices [as 別名]
# 或者: from PythonQt.QtGui.QDesktopServices import openUrl [as 別名]
 def Homepage(self):
   QDesktopServices.openUrl(self.HOMEPAGE_URL)
開發者ID:ximion,項目名稱:Clementine-LibDanceTag,代碼行數:4,代碼來源:servicebase.py

示例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))
開發者ID:pathmann,項目名稱:pyTSon,代碼行數:4,代碼來源:filetransfer.py


注:本文中的PythonQt.QtGui.QDesktopServices.openUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。