当前位置: 首页>>代码示例>>Python>>正文


Python QDesktopServices.openUrl方法代码示例

本文整理汇总了Python中PySide.QtGui.QDesktopServices.openUrl方法的典型用法代码示例。如果您正苦于以下问题:Python QDesktopServices.openUrl方法的具体用法?Python QDesktopServices.openUrl怎么用?Python QDesktopServices.openUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QDesktopServices的用法示例。


在下文中一共展示了QDesktopServices.openUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: printPreview

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
	def printPreview(self):
		"""
		export to a temporary PDF file and open in the default pdf viewer

		Raises `NotImplemented` if print preview is not supported on this platform (yet?)
		"""
		pdf_file = NamedTemporaryFile(suffix='.pdf',delete=False)
		try:
			self.exportToPDF(pdf_file)

			"""
			#this clever pure-python implementation is probably not as portable as letting Qt handle it
			#though I'm not sure

			#get appropriate "document opener" program for the platform
			if 'linux' in sys.platform:
				prog_name = 'xdg-open'
			elif sys.platform == 'darwin': #Mac OS X
				prog_name = 'open'
			elif sys.platform == 'win32': #64 bit windows is still "win32"
				prog_name = 'start'
			else:
				raise NotImplemented('Your Platform (%s) does not support the print preview feature,'\
					'Export to PDF instead, please report this error' % sys.platform)
			subprocess.check_call([prog_name, pdf_file.name])
			"""

			QDesktopServices.openUrl(QUrl.fromLocalFile(pdf_file.name))
		finally:
			pdf_file.close()
开发者ID:Muizers,项目名称:Cards-Against-Sanity,代码行数:32,代码来源:cardsfile.py

示例2: link_click_handler

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
	def link_click_handler(self, url):
		if url.path() == u'blank':
			if url.hasFragment():
				if url.fragment() == u'quit':
					QApplication.instance().quit()
		else:			
			QDesktopServices.openUrl(url)
开发者ID:iyedb,项目名称:pyside_HNReader,代码行数:9,代码来源:mainwindow.py

示例3: www_view

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
 def www_view(self):
     """ 
     Context Menu Action.
     Opens the stream in a web page. 
     """
     if self.stream is not None:
         print "Opening %s in a web browser..." % self.stream
         QDesktopServices.openUrl(self.stream.url)
开发者ID:Joev-,项目名称:Streaman,代码行数:10,代码来源:streamlist.py

示例4: email_note

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
 def email_note(self):
     body = self.page.mainFrame().toPlainText()[
         len(self.title):
     ].strip()
     url = QUrl("mailto:")
     url.addQueryItem("subject", self.title)
     url.addQueryItem("body", body)
     QDesktopServices.openUrl(url)
开发者ID:RadixSeven,项目名称:everpad,代码行数:10,代码来源:content.py

示例5: event_link_clicked

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
	def event_link_clicked(self, url):
		url_string = url.toString()

		if 'file' in urlparse.parse_qs(urlparse.urlparse(url_string).query):
			msgbox = QMessageBox()
			msgbox.setWindowTitle('Installing')
			msgbox.setText('Installing theme. Please wait...')
			msgbox.setStandardButtons(0)
			msgbox.setAttribute(Qt.WA_DeleteOnClose)
			msgbox.setWindowModality(Qt.NonModal)
			msgbox.show()
			msgbox.repaint() # Qt didn't want to show the text so we force a repaint

			# Download and install the theme
			package = self.module.download('http://localhost/test/download.php?file=2800&name=Fat-flat.xpf')
			#package = self.module.download(url_string)
			try:
				self.module.install(package)
				msgbox.close()

				complete_msgbox = QMessageBox()
				complete_msgbox.setWindowTitle('Complete')
				complete_msgbox.setText('Install complete.')
				complete_msgbox.setStandardButtons(QMessageBox.Ok)
				complete_msgbox.setAttribute(Qt.WA_DeleteOnClose)
				complete_msgbox.exec_()
			except:
				msgbox.close()
				print "Unexpected error:", sys.exc_info()[:2]

				failed_msgbox = QMessageBox()
				failed_msgbox.setWindowTitle('Failed')
				failed_msgbox.setText('Install failed. Please try again later.')
				failed_msgbox.setStandardButtons(QMessageBox.Ok)
				failed_msgbox.setAttribute(Qt.WA_DeleteOnClose)
				failed_msgbox.exec_()
		else:
			QDesktopServices.openUrl(url)
