本文整理汇总了Python中PyQt4.QtWebKit.QWebView方法的典型用法代码示例。如果您正苦于以下问题:Python QtWebKit.QWebView方法的具体用法?Python QtWebKit.QWebView怎么用?Python QtWebKit.QWebView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtWebKit
的用法示例。
在下文中一共展示了QtWebKit.QWebView方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_code
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def get_code(url, size=(640, 480), title="Google authentication"):
"""Open a QT webkit window and return the access code."""
app = QtGui.QApplication([])
dialog = QtGui.QDialog()
dialog.setWindowTitle(title)
dialog.resize(*size)
webview = QtWebKit.QWebView()
webpage = QtWebKit.QWebPage()
webview.setPage(webpage)
webpage.loadFinished.connect(lambda: _on_qt_page_load_finished(dialog, webview))
webview.setUrl(QtCore.QUrl.fromEncoded(url))
layout = QtGui.QGridLayout()
layout.addWidget(webview)
dialog.setLayout(layout)
dialog.authorization_code = None
dialog.show()
app.exec_()
return dialog.authorization_code
示例2: propose_rebuy_qt
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def propose_rebuy_qt(amount):
web = QWebView()
box = QMessageBox()
box.setFixedSize(200, 200)
credentials = read_local_oauth_credentials()
questionText = _('Rebuy ') + format_satoshis(amount) + _(' BTC?')
if credentials:
credentials.refresh()
if credentials and not credentials.invalid:
credentials.store_locally()
totalPrice = get_coinbase_total_price(credentials, amount)
questionText += _('\n(Price: ') + totalPrice + _(')')
if not question(box, questionText):
return
if credentials:
do_buy(credentials, amount)
else:
do_oauth_flow(web, amount)
return web
示例3: mainPyQt4Simple
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def mainPyQt4Simple():
# 必要なモジュールのimport
from PyQt4.QtCore import QUrl
from PyQt4.QtGui import QApplication
from PyQt4.QtWebKit import QWebView
url = 'https://github.com/tody411/PyIntroduction'
app = QApplication(sys.argv)
# QWebViewによるWebページ表示
browser = QWebView()
browser.load(QUrl(url))
browser.show()
sys.exit(app.exec_())
## PyQt4でのWebブラウザー作成(Youtube用).
示例4: setupUi
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def setupUi(self, ChangeLog):
ChangeLog.setObjectName(_fromUtf8("ChangeLog"))
ChangeLog.resize(714, 557)
self.verticalLayout = QtGui.QVBoxLayout(ChangeLog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.webView = QtWebKit.QWebView(ChangeLog)
self.webView.setUrl(QtCore.QUrl(_fromUtf8("about:blank")))
self.webView.setObjectName(_fromUtf8("webView"))
self.verticalLayout.addWidget(self.webView)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.buttonBox = QtGui.QDialogButtonBox(ChangeLog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.horizontalLayout.addWidget(self.buttonBox)
spacerItem = QtGui.QSpacerItem(600000, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.verticalLayout.addLayout(self.horizontalLayout)
self.retranslateUi(ChangeLog)
QtCore.QMetaObject.connectSlotsByName(ChangeLog)
示例5: __init__
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def __init__(self, mem, syms=None, parent=None):
QtWebKit.QWebView.__init__(self, parent=parent)
e_memcanvas.MemoryCanvas.__init__(self, mem, syms=syms)
self.setContent(e_q_html.template, 'application/xhtml+xml')
#self.setHtml(e_q_html.template)
frame = self.page().mainFrame()
self._canv_cache = None
self._canv_rend_middle = False
self._canv_curva = None
self._canv_rendtagid = '#memcanvas'
self._canv_hotkeys = {}
self.page().mainFrame().addToJavaScriptWindowObject('vnav', self)
示例6: keyPressEvent
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def keyPressEvent(self, event):
key = event.key()
txt = str(event.text())
#print 'KEY',hex(key),repr(txt)
mods = int(event.modifiers())
keytxt = ''
if key < 255:
keytxt = chr(key).lower()
if mods & QMOD_SHIFT:
keytxt = keytxt.upper()
if mods & QMOD_CTRL:
keytxt = 'ctrl+' + keytxt
#print 'KEYTXT: %s' % keytxt
handler = self._canv_hotkeys.get(keytxt)
if handler == None:
handler = self._canv_hotkeys.get(key)
if handler != None:
handler(self, key)
event.accept()
return QtWebKit.QWebView.keyPressEvent(self, event)
示例7: __init__
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def __init__(self, oa_url, oa_result_base, args):
super(OAuth2Application, self).__init__(args)
self.oa_result_base = oa_result_base
self.oa_result = oa_result_base
self.browser = QWebView()
self.browser.loadFinished.connect(self.__result_available)
self.browser.load(QUrl(oa_url))
self.browser.show()
self.exec_()
示例8: tryout_with_qt
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def tryout_with_qt():
import sys
from PyQt4 import QtCore, QtWebKit, QtWidgets
from os.path import join, dirname
import ibeis.viz
class Browser(QtWebKit.QWebView):
def __init__(self):
super(Browser, self).__init__()
self.loadFinished.connect(self._result_available)
def _result_available(self, ok):
pass
#frame = self.page().mainFrame()
#print(unicode(frame.toHtml()).encode('utf-8'))
app = QtWidgets.QApplication(sys.argv)
view = Browser()
view.show()
path = join(dirname(ibeis.viz.__file__), 'd3_example.html')
view.load(QtCore.QUrl(path))
view.page().settings().setAttribute(
QtWebKit.QWebSettings.DeveloperExtrasEnabled, True
)
insp = QtWebKit.QWebInspector()
insp.setPage(view.page())
insp.show()
app.exec_()
示例9: mainPyQt4Youtube
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def mainPyQt4Youtube():
# 必要なモジュールのimport
from PyQt4.QtCore import QUrl
from PyQt4.QtGui import QApplication
from PyQt4.QtWebKit import QWebView, QWebSettings
from PyQt4.QtNetwork import QNetworkProxyFactory
url = 'https://www.youtube.com/?hl=ja&gl=JP'
app = QApplication(sys.argv)
# Youtube動画を読み込むための設定
QNetworkProxyFactory.setUseSystemConfiguration(True)
QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True)
QWebSettings.globalSettings().setAttribute(QWebSettings.DnsPrefetchEnabled, True)
QWebSettings.globalSettings().setAttribute(QWebSettings.JavascriptEnabled, True)
QWebSettings.globalSettings().setAttribute(QWebSettings.OfflineStorageDatabaseEnabled, True)
QWebSettings.globalSettings().setAttribute(QWebSettings.AutoLoadImages, True)
QWebSettings.globalSettings().setAttribute(QWebSettings.LocalStorageEnabled, True)
QWebSettings.globalSettings().setAttribute(QWebSettings.PrivateBrowsingEnabled, True)
QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
# QWebViewによるWebページ表示
browser = QWebView()
browser.load(QUrl(url))
browser.setEnabled(True)
browser.show()
sys.exit(app.exec_())
## PyQt5でのWebブラウザー作成.
示例10: __init__
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def __init__(self, parent=None):
QWidget.__init__(self, parent, Qt.WindowStaysOnTopHint | Qt.Window)
self.setVisible(False)
self._view_help = QWebView(self)
self._view_help.load(resource_html("helppage.html"))
self._view_help.show()
f_layout = QHBoxLayout()
f_layout.addWidget(self._view_help)
self.setLayout(f_layout)
示例11: __init__
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def __init__(self):
QtWebKit.QWebView.__init__(self)
self.installEventFilter(self)
示例12: loadUrl
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def loadUrl(self, url):
view = QtWebKit.QWebView()
view.connect(view, QtCore.SIGNAL('loadFinished(bool)'), self.loadFinished)
view.connect(view, QtCore.SIGNAL('linkClicked(const QUrl&)'), self.linkClicked)
view.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
self.dbx_tabWidget.setCurrentIndex(self.dbx_tabWidget.addTab(view, 'loading...'))
view.load(url)
示例13: initUI
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def initUI(self):
self.browser = QtWebKit.QWebView()
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "help.html"))
local_url = QtCore.QUrl.fromLocalFile(file_path)
self.browser.load(local_url)
self.mainLayout = QtGui.QHBoxLayout()
self.mainLayout.addWidget(self.browser)
self.setLayout(self.mainLayout)
示例14: show_docs
# 需要导入模块: from PyQt4 import QtWebKit [as 别名]
# 或者: from PyQt4.QtWebKit import QWebView [as 别名]
def show_docs(self):
self.docs = QWebView()
self.docs.load(QUrl("https://pandapower.readthedocs.io"))
self.docs.setWindowTitle("pandapower Documentation")
self.docs.show()