1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.ui'
#
# Created: Sat Jul 18 00:32:48 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui, QtWebKit
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(808, 639)
self.gridLayout = QtGui.QGridLayout(Form)
self.gridLayout.setObjectName("gridLayout")
self.webView = QtWebKit.QWebView(Form)
self.webView.setUrl(QtCore.QUrl("about:blank"))
self.webView.setObjectName("webView")
self.gridLayout.addWidget(self.webView, 0, 0, 1, 2)
spacerItem = QtGui.QSpacerItem(395, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem, 1, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(Form)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 1, 1, 1, 1)
self.retranslateUi(Form)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Form.close)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.print_html)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
def print_html(self):
text = self.webView.page().mainFrame().toHtml()
self.webView.setHtml(text, QtCore.QUrl("http://mixi.jp/"))
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
Form = QtGui.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
ui.webView.setUrl(QtCore.QUrl("http://mixi.jp/"))
sys.exit(app.exec_()) |
Partager