开发者ID:kmklr72,项目名称:LMMS-Theme-Installer,代码行数:40,代码来源:module.py

示例6: on_open

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
 def on_open(self):
     if sys.platform.startswith('darwin'):
         url = '/Applications/Listen 1.app/Contents/MacOS/media/music/'
         QDesktopServices.openUrl(QUrl.fromLocalFile(url))
     else:
         QDesktopServices.openUrl(QUrl.fromLocalFile('./media/music'))
开发者ID:123de7,项目名称:listen1,代码行数:8,代码来源:shell_pyside.py

示例7: on_start

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
    def on_start(self):
        self.myProcess = MyWorkerThread()
        self.myProcess.start()

        QDesktopServices.openUrl('http://localhost:8888/')
开发者ID:123de7,项目名称:listen1,代码行数:7,代码来源:shell_pyside.py

示例8: openZipCodeTWAbout

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
 def openZipCodeTWAbout(self, *args, **kwargs):
     QDesktopServices.openUrl(QUrl('http://zipcode.mosky.tw/about'))
开发者ID:uranusjr,项目名称:qzipcoder,代码行数:4,代码来源:window.py

示例9: open_external_urls

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
def open_external_urls(url):
    QDesktopServices.openUrl(url)
开发者ID:jsteinbeck,项目名称:WebStory-Engine-LC,代码行数:4,代码来源:wse.py

示例10: _on_edit_export_style

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
 def _on_edit_export_style(self):
     file_path = os.path.join(
         QDesktopServices.storageLocation(QDesktopServices.DataLocation), 
         FORMAT_FILE)
     QDesktopServices.openUrl(QUrl.fromLocalFile(file_path))
开发者ID:Shonallein,项目名称:IrregularVerbsTestGenerator,代码行数:7,代码来源:irregularverbstestgenerator.py

示例11: acceptNavigationRequest

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
 def acceptNavigationRequest(self, frame, request, type):
     modifiers = QApplication.keyboardModifiers()
     if modifiers == Qt.ControlModifier and type == QWebPage.NavigationTypeLinkClicked:
         QDesktopServices.openUrl(request.url())
     return False
开发者ID:RadixSeven,项目名称:everpad,代码行数:7,代码来源:content.py

示例12: fetch_code

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
def fetch_code():
	url = "https://foursquare.com/oauth2/authenticate?client_id=" + foursquare.CLIENT_ID + "&response_type=code&redirect_uri=" + foursquare.CALLBACK_URI + "&display=touch"
	QDesktopServices.openUrl(QUrl(url, QUrl.StrictMode))
	httpd = HTTPServer(("localhost", 6060), Handler)
	httpd.handle_request()
开发者ID:Mad-Halfling,项目名称:ubersquare,代码行数:7,代码来源:foursquare_auth.py

示例13: _link_activated

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
 def _link_activated ( self, url ):
     """ Handles the user clicking on a hyperlink.
     """
     QDesktopServices.openUrl( QUrl( url ) )
     if self.factory.label != '':
         self.value = unicode( url )
开发者ID:davidmorrill,项目名称:facets,代码行数:8,代码来源:hyperlink_editor.py

示例14: show_uri

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
def show_uri(parent, link):
    from PySide.QtGui import QDesktopServices
    from PySide.QtCore import QUrl
    QDesktopServices.openUrl(QUrl(link, QUrl.TolerantMode))
开发者ID:eugenesan,项目名称:postman,代码行数:6,代码来源:helpers.py

示例15: redirect_to_permission_page

# 需要导入模块: from PySide.QtGui import QDesktopServices [as 别名]
# 或者: from PySide.QtGui.QDesktopServices import openUrl [as 别名]
def redirect_to_permission_page():
    QDesktopServices.openUrl(get_permission_url())
    quickstart(auth_server)
开发者ID:gitter-badger,项目名称:SHTR.proto,代码行数:5,代码来源:shoot.py


注:本文中的PySide.QtGui.QDesktopServices.openUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。