本文整理汇总了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()
示例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)
示例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)
示例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)
示例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)
示例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'))
示例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/')
示例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'))
示例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)
示例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))
示例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
示例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()
示例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 )
示例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))
示例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)