本文整理汇总了Python中qtpy.QtWidgets.QDialog.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Python QDialog.setAttribute方法的具体用法?Python QDialog.setAttribute怎么用?Python QDialog.setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QDialog
的用法示例。
在下文中一共展示了QDialog.setAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PyChopGui
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import setAttribute [as 别名]
#.........这里部分代码省略.........
if obj.isFermi:
txt += '# with chopper %s at %3i Hz\n' % (chtyp, freqs[0])
else:
txt += '# in %s mode with:\n' % (chtyp)
freq_names = obj.chopper_system.frequency_names
for idx in range(len(freq_names)):
txt += '# %s at %3i Hz\n' % (freq_names[idx], freqs[idx])
txt += self._gen_text_ei(ei_in, obj)
if multiplot:
for ei in sorted(self.engine.getAllowedEi()):
if np.abs(ei - ei_in) > 0.001:
txt += self._gen_text_ei(ei, obj)
return txt
def showText(self):
"""
Creates a dialog to show the generated text output.
"""
try:
generatedText = self.genText()
except ValueError:
return
self.txtwin = QDialog()
self.txtedt = QTextEdit()
self.txtbtn = QPushButton('OK')
self.txtwin.layout = QVBoxLayout(self.txtwin)
self.txtwin.layout.addWidget(self.txtedt)
self.txtwin.layout.addWidget(self.txtbtn)
self.txtbtn.clicked.connect(self.txtwin.deleteLater)
self.txtedt.setText(generatedText)
self.txtedt.setReadOnly(True)
self.txtwin.setWindowTitle('Resolution information')
self.txtwin.setWindowModality(Qt.ApplicationModal)
self.txtwin.setAttribute(Qt.WA_DeleteOnClose)
self.txtwin.setMinimumSize(400, 600)
self.txtwin.resize(400, 600)
self.txtwin.show()
self.txtloop = QEventLoop()
self.txtloop.exec_()
def saveText(self):
"""
Saves the generated text to a file (opens file dialog).
"""
fname = QFileDialog.getSaveFileName(self, 'Open file', '')
if isinstance(fname, tuple):
fname = fname[0]
fid = open(fname, 'w')
fid.write(self.genText())
fid.close()
def update_script(self):
"""
Updates the text window with information about the previous calculation.
"""
if self.widgets['MultiRepCheck'].isChecked():
out = self.engine.getMultiWidths()
new_str = '\n'
for ie, ee in enumerate(out['Eis']):
res = out['Energy'][ie]
percent = res / ee * 100
chop_width = out['chopper'][ie]
mod_width = out['moderator'][ie]
new_str += 'Ei is %6.2f meV, resolution is %6.2f ueV, percentage resolution is %6.3f\n' % (ee, res * 1000, percent)
new_str += 'FWHM at sample from chopper and moderator are %6.2f us, %6.2f us\n' % (chop_width, mod_width)
else: