def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = QwtPlot(self) self.plot.setTitle("A Simple Map Demonstration") self.plot.setCanvasBackground(Qt.white) self.plot.setAxisTitle(QwtPlot.xBottom, "x") self.plot.setAxisTitle(QwtPlot.yLeft, "y") self.plot.setAxisScale(QwtPlot.xBottom, 0.0, 1.0) self.plot.setAxisScale(QwtPlot.yLeft, 0.0, 1.0) self.setCentralWidget(self.plot) # Initialize map data self.count = self.i = 1000 self.xs = np.zeros(self.count, np.float) self.ys = np.zeros(self.count, np.float) self.kappa = 0.2 self.curve = QwtPlotCurve("Map") self.curve.attach(self.plot) self.curve.setSymbol( QwtSymbol(QwtSymbol.Ellipse, QBrush(Qt.red), QPen(Qt.blue), QSize(5, 5))) self.curve.setPen(QPen(Qt.cyan)) toolBar = QToolBar(self) self.addToolBar(toolBar) # 1 tick = 1 ms, 10 ticks = 10 ms (Linux clock is 100 Hz) self.ticks = 10 self.tid = self.startTimer(self.ticks) self.timer_tic = None self.user_tic = None self.system_tic = None self.plot.replot()
def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = QwtPlot(self) self.plot.setTitle("A Simple Map Demonstration") self.plot.setCanvasBackground(Qt.white) self.plot.setAxisTitle(QwtPlot.xBottom, "x") self.plot.setAxisTitle(QwtPlot.yLeft, "y") self.plot.setAxisScale(QwtPlot.xBottom, 0.0, 1.0) self.plot.setAxisScale(QwtPlot.yLeft, 0.0, 1.0) self.setCentralWidget(self.plot) # Initialize map data self.count = self.i = 1000 self.xs = np.zeros(self.count, np.float) self.ys = np.zeros(self.count, np.float) self.kappa = 0.2 self.curve = QwtPlotCurve("Map") self.curve.attach(self.plot) self.curve.setSymbol(QwtSymbol(QwtSymbol.Ellipse, QBrush(Qt.red), QPen(Qt.blue), QSize(5, 5))) self.curve.setPen(QPen(Qt.cyan)) toolBar = QToolBar(self) self.addToolBar(toolBar) # 1 tick = 1 ms, 10 ticks = 10 ms (Linux clock is 100 Hz) self.ticks = 10 self.tid = self.startTimer(self.ticks) self.timer_tic = None self.user_tic = None self.system_tic = None self.plot.replot()
def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = BodePlot(self) self.plot.setContentsMargins(5, 5, 5, 0) self.setContextMenuPolicy(Qt.NoContextMenu) self.setCentralWidget(self.plot) toolBar = QToolBar(self) self.addToolBar(toolBar) btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setIcon(QIcon(QPixmap(print_xpm))) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setIcon(QIcon(QPixmap(print_xpm))) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) btnSet = QToolButton(toolBar) btnSet.setText("Set") btnSet.setIcon(QIcon(QPixmap(print_xpm))) btnSet.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnSet) btnSet.clicked.connect(self.exportDocument) toolBar.addSeparator() dampBox = QWidget(toolBar) dampLayout = QHBoxLayout(dampBox) dampLayout.setSpacing(0) dampLayout.addWidget(QWidget(dampBox), 10) # spacer dampLayout.addWidget(QLabel("Damping Factor", dampBox), 0) dampLayout.addSpacing(10) toolBar.addWidget(dampBox) self.statusBar() self.showInfo()
def make(): demo = QMainWindow() toolBar = QToolBar(demo) toolBar.addAction(QWhatsThis.createAction(toolBar)) demo.addToolBar(toolBar) plot = Plot(demo) demo.setCentralWidget(plot) plot.setWhatsThis( 'An useless plot to demonstrate how to use event filtering.\n\n' 'You can click on the color bar, the scales or move the slider.\n' 'All points can be moved using the mouse or the keyboard.') CanvasPicker(plot) scalePicker = ScalePicker(plot) scalePicker.clicked.connect(plot.insertCurve) demo.resize(540, 400) demo.show() return demo
def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = BodePlot(self) self.plot.setContentsMargins(5, 5, 5, 0) self.setContextMenuPolicy(Qt.NoContextMenu) self.setCentralWidget(self.plot) toolBar = QToolBar(self) self.addToolBar(toolBar) btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setIcon(QIcon(QPixmap(print_xpm))) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setIcon(QIcon(QPixmap(print_xpm))) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) toolBar.addSeparator() dampBox = QWidget(toolBar) dampLayout = QHBoxLayout(dampBox) dampLayout.setSpacing(0) dampLayout.addWidget(QWidget(dampBox), 10) # spacer dampLayout.addWidget(QLabel("Damping Factor", dampBox), 0) dampLayout.addSpacing(10) toolBar.addWidget(dampBox) self.statusBar() self.showInfo()
def __init__(self, parent=None, name=None, num_curves=16, plot_label=None): QMainWindow.__init__(self, parent) # ChartPlot strip charts will be displayed via a tab widget self._tabwidget = QTabWidget(self) self._tab_resized = False self._num_curves = num_curves self._plot_label = plot_label self._result_range = None self._png_number = 0 self._grab_name = '' # create control menu self._menu = ControlMenu(self) # create a dictionary of chart plot objects self._ChartPlot = {} self._click_on = "If you click on an individual stripchart with the <b>middle</b> mouse button, a popup window will appear that gives a more detailed plot of the data from that particular object. <br><br> Clicking with the <b>left</b> mouse button will cause a small popup to appear. The popup gives the actual X and Y values, corrected for offset, of the data point nearest to the location of the mouse.<br><br> Clicking with the <b>right</b> mouse button will cause a context menu to appear. The <b>Accumulate data tracks</b> option means that data in each tile will be appended to the previous data. If this option is unchecked, data will be displayed for just each individual tile. The <b>Data element selector</b> option works similarly to that associated with the standard 2-D plot display. Clicking on it causes a small submenu to appear that allows you to select different data elements for display." # connect menu signals self._menu.save_this.triggered.connect(self.save_current_display) self._menu.save_all.triggered.connect(self.save_all_displays)
def make(): demo = QMainWindow() toolBar = QToolBar(demo) toolBar.addAction(QWhatsThis.createAction(toolBar)) demo.addToolBar(toolBar) plot = Plot(demo) demo.setCentralWidget(plot) plot.setWhatsThis( "An useless plot to demonstrate how to use event filtering.\n\n" "You can click on the color bar, the scales or move the slider.\n" "All points can be moved using the mouse or the keyboard." ) CanvasPicker(plot) scalePicker = ScalePicker(plot) scalePicker.SIG_CLICKED.connect(plot.insertCurve) demo.resize(540, 400) demo.show() return demo
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): 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 ......")