本文整理汇总了Python中PyQt5.QtWebEngineWidgets.QWebEngineView.setHtml方法的典型用法代码示例。如果您正苦于以下问题:Python QWebEngineView.setHtml方法的具体用法?Python QWebEngineView.setHtml怎么用?Python QWebEngineView.setHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWebEngineWidgets.QWebEngineView
的用法示例。
在下文中一共展示了QWebEngineView.setHtml方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print_to_pdf
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
def print_to_pdf(html, pdf_file):
from PyQt5.QtCore import QUrl
from PyQt5 import QtGui, QtCore
global qapp
if qapp is None:
qapp = QApplication(['--disable-gpu', '--disable-extension'])
view = QWebEngineView()
page = QWebEnginePage()
view.setPage(page)
def pdf_printed(*args, **kwargs):
page.pdfPrintingFinished.disconnect()
page.loadFinished.disconnect()
qapp.quit()
def page_loaded(*args, **kwargs):
page.pdfPrintingFinished.connect(pdf_printed)
page.printToPdf(
pdf_file,
QtGui.QPageLayout(
QtGui.QPageSize(QtGui.QPageSize.A4), QtGui.QPageLayout.Portrait, QtCore.QMarginsF(25, 25, 25, 25)
)
)
page.loadFinished.connect(page_loaded)
if isinstance(html, bytes):
html = html.decode('utf-8')
view.setHtml(html, QUrl('file://'))
qapp.exec_()
return os.path.basename(pdf_file)
示例2: Example
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
class Example(QWidget):
def __init__(self):
super().__init__()
self.resize(640, 320)
self.setWindowTitle('PyQt-5 WebEngine')
page = "https://www.google.com"
self.url = QLineEdit(page)
self.url.setPlaceholderText(page)
self.go = QPushButton("Ir")
self.go.clicked.connect(self.btnIrClicked)
self.nav_bar = QHBoxLayout()
self.nav_bar.addWidget(self.url)
self.nav_bar.addWidget(self.go)
self.progress = QProgressBar()
self.progress.setValue(0)
html = """
<!DOCTYPE HTML>
<html>
<head>
<title>Example Local HTML</title>
</head>
<body>
<p>Este es un archivo <code>HTML</code> local.</p>
<p>Si deseas acceder página indica su <code>URL</code> y presiona <b>Ir</b></p>
</body>
</html>
"""
self.web_view = QWebEngineView()
self.web_view.loadProgress.connect(self.webLoading)
self.web_view.setHtml(html)
root = QVBoxLayout()
root.addLayout(self.nav_bar)
root.addWidget(self.web_view)
root.addWidget(self.progress)
self.setLayout(root)
def btnIrClicked(self, event):
url = QUrl(self.url.text())
self.web_view.page().load(url)
def webLoading(self, event):
self.progress.setValue(event)
示例3: __init__
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
def __init__(self, title, html_text, width=650, height=400, parent=None):
QtWidgets.QDialog.__init__(self, parent)
self.setModal(True)
self.setWindowTitle(title)
layout = QtWidgets.QVBoxLayout(self)
web_view = QWebView(self)
web_view.setHtml(html_text)
text_area = QtWidgets.QScrollArea(self)
text_area.setWidget(web_view)
text_area.setWidgetResizable(True)
text_area.setFixedHeight(height)
text_area.setFixedWidth(width)
bbox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok)
bbox.accepted.connect(self.accept)
layout.addWidget(text_area)
layout.addWidget(bbox)
示例4: MainWindow
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
testFile = 'sphinx_cheet_sheet.rst'
# text = TEXT
with open(testFile,'r') as f:
text = f.read()
formatter = HtmlFormatter()
# html = highlight(text, PythonLexer(), formatter)
extra_settings = {'initial_header_level': 4,
'doctitle_xform': 0,
'syntax_highlight': 'short',
'stylesheet - path': 'html4css1.css',
'embed-stylesheet': 'no'
}
# html = publish_parts(text, writer_name='html',settings_overrides=extra_settings)['html_body']
html = publish_parts(text, writer_name='html',settings_overrides=extra_settings)['whole']
print(html)
self.htmlview = QWebEngineView()
self.htmlview.setHtml(html)
self.setCentralWidget(self.htmlview)
self.show()
示例5: X0p
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
#.........这里部分代码省略.........
"Planes make angles from (Bragg_Angle - Theta1)\nto (Bragg_Angle - Theta2)"])
gui.separator(left_box_6, height=10)
left_box_6_2 = oasysgui.widgetBox(left_box_6, "", addSpace=True, orientation="horizontal", width=370, height=30)
oasysgui.lineEdit(left_box_6_2, self, "q1", label="Theta1", labelWidth=80, addSpace=False, valueType=float, orientation="horizontal")
oasysgui.lineEdit(left_box_6_2, self, "q2", label=" Theta2", labelWidth=80, addSpace=False, valueType=float, orientation="horizontal")
button = gui.button(self.controlArea, self, "Find Planes!", callback=self.submit)
button.setFixedHeight(30)
gui.rubber(self.controlArea)
self.tabs_widget = oasysgui.tabWidget(self.mainArea)
self.tab_output = oasysgui.createTabPage(self.tabs_widget, "X-ray Server Ouput")
self.x0h_output = QWebView(self.tab_output)
self.tab_output.layout().addWidget(self.x0h_output)
self.x0h_output.setFixedHeight(640)
self.x0h_output.setFixedWidth(740)
def set_xway(self):
self.box_wave.setVisible(self.xway!=2)
self.box_line.setVisible(self.xway==2)
def submit(self):
self.progressBarInit()
self.setStatusMessage("Submitting Request")
self.checkFields()
parameters = {}
parameters.update({"xway" : str(self.xway + 1)})
parameters.update({"wave" : str(self.wave)})
parameters.update({"line" : self.line})
parameters.update({"code" : self.code})
parameters.update({"hkl11" : str(self.hkl11)})
parameters.update({"hkl12" : str(self.hkl12)})
parameters.update({"hkl13" : str(self.hkl13)})
parameters.update({"hkl21" : str(self.hkl21)})
parameters.update({"hkl22" : str(self.hkl22)})
parameters.update({"hkl23" : str(self.hkl23)})
parameters.update({"qb1" : str(self.qb1)})
parameters.update({"qb2" : str(self.qb2)})
parameters.update({"prcmin" : str(self.prcmin)})
parameters.update({"df1df2" : self.decode_df1df2()})
parameters.update({"base1" : str(self.base1)})
parameters.update({"base2" : str(self.base2)})
parameters.update({"base3" : str(self.base3)})
parameters.update({"modesearch" : self.decode_modesearch()})
parameters.update({"q1" : str(self.q1)})
parameters.update({"q2" : str(self.q2)})
try:
response = HttpManager.send_xray_server_request_GET(APPLICATION, parameters)
response = response.split("<hr>")[0] + "\n </body></html>"
temp_1, temp_2 = response.split("style.css")
output = temp_1 + XRAY_SERVER_URL + "/style.css" + temp_2
response = response.split("<td><img src=\"images/x.gif\" width=31 height=32 border=0></td>")[0] + "</tr></tr></body></html>"
self.x0h_output.setHtml(response)
except urllib.error.HTTPError as e:
self.x0h_output.setHtml('The server couldn\'t fulfill the request.\nError Code: '
+ str(e.code) + "\n\n" +
server.BaseHTTPRequestHandler.responses[e.code][1])
except urllib.error.URLError as e:
self.x0h_output.setHtml('We failed to reach a server.\nReason: '
+ e.reason)
except XrayServerException as e:
ShowHtmlDialog.show_html("X-ray Server Error", e.response, width=750, height=500, parent=self)
except Exception as e:
ShowTextDialog.show_text("Error", 'Error Occurred.\nReason: ' + str(e), parent=self)
self.setStatusMessage("")
self.progressBarFinished()
def getLeftPartWidth(self):
return 415
def checkFields(self):
pass
def decode_df1df2(self):
if self.df1df2 == 0: return "-1"
elif self.df1df2 == 1: return "0"
elif self.df1df2 == 2: return "2"
elif self.df1df2 == 3: return "4"
def decode_modesearch(self):
if self.modesearch == 0: return "3"
elif self.modesearch == 1: return "2"
elif self.modesearch == 2: return "1"
示例6: QApplication
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
from PyQt5.QtOpenGL import QGLWidget
import plots
html = '''<html>
<head>
<title>Plotly Example</title>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
%(plot_content)s
</body>
</html>'''
if __name__ == '__main__':
app = QApplication(sys.argv)
w = QWebView()
w.resize(800, 600)
w.setWindowTitle('Simple Plot')
# QWebSettings.globalSettings().setAttribute(QWebSettings.AcceleratedCompositingEnabled, True)
# QWebSettings.globalSettings().setAttribute(QWebSettings.WebGLEnabled, True)
plot_content = plots.plot3d()
w.setHtml(html%{'plot_content':plot_content})
w.show()
sys.exit(app.exec_())
示例7: DrrrWindow
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
class DrrrWindow(ShadowsWindow):
def __init__(self):
super(DrrrWindow, self).__init__()
self.setWindowTitle("Drrr Chat Room")
self.setWindowIcon(QIcon('./img/drrr.ico'))
# w = WebView()
# w.show()
self.getSetting()
self.WebView = QWebEngineView()
# self.WebView.load(QUrl("file:///E:/Project/DrrrPC/img/index.html"))
self.WebView.setZoomFactor(0.8)
# 设置加载网页,和网页加载完成以及加载过程信号与槽函数关联
self.WebView.loadStarted.connect(self.loadStarted)
self.WebView.loadFinished.connect(self.loadFinished)
self.WebView.loadProgress.connect(self.loading)
self.cookieJar = QNetworkCookieJar()
# self.WebView.page().networkAccessManager().setCookieJar(self.cookieJar)
# self.WebView.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
# self.WebView.page().linkClicked.connect(self.linkClicked)
# self.WebView.page().contentsChanged.connect(self.contentsChanged)
# self.WebView.page().networkAccessManager().setHeader(QNetworkRequest.ContentTypeHeader, QVariant("text/html; charset=GBK"))
# 重定义QWebEnginePage中javaScriptAlert等函数
self.WebView.page().javaScriptAlert = self._javascript_alert
self.WebView.page().javaScriptConsoleMessage = self._javascript_console_message
self.WebView.page().javaScriptConfirm = self._javascript_confirm
self.WebView.page().javaScriptPrompt = self._javascript_prompt
# NetworkAccessManager
# self.NetworkAccessManager = QNetworkAccessManager()
# self.WebView.page().setNetworkAccessManager(self.NetworkAccessManager)
# self.NetworkAccessManager.finished.connect(self.NetworkAccessManagerReplyFinished)
# self.NetworkAccessManager.get(QNetworkRequest(QUrl("http://www.baidu.com")))
# self.old_manager = self.WebView.page().networkAccessManager()
# self.new_manager = NetworkAccessManager(self.old_manager)
# self.WebView.page().setNetworkAccessManager(self.new_manager)
self.titlebar = titleBar()
self.statusBar = StatusWindow()
# 中心窗口布局
self.contentLayout = QVBoxLayout()
self.contentWidget = QWidget()
self.contentWidget.gridLayout = QtWidgets.QGridLayout(self.contentWidget)
self.contentWidget.gridLayout.addLayout(self.contentLayout, 0, 0, 1, 1)
self.contentLayout.addWidget(self.WebView)
self.contentWidget.gridLayout.setContentsMargins(0,0,0,0)
self.contentLayout.setContentsMargins(1,0,1,0)
self.contentWidget.setStyleSheet("""
border-left: 1px solid black;
border-right: 1px solid black;
""")
# self.titlebar.titlebarBotton = QPushButton(self.titlebar)
# self.titlebar.titlebarBotton.setText('Push ME')
# self.titlebar.titlebarBotton.clicked.connect(self.getData)
self.main_layout = QVBoxLayout()
self.main_layout.addWidget(self.titlebar)
self.main_layout.addWidget(self.contentWidget)
self.main_layout.addWidget(self.statusBar)
self.main_layout.setSpacing(0)
# 窗口属性
self.setWindowFlags(Qt.Widget | QtCore.Qt.FramelessWindowHint)
self.setAttribute(Qt.WA_NoSystemBackground, True)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground,True)
self.widget = QWidget()
self.setCentralWidget(self.widget)
self.widget.setLayout(self.main_layout)
self.widget.setMouseTracking(True)
# self.resize(500,650)
self.resize(650,650)
# self.setMaximumHeight(660)
self.center()
# 将三个按钮点击信号与相关槽函数相关联
self.titlebar.min_button.clicked.connect(self.hideIt)
self.titlebar.max_button.clicked.connect(self.MaxAndNormal)
self.titlebar.close_button.clicked.connect(self.closeIt)
# 状态栏进度条:将LoadProgress信号与loading槽函数相关联
self.WebView.loadProgress.connect(self.loading)
# notice sound
# self.player =
self.WebView.setHtml(WaitingHTML)
self.show()
self.WebView.setStyleSheet("""
QWebView {
background-color:black
}
#.........这里部分代码省略.........
示例8: completeAndReturnName
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
view.setHtml('''
<html>
<head>
<title>A Demo Page</title>
<script language="javascript">
// Completes the full-name control and
// shows the submit button
function completeAndReturnName() {
var fname = document.getElementById('fname').value;
var lname = document.getElementById('lname').value;
var full = fname + ' ' + lname;
document.getElementById('fullname').value = full;
document.getElementById('submit-btn').style.display = 'block';
return full;
}
</script>
</head>
<body>
<form>
<label for="fname">First name:</label>
<input type="text" name="fname" id="fname"></input>
<br />
<label for="lname">Last name:</label>
<input type="text" name="lname" id="lname"></input>
<br />
<label for="fullname">Full name:</label>
<input disabled type="text" name="fullname" id="fullname"></input>
<br />
<input style="display: none;" type="submit" id="submit-btn"></input>
</form>
</body>
</html>
''')
示例9: QApplication
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
QWebView with static html
"""
import sys
from PyQt5.QtWidgets import QApplication, QWidget
#from PyQt5.QtWebKitWidgets import QWebView
from PyQt5.QtWebEngineWidgets import QWebEngineView as QWebView
from PyQt5.QtCore import QUrl
html = '''<html>
<head>
<title>A Sample Page</title>
</head>
<body>
<h1>Hello, World!</h1>
<hr />
<p>Simple Paragraph.</>
</body>
</html>'''
if __name__ == '__main__':
app = QApplication(sys.argv)
w = QWebView()
w.resize(800, 600)
w.move(300, 300)
w.setWindowTitle('Simple Plot')
w.setHtml(html)
w.show()
sys.exit(app.exec_())
示例10: setHtml
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
def setHtml(self, html, baseUrl):
# A hack to prevent WebEngine from stealing the focus
self.setEnabled(False)
QWebEngineView.setHtml(self, html, baseUrl)
self.setEnabled(True)
示例11: X0h
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
#.........这里部分代码省略.........
self.tabs_widget.setCurrentIndex(current_tab)
def submit(self):
self.progressBarInit()
self.setStatusMessage("Submitting Request")
self.checkFields()
parameters = {}
parameters.update({"xway" : str(self.xway + 1)})
parameters.update({"wave" : str(self.wave)})
parameters.update({"line" : self.line})
parameters.update({"coway" : str(self.coway)})
parameters.update({"code" : self.code})
parameters.update({"amor" : self.amor})
parameters.update({"chem" : self.chem})
parameters.update({"rho" : str(self.rho)})
parameters.update({"i1" : str(self.i1)})
parameters.update({"i2" : str(self.i2)})
parameters.update({"i3" : str(self.i3)})
parameters.update({"df1df2" : self.decode_df1df2()})
parameters.update({"modeout" : "0" })
parameters.update({"detail" : str(self.detail)})
try:
response = HttpManager.send_xray_server_request_GET(APPLICATION, parameters)
response = self.clear_response(response)
self.tabs_widget.setCurrentIndex(0)
self.x0h_output.setHtml(response)
data0, data1, data2 = self.extract_plots(response)
try:
exchange_data = DataExchangeObject("XRAYSERVER", "X0H")
if self.coway == 0: # crystals
dictionary = self.extract_structure_data(response)
exchange_data.add_content("structure", dictionary["structure"])
exchange_data.add_content("h", self.i1)
exchange_data.add_content("k", self.i2)
exchange_data.add_content("l", self.i3)
exchange_data.add_content("d_spacing", dictionary["d_spacing"])
exchange_data.add_content("energy", dictionary["energy"])
exchange_data.add_content("bragg_angle", dictionary["bragg_angle"])
exchange_data.add_content("xr0", dictionary["xr0"])
exchange_data.add_content("xi0", dictionary["xi0"])
exchange_data.add_content("xrh_s", dictionary["xrh_s"])
exchange_data.add_content("xih_s", dictionary["xih_s"])
exchange_data.add_content("xrh_p", dictionary["xrh_p"])
exchange_data.add_content("xih_p", dictionary["xih_p"])
exchange_data.add_content("reflectivity", data0)
exchange_data.add_content("reflectivity_units_to_degrees", 1.0)
exchange_data.add_content("x-ray_diffraction_profile_sigma", data1)
exchange_data.add_content("x-ray_diffraction_profile_sigma_units_to_degrees", 0.000277777805)
exchange_data.add_content("x-ray_diffraction_profile_pi", data2)
exchange_data.add_content("x-ray_diffraction_profile_pi_units_to_degrees", 0.000277777805)
self.send("xrayserver_data", exchange_data)
except: #problems with xrayserver, no data found
示例12: QWebEngineView
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
import os
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.Qt import QUrl
from PyQt5 import QtWidgets, QtGui
widget = QWebEngineView()
fake_url = QUrl.fromLocalFile(os.path.abspath("seamless.html"))
widget.setWindowTitle(PINS.title.get().data)
reloadAction = QtWidgets.QAction(QtGui.QIcon('exit.png'), '&Reload', widget)
reloadAction.setShortcut('F5')
reloadAction.setStatusTip('Reload')
reloadAction.triggered.connect(widget.reload)
widget.addAction(reloadAction)
widget.setHtml(PINS.val.get().data, fake_url)
widget.show()
示例13: MainWindow
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
class MainWindow(QWidget):
def __init__(self):
QWidget.__init__(self)
self.resize(1600, 940)
self.setWindowTitle('OpenVR tracking data')
self.webview = QWebEngineView()
self.button = QPushButton('Quit', self)
self.button.clicked.connect(self.close)
layout = QVBoxLayout(self)
layout.setSpacing(0)
# layout.setMargin(0)
layout.addWidget(self.button)
layout.addWidget(self.webview)
# XXX check result
openvr.init(openvr.VRApplication_Scene)
poses_t = openvr.TrackedDevicePose_t * openvr.k_unMaxTrackedDeviceCount
self.poses = poses_t()
self.timer = QTimer()
self.timer.timeout.connect(self.update_page)
self.timer.start(50) # ms
def update_page(self):
openvr.VRCompositor().waitGetPoses(self.poses, len(self.poses), None, 0)
vrsys = openvr.VRSystem()
poses = {}
hmd_index = openvr.k_unTrackedDeviceIndex_Hmd
beacon_indices = []
controller_indices = []
for i in range(len(self.poses)):
device_class = vrsys.getTrackedDeviceClass(i)
if device_class == openvr.TrackedDeviceClass_Invalid:
continue
elif device_class == openvr.TrackedDeviceClass_Controller:
controller_indices.append(i)
elif device_class == openvr.TrackedDeviceClass_TrackingReference:
beacon_indices.append(i)
model_name = vrsys.getStringTrackedDeviceProperty(i, openvr.Prop_RenderModelName_String)
pose = self.poses[i]
poses[i] = dict(
model_name=model_name,
device_is_connected=pose.bDeviceIsConnected,
valid=pose.bPoseIsValid,
tracking_result=pose.eTrackingResult,
d2a=pose.mDeviceToAbsoluteTracking,
velocity=pose.vVelocity, # m/s
angular_velocity=pose.vAngularVelocity # radians/s?
)
template = jinja_env.get_template('status.html')
html = template.render(poses=poses, hmd_index=hmd_index, controller_indices=controller_indices, beacon_indices=beacon_indices)
self.webview.setHtml(html)
self.update()
def closeEvent(self, event):
openvr.shutdown()
示例14: X0h
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setHtml [as 别名]
class X0h(XrayServerWidget):
name = "X0h"
description = "X0h"
icon = "icons/x0h.png"
maintainer = "Luca Rebuffi"
maintainer_email = "luca.rebuffi(@[email protected])elettra.eu"
priority = 1
category = "X0h"
keywords = ["data", "file", "load", "read"]
want_main_area = 1
outputs = [{"name": "xrayserver_data",
"type": DataExchangeObject,
"doc": "xrayserver_data",
"id": "xrayserver_data"}, ]
def __init__(self):
super().__init__()
left_box_1 = oasysgui.widgetBox(self.controlArea, "X0h Request Form", addSpace=True, orientation="vertical",
width=610, height=640)
html = self.clear_input_form(HttpManager.send_xray_server_direct_request("/cgi/www_form.exe?template=x0h_form.htm"))
self.x0h_input = QWebView(left_box_1)
self.x0h_input.setHtml(html)
left_box_1.layout().addWidget(self.x0h_input)
self.x0h_input.setFixedHeight(540)
self.x0h_input.setFixedWidth(590)
button = gui.button(self.controlArea, self, "Get X0h!", callback=self.submit)
button.setFixedHeight(30)
gui.rubber(self.controlArea)
self.tabs = []
self.tabs_widget = oasysgui.tabWidget(self.mainArea)
self.initializeTabs()
self.x0h_output = QWebView(self.tabs[0])
self.tabs[0].layout().addWidget(self.x0h_output)
self.x0h_output.setFixedHeight(630)
self.x0h_output.setFixedWidth(740)
def clear_input_form(self, html):
temp_1 = html.split("<body onload=\"setOnloads()\">")[0]
temp_2 = html.split("<table cellspacing=0 cellpadding=0 border=0 bgcolor=\"#c1c1c1\"><tr><td>")[1]
html = temp_1 + "<body>\n<table cellspacing=0 cellpadding=0 border=0 bgcolor=\"#c1c1c1\"><tr><td>\n" + temp_2
html = html.split("<input type=SUBMIT value=\"Get X0h!\"><input type=RESET> <br>")[0]
html += "\n<input type=SUBMIT style=\"display: none;\" id=\"submit-btn\"><input type=RESET style=\"display: none;\" id=\"reset-btn\"> <br>"
html += "\n</form>"
html += "\n</td></tr></table>"
html += "\n</td></tr></table>"
html += "\n</body>"
html += "\n</html>"
temp_1, temp_2 = html.split("x0h.js")
html = temp_1 + XRAY_SERVER_URL + "/x0h.js" + temp_2
temp_1, temp_2 = html.split("/cgi/x0h_form.exe")
html = temp_1 + XRAY_SERVER_URL + "/cgi/x0h_form.exe" + temp_2
return html
def getLeftPartWidth(self):
return 620
def initializeTabs(self):
current_tab = self.tabs_widget.currentIndex()
size = len(self.tabs)
for index in range(0, size):
self.tabs_widget.removeTab(size-1-index)
self.tabs = [gui.createTabPage(self.tabs_widget, "X-ray Server Ouput"),
gui.createTabPage(self.tabs_widget, "Critical Angle for TER"),
gui.createTabPage(self.tabs_widget, "Darwin Curve (" + u"\u03C3" + " Pol.)"),
gui.createTabPage(self.tabs_widget, "Darwin Curve (" + u"\u03C0" + " Pol.)"),
]
for tab in self.tabs:
tab.setFixedHeight(650)
tab.setFixedWidth(750)
self.plot_canvas = [None, None, None]
self.tabs_widget.setCurrentIndex(current_tab)
def js_callback(self, result):
pass
#.........这里部分代码省略.........