本文整理汇总了Python中PyQt5.QtGui.QTextDocument.print方法的典型用法代码示例。如果您正苦于以下问题:Python QTextDocument.print方法的具体用法?Python QTextDocument.print怎么用?Python QTextDocument.print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QTextDocument
的用法示例。
在下文中一共展示了QTextDocument.print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ReportDialog
# 需要导入模块: from PyQt5.QtGui import QTextDocument [as 别名]
# 或者: from PyQt5.QtGui.QTextDocument import print [as 别名]
class ReportDialog(QDialog, export_window.Ui_Dialog):
""" Summary of ReportDialog.
Represents a pop-up dialog when user presses "Export" button. Dialog contains a preview of the report containing
values of "mu", "k", "R^2" and the replica of FiberFit main window's when a sample has been processed.
Attributes:
- do_print is a signal sent when either Save or Save All button are pressed.
- do_excel is a signal starting the process of exporting results into an .csv format
- sendDataList is a signal that sends a list containing already exported images back to FiberFit.
- data_list is a list representing already exported images
- screen_dim stores a screen dimension
- document is an instance of QTextDocument that
TODO: add other attributes.
"""
do_print = pyqtSignal()
do_excel = pyqtSignal()
sendDataList = pyqtSignal(list)
def __init__(self, fft_mainWindow,parent=None, screenDim=None):
super(ReportDialog, self).__init__(parent)
self.fft_mainWindow=fft_mainWindow
self.dataList = []
self.setupUi(self, screenDim)
self.screenDim = screenDim
self.document = QTextDocument()
#list that keeps track of only selected images
self.list = []
#list that contains all of the stored images
self.wholeList = OrderedSet()
self.savedfiles = None
self.currentModel = None
# settings
self.uCut = 0
self.lCut = 0
self.angleInc = 0
self.radStep = 0
# states
"""
0 -> single
1 -> multiple
2 -> append
"""
self.isReport = True
self.isSummary = False
self.reportOption = 2
self.merger = merger()
# printer
self.printer = QPrinter(QPrinter.PrinterResolution)
# Signals and slots:
self.do_excel.connect(self.exportExcel)
self.webView = QtWebKitWidgets.QWebView()
# self.checkBox_report.stateChanged.connect(self.topLogicHandler)
self.checkBox_summary.stateChanged.connect(self.topLogicHandler)
self.radio_multiple.toggled.connect(self.toggleHandler)
self.radio_single.toggled.connect(self.toggleHandler)
self.radio_append.toggled.connect(self.toggleHandler)
self.buttonBox.button(QDialogButtonBox.Ok).clicked.connect(self.exportHandler)
self.do_print.connect(self.print)
self.rejected.connect(self.resetOptions)
self.topLogicHandler()
def resetOptions(self):
self.checkBox_summary.setChecked(False)
self.radio_append.setChecked(True)
self.radio_multiple.setChecked(False)
self.radio_single.setChecked(False)
def exportHandler(self):
if self.isSummary and self.isReport is False:
self.saveas()
elif (self.reportOption == 0 or self.reportOption == 2 or self.reportOption == 1) and self.isSummary is False:
self.saveas()
elif self.isSummary and self.isReport:
self.saveas()
def toggleHandler(self):
if self.radio_single.isChecked():
self.reportOption = 0
self.isReport = True
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True)
elif self.radio_multiple.isChecked():
self.reportOption = 1
self.isReport = True
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True)
elif self.radio_append.isChecked():
self.reportOption = 2
self.isReport = True
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True)
elif self.radio_none.isChecked():
self.reportOption = -1
self.isReport = False
if (not self.checkBox_summary.isChecked()):
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
def topLogicHandler(self):
#.........这里部分代码省略.........