def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = DataPlot(self) self.plot.setContentsMargins(5, 5, 5, 0) self.setCentralWidget(self.plot) # signal slot connect self.plot.signal_showinfo.connect(self.showInfo) font = QFont() font.setFamily("Calibri") #,Consolas font.setPointSize(16) font2 = QFont() font2.setFamily("Calibri") font2.setPointSize(12) self.plot.setFont(font2) # add toolbar toolBar = QToolBar(self) toolBar.setOrientation(Qt.Vertical) self.addToolBar(toolBar) # label COM lbl_COM = QLabel("COM:", toolBar) lbl_COM.setFont(font2) lbl_COM.setStyleSheet("") toolBar.addWidget(lbl_COM) #lineEdit_COM self.lineEdit_COM = QLineEdit(str(config.Port)) self.lineEdit_COM.setFont(font2) #self.lineEdit_COM.setMinimumWidth(100) toolBar.addWidget(self.lineEdit_COM) # label baudrate lbl_baud = QLabel("BAUD Rate:", toolBar) lbl_baud.setFont(font2) lbl_baud.setStyleSheet("") toolBar.addWidget(lbl_baud) #lineEdit_baud self.lineEdit_baud = QLineEdit(str(config.BaudRate)) #self.lineEdit_baud.setMinimumWidth(100) self.lineEdit_baud.setFont(font2) toolBar.addWidget(self.lineEdit_baud) # Connect device, QIcon(const QString &filename); // 从图像文件构造图标 btnConnect = QToolButton(toolBar) btnConnect.setText("Connect") btnConnect.setFont(font2) btnConnect.setIcon(QIcon('./icon/Connect.png')) btnConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnConnect) btnConnect.clicked.connect(self.GetComSettings_Connect) # disConnect device btnDisConnect = QToolButton(toolBar) btnDisConnect.setText("DisConnect") btnDisConnect.setFont(font2) btnDisConnect.setIcon(QIcon('./icon/Disconnect.jfif')) btnDisConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnDisConnect) btnDisConnect.clicked.connect(self.plot.DisConnect) toolBar.addSeparator() # Start timer btnStartTimer = QToolButton(toolBar) btnStartTimer.setText("Start Timer") btnStartTimer.setFont(font2) btnStartTimer.setIcon(QIcon('./icon/start.jfif')) btnStartTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStartTimer) btnStartTimer.clicked.connect(self.plot.StartTimer) # Stop timer btnStopTimer = QToolButton(toolBar) btnStopTimer.setText("Stop Timer") btnStopTimer.setFont(font2) btnStopTimer.setIcon(QIcon('./icon/stop.jfif')) btnStopTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStopTimer) btnStopTimer.clicked.connect(self.plot.StopTimer) toolBar.addSeparator() #X_LOWER lbl_x_lower = QLabel("X-Lower:", toolBar) lbl_x_lower.setFont(font2) toolBar.addWidget(lbl_x_lower) self.LineEdit_x_lower = QLineEdit(str(config.X_lower), toolBar) self.LineEdit_x_lower.setFont(font2) toolBar.addWidget(self.LineEdit_x_lower) #X_Upper lbl_x_upper = QLabel("X-Upper:", toolBar) lbl_x_upper.setFont(font2) toolBar.addWidget(lbl_x_upper) self.LineEdit_x_upper = QLineEdit(str(config.X_upper), toolBar) self.LineEdit_x_upper.setFont(font2) toolBar.addWidget(self.LineEdit_x_upper) #X_interval lbl_x_inteval = QLabel("X-Interval(s):", toolBar) lbl_x_inteval.setFont(font2) toolBar.addWidget(lbl_x_inteval) self.LineEdit_x_interval = QLineEdit(str(config.X_grid_interval), toolBar) self.LineEdit_x_interval.setFont(font2) toolBar.addWidget(self.LineEdit_x_interval) # Y_Lower lbl_y_lower = QLabel("Y-Lower:", toolBar) lbl_y_lower.setFont(font2) toolBar.addWidget(lbl_y_lower) self.LineEdit_y_Lower = QLineEdit(str(config.Y_lower), toolBar) self.LineEdit_y_Lower.setFont(font2) toolBar.addWidget(self.LineEdit_y_Lower) # Y_Upper lbl_y_uppwer = QLabel("Y-Upper:", toolBar) lbl_y_uppwer.setFont(font2) toolBar.addWidget(lbl_y_uppwer) self.LineEdit_Y_Upper = QLineEdit(str(config.Y_upper), toolBar) self.LineEdit_Y_Upper.setFont(font2) toolBar.addWidget(self.LineEdit_Y_Upper) # Y-Interval lbl_Y_Interval = QLabel("Y-Interval:", toolBar) lbl_Y_Interval.setFont(font2) toolBar.addWidget(lbl_Y_Interval) self.LineEdit_y_interval = QLineEdit(str(config.Y_grid_interval), toolBar) self.LineEdit_y_interval.setFont(font2) toolBar.addWidget(self.LineEdit_y_interval) # Set axis para btnSet = QToolButton(toolBar) btnSet.setText("Set Paras") btnSet.setFont(font2) btnSet.setIcon(QIcon('./icon/Settings.jfif')) btnSet.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnSet) btnSet.clicked.connect(self.SetParas) toolBar.addSeparator() # add print btn to toolbar btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setFont(font2) btnPrint.setIcon(QIcon('./icon/print.jfif')) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) # add Export btn to toolbar btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setFont(font2) btnExport.setIcon(QIcon('./icon/snapshot.jfif')) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) toolBar.addSeparator() # add About btn to toolbar btnAbout = QToolButton(toolBar) btnAbout.setText("About") btnAbout.setFont(font2) btnAbout.setIcon(QIcon('./icon/about.png')) btnAbout.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnAbout) btnAbout.clicked.connect(self.About) #self.statusBar().setStyleSheet("QStatusBar::item{border: 5px}") self.statusBar().setStyleSheet("color:green") #self.statusBar().addPermanentWidget(VLine()) self.statusBar().addPermanentWidget(QLabel("X = ")) #self.statusBar().addPermanentWidget(VLine()) self.statusBar().addPermanentWidget(QLabel("Y = ")) #self.statusBar().addPermanentWidget(VLine()) PermanentLabel = QLabel("Version:" + kProgVersion + " Developed by " + kProgramDeveloperName + " Python. Running with " + kPythonVersion) font3 = QFont() font3.setFamily("Calibri") font3.setPointSize(12) PermanentLabel.setFont(font3) self.statusBar().setFont(font3) self.statusBar().addPermanentWidget(PermanentLabel) self.showInfo("Show info here ......")
def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = DataPlot(self) self.plot.setContentsMargins(5, 5, 5, 0) self.setCentralWidget(self.plot) print(type(self.plot.signal_showinfo)) # signal slot connect self.plot.signal_showinfo.connect(self.showInfo) font = QFont() font.setFamily("Calibri") #,Consolas font.setPointSize(16) font2 = QFont() font2.setFamily("Calibri") font2.setPointSize(14) self.plot.setFont(font2) # add toolbar toolBar = QToolBar(self) self.addToolBar(toolBar) # label COM lbl_COM = QLabel("COM:", toolBar) lbl_COM.setFont(font) lbl_COM.setStyleSheet("") toolBar.addWidget(lbl_COM) #lineEdit_COM self.lineEdit_COM = QLineEdit(str(config.Port)) self.lineEdit_COM.setFont(font2) self.lineEdit_COM.setMinimumWidth(50) toolBar.addWidget(self.lineEdit_COM) # label baudrate lbl_baud = QLabel("BAUD Rate:", toolBar) lbl_baud.setFont(font) lbl_baud.setStyleSheet("") toolBar.addWidget(lbl_baud) #lineEdit_baud self.lineEdit_baud = QLineEdit(str(config.BaudRate)) self.lineEdit_baud.setMinimumWidth(100) self.lineEdit_baud.setFont(font2) toolBar.addWidget(self.lineEdit_baud) # Connect device, QIcon(const QString &filename); // 从图像文件构造图标 btnConnect = QToolButton(toolBar) btnConnect.setText("Connect") btnConnect.setFont(font2) btnConnect.setIcon(QIcon('./icon/Connect.png')) btnConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnConnect) btnConnect.clicked.connect(self.GetComSettings_Connect) # disConnect device btnDisConnect = QToolButton(toolBar) btnDisConnect.setText("DisConnect") btnDisConnect.setFont(font2) btnDisConnect.setIcon(QIcon('./icon/Disconnect.jfif')) btnDisConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnDisConnect) btnDisConnect.clicked.connect(self.plot.DisConnect) toolBar.addSeparator() # Start timer btnStartTimer = QToolButton(toolBar) btnStartTimer.setText("Start Timer") btnStartTimer.setFont(font2) btnStartTimer.setIcon(QIcon('./icon/start.jfif')) btnStartTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStartTimer) btnStartTimer.clicked.connect(self.plot.StartTimer) # Stop timer btnStopTimer = QToolButton(toolBar) btnStopTimer.setText("Stop Timer") btnStopTimer.setFont(font2) btnStopTimer.setIcon(QIcon('./icon/stop.jfif')) btnStopTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStopTimer) btnStopTimer.clicked.connect(self.plot.StopTimer) toolBar.addSeparator() #X_LOWER lbl_x_lower = QLabel("X-Lower:", toolBar) lbl_x_lower.setFont(font) toolBar.addWidget(lbl_x_lower) self.LineEdit_x_lower = QLineEdit(str(0), toolBar) self.LineEdit_x_lower.setFont(font2) toolBar.addWidget(self.LineEdit_x_lower) #X_Upper lbl_x_upper = QLabel("X-Upper:", toolBar) lbl_x_upper.setFont(font) toolBar.addWidget(lbl_x_upper) self.LineEdit_x_upper = QLineEdit(str(config.X_upper), toolBar) self.LineEdit_x_upper.setFont(font2) toolBar.addWidget(self.LineEdit_x_upper) #X_interval lbl_x_inteval = QLabel("X-Interval(s):", toolBar) lbl_x_inteval.setFont(font) toolBar.addWidget(lbl_x_inteval) self.LineEdit_x_interval = QLineEdit(str(config.X_grid_interval), toolBar) self.LineEdit_x_interval.setFont(font2) toolBar.addWidget(self.LineEdit_x_interval) # Y_Lower lbl_y_lower = QLabel("Y-Lower:", toolBar) lbl_y_lower.setFont(font) toolBar.addWidget(lbl_y_lower) self.LineEdit_y_Lower = QLineEdit(str(config.Y_lower), toolBar) self.LineEdit_y_Lower.setFont(font2) toolBar.addWidget(self.LineEdit_y_Lower) # Y_Upper lbl_y_uppwer = QLabel("Y-Upper:", toolBar) lbl_y_uppwer.setFont(font) toolBar.addWidget(lbl_y_uppwer) self.LineEdit_Y_Upper = QLineEdit(str(config.Y_upper), toolBar) self.LineEdit_Y_Upper.setFont(font2) toolBar.addWidget(self.LineEdit_Y_Upper) # Y-Interval lbl_Y_Interval = QLabel("Y-Interval:", toolBar) lbl_Y_Interval.setFont(font) toolBar.addWidget(lbl_Y_Interval) self.LineEdit_y_interval = QLineEdit(str(config.Y_grid_interval), toolBar) self.LineEdit_y_interval.setFont(font2) toolBar.addWidget(self.LineEdit_y_interval) # Set axis para btnSet = QToolButton(toolBar) btnSet.setText("Set Paras") btnSet.setFont(font2) btnSet.setIcon(QIcon('./icon/Settings.jfif')) btnSet.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnSet) btnSet.clicked.connect(self.SetParas) toolBar.addSeparator() # add print btn to toolbar btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setFont(font2) btnPrint.setIcon(QIcon('./icon/print.jfif')) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) # add Export btn to toolbar btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setFont(font2) btnExport.setIcon(QIcon('./icon/snapshot.jfif')) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) toolBar.addSeparator() self.statusBar() self.showInfo("Show info here ......")
def __init__(self, *args): QwtPlot.__init__(self, *args) self.uut_dev = None self.timerId = None #self.interval = 250 # ms self.interval = config.interval # ms fileTIME = datetime.datetime.now() File_timestamp = "%04d-%02d-%02d_%02d%02d%02d" % ( fileTIME.year, fileTIME.month, fileTIME.day, fileTIME.hour, fileTIME.minute, fileTIME.second) self.fileNamme = '.\data\data_%s.txt' % File_timestamp print('Raw data record file name:%s' % self.fileNamme) # default parameters from config file self.x_ZERO = config.X_lower self.x_range = config.X_upper self.x_interval = config.X_grid_interval self.y_range_Upper = config.Y_upper self.y_range_Lower = config.Y_lower self.y_interval = config.Y_grid_interval self.unit = 'kPa' # default value, will replaced by actual reading. #self.getReadingCommand = r"UPPER_VAL?\r\n" # default pass and pac #self.getResp_rex = r'^[-]?([0-9]{1,}[.]?[0-9]*)' self.lenth = config.Slope_lenth # 40 = 10s caculate the slowrate # QwtPlot property # Initialize 坐标轴 self.setCanvasBackground(Qt.white) #Qt.white self.alignScales() grid = QwtPlotGrid() grid.attach(self) grid.setMajorPen(QPen(Qt.black, 0, Qt.DotLine)) # x Axis property #self.setAxisScaleDraw(QwtPlot.xBottom, TimeScaleDraw(self.cpuStat.upTime())) #timeScale = QwtDateScaleDraw(Qt.LocalTime) #print(timeScale) #self.setAxisScaleDraw(QwtPlot.xBottom, timeScale) self.setAxisScale(QwtPlot.xBottom, 0.0, self.x_range, self.x_interval) #self.setAxisAutoScale(QwtPlot.yLeft,True) #self.setAxisScale(QwtPlot.yLeft,99.99,100.0,0.0005) self.setAxisScale(QwtPlot.yLeft, self.y_range_Lower, self.y_range_Upper, self.y_interval) self.setAxisLabelRotation(QwtPlot.xBottom, -45.0) self.x = np.arange( 0.0, self.x_range + 1, 0.25 ) #0.25 for ONE POINT, THIS SHOULD BE Align to the reading rate:250ms #self.z = np.zeros(len(self.x), np.float) list = [] for i in range(len(self.x)): list.append(0.0) self.z = np.array(list) rlist = [] for i in range(self.lenth): # 10s rlist.append(0.0) self.RateList = np.array(rlist) self.setTitle("UUT Reading Monitor - OutPort(%s)\r\n" % (self.unit)) #self.insertLegend(QwtLegend(), QwtPlot.RightLegend); self.curveL = QwtPlotCurve("UUT Reading") self.curveL.attach(self) pen = QPen(Qt.red) pen.setWidth(1.5) #pen.setWidth(1) self.curveL.setPen(pen) font = QFont() font.setFamily("Calibri") #,Consolas font.setPointSize(16) # show the latest reading. line and point value self.peakMarker = m = QwtPlotMarker() m.setLineStyle(QwtPlotMarker.HLine) m.setLabelAlignment(Qt.AlignLeft | Qt.AlignTop) m.setLinePen(QPen(Qt.blue, 1.5, Qt.DashDotLine)) text = QwtText('Reading: ----') text.setColor(Qt.red) text.setBackgroundBrush(QBrush(self.canvasBackground())) text.setFont(font) m.setLabel(text) # MarkPoint symbol m.setSymbol( QwtSymbol(QwtSymbol.Diamond, QBrush(Qt.blue), QPen(Qt.green), QSize(7, 7))) m.attach(self) # text marker , display slope rate self.txtMarker = m = QwtPlotMarker() m.setValue(self.x_range / 2, self.y_range_Upper - self.y_interval / 2) # show position m.setLabelAlignment(Qt.AlignRight | Qt.AlignBottom) text = QwtText('Slope Rate: ----') text.setFont(font) text.setColor(Qt.white) text.setBackgroundBrush(QBrush(Qt.black)) text.setBorderPen(QPen(Qt.red, 2)) m.setLabel(text) m.attach(self) self.setAxisTitle(QwtPlot.xBottom, "Time (seconds)") self.setAxisTitle(QwtPlot.yLeft, "UUT - Reading(%s)" % (self.unit)) self.replot() #self.startTimer(250)#ms# FOR GET READING #self.starttime = time.clock();#unit: s python2 self.starttime = time.time() # python3 self.idx = 0 self.readfmt = "%f" self.Saveinfo("Starting...")
def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = DataPlot(self) #self.plot.resize(540,760) self.plot.setContentsMargins(5, 5, 5, 0) self.setCentralWidget(self.plot) print(type(self.plot.signal_showinfo)) # signal slot connect self.plot.signal_showinfo.connect(self.showInfo) font = QFont() font.setFamily("Calibri") #,Consolas font.setPointSize(16) font2 = QFont() font2.setFamily("Calibri") font2.setPointSize(14) self.plot.setFont(font2) # add toolbar toolBar = QToolBar(self) self.addToolBar(toolBar) # label COM lbl_COM = QLabel("COM:",toolBar) lbl_COM.setFont(font) lbl_COM.setStyleSheet("") toolBar.addWidget(lbl_COM) #lineEdit_COM self.lineEdit_COM = QLineEdit('COM37') self.lineEdit_COM.setFont(font2) self.lineEdit_COM.setMinimumWidth(50) toolBar.addWidget(self.lineEdit_COM) # label baudrate lbl_baud = QLabel("BAUD Rate:",toolBar) lbl_baud.setFont(font) lbl_baud.setStyleSheet("") toolBar.addWidget(lbl_baud) #lineEdit_baud self.lineEdit_baud = QLineEdit('9600') self.lineEdit_baud.setMinimumWidth(100) self.lineEdit_baud.setFont(font2) toolBar.addWidget(self.lineEdit_baud) # label command lbl_command = QLabel("Command:",toolBar) lbl_command.setFont(font) lbl_command.setStyleSheet("") toolBar.addWidget(lbl_command) #lineEdit_command self.lineEdit_command = QLineEdit(r'UPPER_VAL?\r\n') self.lineEdit_command.setFont(font2) #self.lineEdit_command.resize(200,12) #self.lineEdit_command.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) self.lineEdit_command.setMinimumWidth(300) toolBar.addWidget(self.lineEdit_command) # label response_rex lbl_response_rex = QLabel("response_rex:",toolBar) lbl_response_rex.setFont(font) lbl_response_rex.setStyleSheet("") toolBar.addWidget(lbl_response_rex) #lineEdit_response_rex self.lineEdit_response_rex = QLineEdit(r'^[-]?([0-9]{1,}[.]?[0-9]*)') self.lineEdit_response_rex.setFont(font2) #self.lineEdit_command.resize(200,12) #self.lineEdit_command.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) self.lineEdit_response_rex.setMinimumWidth(300) toolBar.addWidget(self.lineEdit_response_rex) # Connect device, QIcon(const QString &filename); // 从图像文件构造图标 btnConnect = QToolButton(toolBar) btnConnect.setText("Connect") btnConnect.setFont(font2) btnConnect.setIcon(QIcon('./icon/Connect.png')) btnConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnConnect) btnConnect.clicked.connect(self.GetComSettings_Connect) # disConnect device btnDisConnect = QToolButton(toolBar) btnDisConnect.setText("DisConnect") btnDisConnect.setFont(font2) btnDisConnect.setIcon(QIcon('./icon/Disconnect.jfif')) btnDisConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnDisConnect) btnDisConnect.clicked.connect(self.plot.DisConnect) toolBar.addSeparator() # Label sample interval lbl_timer_interval = QLabel("Timer(ms):",toolBar) lbl_timer_interval.setFont(font) lbl_timer_interval.setStyleSheet("") toolBar.addWidget(lbl_timer_interval) # lineEdit sample interval self.lineEdit_timer_interval = QLineEdit('250') self.lineEdit_timer_interval.setFont(font2) self.lineEdit_timer_interval.setStyleSheet("") toolBar.addWidget(self.lineEdit_timer_interval) # Start timer btnStartTimer = QToolButton(toolBar) btnStartTimer.setText("Start Timer") btnStartTimer.setFont(font2) btnStartTimer.setIcon(QIcon('./icon/start.jfif')) btnStartTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStartTimer) btnStartTimer.clicked.connect(self.plot.StartTimer) # Stop timer btnStopTimer = QToolButton(toolBar) btnStopTimer.setText("Stop Timer") btnStopTimer.setFont(font2) btnStopTimer.setIcon(QIcon('./icon/stop.jfif')) btnStopTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStopTimer) btnStopTimer.clicked.connect(self.plot.StopTimer) toolBar.addSeparator() # dampBox = QWidget(toolBar) # dampLayout = QHBoxLayout(dampBox) # dampLayout.setSpacing(0) # dampLayout.addWidget(QWidget(dampBox), 0) # spacer #X_interval lbl_x_inteval = QLabel("X-Interval(s):", toolBar) lbl_x_inteval.setFont(font) #dampLayout.addWidget(lbl_x_inteval, 0) toolBar.addWidget(lbl_x_inteval) self.LineEdit_x_interval= QLineEdit('30',toolBar) self.LineEdit_x_interval.setFont(font2) #dampLayout.addWidget(self.LineEdit_x_interval,0) #dampLayout.addSpacing(10) toolBar.addWidget(self.LineEdit_x_interval) # Y_Lower lbl_y_lower = QLabel("Y-Lower:", toolBar) lbl_y_lower.setFont(font) #dampLayout.addWidget(lbl_y_lower, 0) toolBar.addWidget(lbl_y_lower) self.LineEdit_y_Lower = QLineEdit('-90', toolBar) self.LineEdit_y_Lower.setFont(font2) #dampLayout.addWidget(self.LineEdit_y_Lower, 0) #dampLayout.addSpacing(10) toolBar.addWidget(self.LineEdit_y_Lower) # Y_Upper lbl_y_uppwer = QLabel("Y-Upper:", toolBar) lbl_y_uppwer.setFont(font) #dampLayout.addWidget(lbl_y_uppwer, 0) toolBar.addWidget(lbl_y_uppwer) self.LineEdit_Y_Upper = QLineEdit('210', toolBar) self.LineEdit_Y_Upper.setFont(font2) #dampLayout.addWidget(self.LineEdit_Y_Upper, 0) #dampLayout.addSpacing(10) toolBar.addWidget(self.LineEdit_Y_Upper) # Y-Interval lbl_Y_Interval = QLabel("Y-Interval:", toolBar) lbl_Y_Interval.setFont(font) #dampLayout.addWidget(lbl_Y_Interval, 0) toolBar.addWidget(lbl_Y_Interval) self.LineEdit_y_interval= QLineEdit('50', toolBar) self.LineEdit_y_interval.setFont(font2) #dampLayout.addWidget(self.LineEdit_y_interval, 0) #dampLayout.addSpacing(10) toolBar.addWidget(self.LineEdit_y_interval) #toolBar.addWidget(dampBox) # Set axis para btnSet = QToolButton(toolBar) btnSet.setText("Set Paras") btnSet.setFont(font2) btnSet.setIcon(QIcon('./icon/Settings.jfif')) btnSet.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnSet) btnSet.clicked.connect(self.SetParas) toolBar.addSeparator() # add print btn to toolbar btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setFont(font2) btnPrint.setIcon(QIcon('./icon/print.jfif')) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) # add Export btn to toolbar btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setFont(font2) btnExport.setIcon(QIcon('./icon/snapshot.jfif')) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) toolBar.addSeparator() self.statusBar() self.showInfo("Show info here ......")