def build_progress_bar(fig, lastframe, height): vbox = QtWidgets.QVBoxLayout() fig.canvas.setLayout(vbox) width = int(fig.bbox.height * height) bar = QtGui.QSlider(QtCore.Qt.Horizontal) bar.setRange(0, lastframe) bar.setSingleStep(1) bar.setMinimumSize(QtCore.QSize(0, width)) # Add an auto-updating label for the slider value = QtWidgets.QLabel('0 of %d' % lastframe) value.setMinimumSize(QtCore.QSize(0, width)) value.connect(bar, QtCore.SIGNAL('valueChanged(int)'), lambda frame: value.setText("%d of %d" % (frame, lastframe))) hbox = QtWidgets.QHBoxLayout() hbox.addWidget(bar) hbox.addWidget(value) # This spacer will help force the slider down to the bottom of the canvas vspace = QtGui.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) vbox.addItem(vspace) vbox.addLayout(hbox) return bar
def __init__(self, canvas, parent, plot_win, prj, coordinates=True): self.plot_win = plot_win self.prj = prj self.grid_action = None self.flagged_action = None self.flag_action = None self.unflag_action = None self.insert_action = None self.insert_sample = None self.mon_label = None self._ids_flag = None self._flag_mode = None self._flag_start = None self._flag_end = None # custom cursors pan_px = QtGui.QPixmap(os.path.join(self.media, 'pan_cursor.png')) pan_px.setMask(pan_px.mask()) self.pan_cursor = QtGui.QCursor(pan_px) grab_px = QtGui.QPixmap(os.path.join(self.media, 'grab_cursor.png')) grab_px.setMask(grab_px.mask()) self.grab_cursor = QtGui.QCursor(grab_px) NavigationToolbar2QT.__init__(self, canvas=canvas, parent=parent, coordinates=coordinates) self.setIconSize(QtCore.QSize(24, 24)) self.canvas.mpl_connect('button_press_event', self.press) self.canvas.mpl_connect('button_release_event', self.release)
def __init__(self, name, props): super(SliderParam, self).__init__(name, props) self.setLayout( QtWidgets.QHBoxLayout() ) self.slider = QtWidgets.QSlider() self.slider.setMouseTracking(False) self.slider.setProperty("value", 0) self.slider.setOrientation(QtCore.Qt.Horizontal) self.slider.setInvertedAppearance(False) self.slider.setInvertedControls(False) self.slider.setTickPosition(QtWidgets.QSlider.TicksAbove) self.slider.setTickInterval(5) self.value_edit = QtWidgets.QLineEdit('0') self.value_edit.setMinimumSize(QtCore.QSize(20, 0)) self.value_edit.setMaximumWidth(100) self.value_edit.setAlignment( QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.layout().addWidget(self.slider, stretch=4) self.layout().addWidget(self.value_edit, stretch=1) self.slider.valueChanged.connect(self.on_slider_changed) self.value_edit.editingFinished.connect(self.on_box_changed) start_value = self.props['default'] limits = get_reasonable_range_limits(start_value) self.set_minimum(limits[0]) self.set_maximum(limits[1]) self.set_value(start_value)
def __init__(self, canvas, parent, coordinates=True): NavigationToolbar2QT.__init__(self, canvas, parent, coordinates) self.setIconSize(QtCore.QSize(16, 16)) self.ct = None self.mw = None self._idPress1 = None self._idPress2 = None self._idPress3 = None
def _init_toolbar(self): # ! Choose icon theme if self.darkMode == True: self.basedir = os.path.join(self.main_dir, 'data', 'resources', 'images_dark', 'matplotlib-dark-images') else: self.basedir = os.path.join(matplotlib.rcParams['datapath'], 'images') for text, tooltip_text, image_file, callback in self.toolitems: if text is None: self.addSeparator() else: a = self.addAction(self._icon(image_file + '.png'), text, getattr(self, callback)) self._actions[callback] = a if callback in ['zoom', 'pan']: a.setCheckable(True) if tooltip_text is not None: a.setToolTip(tooltip_text) if text == 'Subplots': a = self.addAction(self._icon("qt4_editor_options.png"), 'Customize', self.edit_parameters) a.setToolTip('Edit axis, curve and image parameters') # Add the x,y location widget at the right side of the toolbar # The stretch factor is 1 which means any resizing of the toolbar # will resize this label instead of the buttons. if self.coordinates: self.locLabel = QtWidgets.QLabel("", self) self.locLabel.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTop) self.locLabel.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Ignored)) labelAction = self.addWidget(self.locLabel) labelAction.setVisible(True) # Esthetic adjustments - we need to set these explicitly in PyQt5 # otherwise the layout looks different - but we don't want to set it if # not using HiDPI icons otherwise they look worse than before. if is_pyqt5() and self.canvas._dpi_ratio > 1: self.setIconSize(QtCore.QSize(24, 24)) self.layout().setSpacing(12)
def _init_toolbar(self): self.basedir = resource_filename('VisualPIC.Icons.mpl', '') for text, tooltip_text, image_file, callback in self.toolitems: if text is None: self.addSeparator() else: a = self.addAction(self._icon(image_file + '.svg'), text, getattr(self, callback)) self._actions[callback] = a if callback in ['zoom', 'pan']: a.setCheckable(True) if tooltip_text is not None: a.setToolTip(tooltip_text) if text == 'Subplots': a = self.addAction(self._icon("qt4_editor_options.svg"), 'Customize', self.edit_parameters) a.setToolTip('Edit axis, curve and image parameters') self.buttons = {} # Add the x,y location widget at the right side of the toolbar # The stretch factor is 1 which means any resizing of the toolbar # will resize this label instead of the buttons. if self.coordinates: self.locLabel = QtWidgets.QLabel("", self) self.locLabel.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTop) self.locLabel.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Ignored)) labelAction = self.addWidget(self.locLabel) labelAction.setVisible(True) # reference holder for subplots_adjust window self.adj_window = None # Esthetic adjustments - we need to set these explicitly in PyQt5 # otherwise the layout looks different - but we don't want to set it if # not using HiDPI icons otherwise they look worse than before. if is_pyqt5(): self.setIconSize(QtCore.QSize(24, 24)) self.layout().setSpacing(12)
def __init__(self, parent=None): QtWidgets.QPushButton.__init__(self, parent) self.setFixedSize(20, 20) self.setIconSize(QtCore.QSize(12, 12)) self.clicked.connect(self.choose_color) self._color = QtGui.QColor()
def __init__(self, parent=None): super().__init__(parent) self.setFixedSize(20, 20) self.setIconSize(QtCore.QSize(12, 12)) self.clicked.connect(self.choose_color) self._color = QtGui.QColor()
def __init__(self,gui,core,typ,res): self.gui,self.core= gui,core self.typ,self.res= typ,res QDialog.__init__(self,gui) self.setModal(False) self.setWindowTitle('Plot of results') screenShape = QtWidgets.QDesktopWidget().screenGeometry() self.setGeometry(QRect(5, 5, screenShape.width()*.75, screenShape.height()*.7)) ## main horizontal layout self.horizontalLayout = QHBoxLayout(self) self.horizontalLayout.setContentsMargins(10, 20, 10, 10) ## the left panel vertical layout self.verticalLayout = QVBoxLayout() #self.verticalLayout.setGeometry(QRect(5, 5, 250, screenShape.height()*.68)) ## title if self.typ == 'M' : title = 'Mass balance Graphs' if self.typ == 'Z' : title = 'Zone budget Graphs' label = str(title +' - '+self.res) self.label = QtWidgets.QLabel(self) self.label.setMaximumSize(250, 24) self.label.setText(label) font = QFont() font.setPointSize(9) font.setBold(True) self.label.setFont(font) self.verticalLayout.addWidget(self.label, alignment=Qt.AlignHCenter) ## model time list self.tlist = self.core.getTlist2() ## frame 1 self.frame = QtWidgets.QFrame(self) self.frame.setMaximumSize(QtCore.QSize(250, 35)) self.gl = QGridLayout(self.frame) ## Different type of graph self.label_1 = QtWidgets.QLabel(self.frame) self.label_1.setText("Type of graph") self.gl.addWidget(self.label_1,0,0,1,1) self.plgroup = QComboBox(self) self.plgroup.addItems(['Percent Discrepency','In-Out','Time Series', 'Time Step']) self.plgroup.setCurrentIndex(0) self.plgroup.activated['QString'].connect(self.onTstep) self.gl.addWidget(self.plgroup,0,1,1,1) self.verticalLayout.addWidget(self.frame) ## frame 2 self.frame2 = QtWidgets.QFrame(self) self.frame2.setMaximumSize(QtCore.QSize(250,35)) self.gl2 = QGridLayout(self.frame2) ## Time for time step graph self.label_2 = QtWidgets.QLabel(self.frame2) self.label_2.setText("Time") self.gl2.addWidget(self.label_2,0,0,1,1) self.Tstep = QComboBox(self.frame2) self.Tstep.addItems([str(n) for n in self.tlist]) self.Tstep.setCurrentIndex(0) self.gl2.addWidget(self.Tstep,0,1,1,1) self.verticalLayout.addWidget(self.frame2) self.frame2.hide() ## Choice of zone to perform budget if self.typ == 'Z': ## frame 3 self.frame3 = QtWidgets.QFrame(self) self.frame3.setMaximumSize(QtCore.QSize(250, 35)) self.gl3 = QGridLayout(self.frame3) self.lzname=self.core.diczone['Observation'].dic['obs.1']['name'] self.label_3 = QtWidgets.QLabel(self.frame3) self.label_3.setText("Zone budget zone") self.gl3.addWidget(self.label_3,0,0,1,1) self.zgroup = QComboBox(self.frame3) self.zgroup.addItems([str(n) for n in self.lzname]) self.zgroup.setCurrentIndex(0) self.gl3.addWidget(self.zgroup,0,1,1,1) self.zgroup.activated['QString'].connect(self.updateChoices) self.verticalLayout.addWidget(self.frame3) ## the options :need to go in the interface to search for zones and others self.hlayout=QHBoxLayout() dic=self.getChoices() #self.res,self.typ self.nb = myNoteBookCheck(self.gui,"Options",dic) self.hlayout.addWidget(self.nb) self.nb.layout.removeWidget(self.nb.buttonBox) self.nb.buttonBox.deleteLater() del self.nb.buttonBox self.verticalLayout.addLayout(self.hlayout) self.nb.apply() ## Apply button self.pushButton = QPushButton(self) self.pushButton.setText('Apply') self.verticalLayout.addWidget(self.pushButton, alignment=Qt.AlignHCenter) self.pushButton.clicked.connect(self.buildGraph) ## add vertical layout self.horizontalLayout.addLayout(self.verticalLayout) ## the right panel vertical layout self.verticalLayout2 = QVBoxLayout() ## the matplotlib figure self.figure = Figure(tight_layout=True,figsize=(7.8, 3), dpi=100) self.cnv = FigureCanvas(self.figure) #self._ax = self.cnv.figure.subplots()#.add_axes([0.1, 0.15, 0.7, 0.8]) ## add matplotlib figure #self.horizontalLayout.addWidget(self.cnv) self.verticalLayout2.addWidget(self.cnv) self.toolbar = NavigationToolbar(self.cnv, self) # EV 04/02/20 self.verticalLayout2.addWidget(self.toolbar, alignment=Qt.AlignHCenter) ## Export button self.pushButton2 = QPushButton(self) self.pushButton2.setText('Export') self.verticalLayout2.addWidget(self.pushButton2, alignment=Qt.AlignHCenter) #self.pushButton2.clicked.connect(self.onExport) ## add vertical layout 2 self.horizontalLayout.addLayout(self.verticalLayout2) QMetaObject.connectSlotsByName(self) #OA 1/6/19
def minimumSizeHint(self): return QtCore.QSize(100, 100)
def __init__(self, parent): super(QWidget, self).__init__(parent) self.layout = QVBoxLayout(self) # Initialize tabs ---------------------------------- self.tabs = QTabWidget() self.Load_data = QWidget() # create tab 1 self.SettRzPlot_tab = QWidget() # create tab 2 self.Rz_tab = QWidget() # create tab 3 self.tabs.resize(300, 200) # Add tabs to the Main WIndow self.tabs.addTab(self.Load_data, "Load data") # tab 1 self.tabs.addTab(self.SettRzPlot_tab, "Rz plot Settings") # tab 2 self.tabs.addTab(self.Rz_tab, "Rz plot") # tab 3 # Add tabs to widget self.layout.addWidget(self.tabs) self.setLayout(self.layout) self.show() # ---------------------------------------------------------------------------------- # Load_data tab - content self.data_loaded = False layout_load = QtWidgets.QVBoxLayout(self.Load_data) # main layout sublayout_load = QtWidgets.QGridLayout() # layout for inputs layout_load.addLayout(sublayout_load) # Input widgets # Shot self.Shot_lbl_load = QLabel(self.Load_data) self.Shot_lbl_load.setText('Shot # ') self.Shot_ed_load = QLineEdit(self.Load_data) self.Shot_ed_load.setText('25781') # Diag self.Diag_lbl_load = QLabel(self.Load_data) self.Diag_lbl_load.setText('Diag: ') self.Diag_load = QComboBox(self.Load_data) self.Diag_load.addItems(['ECI', 'TDI']) self.Diag_lbl_EQ_load = QLabel(self.Load_data) self.Diag_lbl_EQ_load.setText('Equilibrium: ') self.Diag_EQ_load = QComboBox(self.Load_data) self.Diag_EQ_load.addItems(['EQH']) # Load button self.Butt_load = QPushButton("Load ECEI and equilibrium data", self.Load_data) self.Butt_load.clicked.connect(self.Load_ECEI_data) # Monitor self.Monitor_load = QtWidgets.QTextBrowser(self.Load_data) self.Monitor_load.setText("Status:\nECEI data is not loaded") # Add widgets to layout sublayout_load.setSpacing(5) sublayout_load.addWidget(self.Shot_lbl_load, 0, 0) sublayout_load.addWidget(self.Diag_lbl_load, 1, 0) sublayout_load.addWidget(self.Diag_lbl_EQ_load, 2, 0) sublayout_load.addWidget(self.Shot_ed_load, 0, 1) sublayout_load.addWidget(self.Diag_load, 1, 1) sublayout_load.addWidget(self.Diag_EQ_load, 2, 1) sublayout_load.addWidget(self.Butt_load, 3, 1) sublayout_2_load = QtWidgets.QGridLayout() # layout for inputs layout_load.addLayout(sublayout_2_load) sublayout_2_load.addWidget(self.Monitor_load, 1, 0) # stretch free space (compress widgets at the top) layout_load.addStretch() # ---------------------------------------------------------------------------------- # Rz plot tab - content # Create layouts layout_RzPl = QtWidgets.QVBoxLayout(self.Rz_tab) # main layout sublayout_RzPl = QtWidgets.QGridLayout() # layout for inputs layout_RzPl.addLayout(sublayout_RzPl) # Input widgets # labels self.tB_lbl_RzPl = QLabel(self.Rz_tab) self.tB_lbl_RzPl.setText('tB [s]:') self.tE_lbl_RzPl = QLabel(self.Rz_tab) self.tE_lbl_RzPl.setText('tE [s]:') self.tCnt_lbl_RzPl = QLabel(self.Rz_tab) self.tCnt_lbl_RzPl.setText('tCenter [s] (optional):') self.dt_lbl_RzPl = QLabel(self.Rz_tab) self.dt_lbl_RzPl.setText('dt [s](optional) :') # filter labels self.Fourier_lbl0_RzPl = QLabel(self.Rz_tab) self.Fourier_lbl0_RzPl.setText('Fourier lowpass f [kHz]:') self.Fourier2_lbl0_RzPl = QLabel(self.Rz_tab) self.Fourier2_lbl0_RzPl.setText('Fourier highpass f [kHz]:') self.SavGol_lbl0_RzPl = QLabel(self.Rz_tab) self.SavGol_lbl0_RzPl.setText('SavGol win_len:') self.SavGol_lbl1_RzPl = QLabel(self.Rz_tab) self.SavGol_lbl1_RzPl.setText('SavGol pol_ord:') self.Binning_lbl_RzPl = QLabel(self.Rz_tab) self.Binning_lbl_RzPl.setText('Binning [kHz]:') self.Contour_lbl_RzPl = QLabel(self.Rz_tab) self.Contour_lbl_RzPl.setText('Contour [1 or 0]') self.NNcont_lbl_RzPl = QLabel(self.Rz_tab) self.NNcont_lbl_RzPl.setText('NNcont:') self.tplot_lbl_RzPl = QLabel(self.Rz_tab) self.tplot_lbl_RzPl.setText('t_plot [s](within tB and tE):') self.dtplot_lbl_RzPl = QLabel(self.Rz_tab) self.dtplot_lbl_RzPl.setText('dt_plot [s]:') self.FourMult_lbl_RzPl = QLabel(self.Rz_tab) self.FourMult_lbl_RzPl.setText('Fourier multiple f [kHz]:') # plot params labels self.vmin_lbl_RzPl = QLabel(self.Rz_tab) self.vmin_lbl_RzPl.setText('vmin:') self.vmax_lbl_RzPl = QLabel(self.Rz_tab) self.vmax_lbl_RzPl.setText('vmax:') self.chzz_lbl_RzPl = QLabel(self.Rz_tab) self.chzz_lbl_RzPl.setText('Remove LOS:') self.chRR_lbl_RzPl = QLabel(self.Rz_tab) self.chRR_lbl_RzPl.setText('Remove R chs:') # velocimetry specific labels self.rhop_lbl_RzPl = QLabel(self.Rz_tab) self.rhop_lbl_RzPl.setText('rho_pol:') # line edits # time edits self.tB_ed_RzPl = QLineEdit(self.Rz_tab) self.tB_ed_RzPl.setText('4.488525') self.tB_ed_RzPl.setMinimumSize(QtCore.QSize(55, 0)) self.tE_ed_RzPl = QLineEdit(self.Rz_tab) self.tE_ed_RzPl.setText('4.489525') self.tE_ed_RzPl.setMinimumSize(QtCore.QSize(55, 0)) self.tCnt_ed_RzPl = QLineEdit(self.Rz_tab) self.tCnt_ed_RzPl.setMinimumSize(QtCore.QSize(50, 0)) self.dt_ed_RzPl = QLineEdit(self.Rz_tab) self.dt_ed_RzPl.setText('0.001') self.dt_ed_RzPl.setMinimumSize(QtCore.QSize(100, 0)) self.Butt_dt_RzPl = QPushButton("Calc t", self.Rz_tab) self.Butt_dt_RzPl.clicked.connect(lambda: self.tBE_from_tCnt(9)) # plot params edits self.vmin_ed_RzPl = QLineEdit(self.Rz_tab) self.vmin_ed_RzPl.setText('None') self.vmin_ed_RzPl.setMinimumSize(QtCore.QSize(40, 0)) self.vmax_ed_RzPl = QLineEdit(self.Rz_tab) self.vmax_ed_RzPl.setText('None') self.vmax_ed_RzPl.setMinimumSize(QtCore.QSize(40, 0)) self.chzz_ed_RzPl = QLineEdit(self.Rz_tab) self.chzz_ed_RzPl.setMinimumSize(QtCore.QSize(100, 0)) self.chRR_ed_RzPl = QLineEdit(self.Rz_tab) self.chRR_ed_RzPl.setMinimumSize(QtCore.QSize(100, 0)) # Filters edits self.Fourier_cut_RzPl = QLineEdit(self.Rz_tab) self.Fourier_cut_RzPl.setText('30.0') self.Fourier2_cut_RzPl = QLineEdit(self.Rz_tab) self.Fourier2_cut_RzPl.setText('2.0') self.SavGol_ed0_RzPl = QLineEdit(self.Rz_tab) self.SavGol_ed0_RzPl.setText('11') self.SavGol_ed0_RzPl.setMinimumSize(QtCore.QSize(20, 0)) self.SavGol_ed1_RzPl = QLineEdit(self.Rz_tab) self.SavGol_ed1_RzPl.setText('3') self.Binning_ed_RzPl = QLineEdit(self.Rz_tab) self.Binning_ed_RzPl.setText('60.0') self.Binning_ed_RzPl.setMinimumSize(QtCore.QSize(40, 0)) self.Contour_ed_RzPl = QLineEdit(self.Rz_tab) self.Contour_ed_RzPl.setText('0') self.NNcont_ed_RzPl = QLineEdit(self.Rz_tab) self.NNcont_ed_RzPl.setText('60') self.tplot_ed_RzPl = QLineEdit(self.Rz_tab) self.tplot_ed_RzPl.setText('4.488550') self.tplot_ed_RzPl.setMinimumSize(QtCore.QSize(50, 0)) self.dtplot_ed_RzPl = QLineEdit(self.Rz_tab) self.dtplot_ed_RzPl.setText('5.0e-6') self.dtplot_ed_RzPl.setMinimumSize(QtCore.QSize(50, 0)) self.FourMult_ed_RzPl = QLineEdit(self.Rz_tab) self.FourMult_ed_RzPl.setText('13.0,15.0;26,30') self.FourMult_ed_RzPl.setMinimumSize(QtCore.QSize(100, 0)) # velocimetry specific line edits self.rhop_ed_RzPl = QLineEdit(self.Rz_tab) self.rhop_ed_RzPl.setText('0.3') self.sendpoints_butt_RzPl = QPushButton("Send t,R,z,r", self.Rz_tab) self.sendpoints_butt_RzPl.clicked.connect(self.send_points) self.clearpoints_butt_RzPl = QPushButton("Clear table", self.Rz_tab) self.clearpoints_butt_RzPl.clicked.connect(self.clear_table) # what to plot (type of filter) self.ImgType_plot_RzPl = QComboBox(self.Rz_tab) self.ImgType_plot_RzPl.addItems([ 'no Image filter', 'Gaussian', 'Median', 'Bilateral', 'Conservative_smoothing' ]) self.type_plot_RzPl = QComboBox(self.Rz_tab) self.type_plot_RzPl.addItems([ 'no 1D filter', 'Fourier highpass', 'Fourier lowpass', 'Fourier both', 'Fourier multiple', 'SavGol', 'Binning' ]) self.Interp_plot_RzPl = QComboBox(self.Rz_tab) self.Interp_plot_RzPl.addItems( ['no interpolation', 'with interpolation', 'set to zero']) # self.Interp_plot_RzPl.setMaximumSize(QtCore.QSize(90, 0)) self.Save_plot_RzPl = QComboBox(self.Rz_tab) self.Save_plot_RzPl.addItems( ['do not save', 'save as pdf', 'save as png']) # plot buttom self.MinusTplot_butt_RzPl = QPushButton("< -dt", self.Rz_tab) self.PlusTplot_butt_RzPl = QPushButton("+dt >", self.Rz_tab) self.tplot_butt_RzPl = QPushButton("plot time", self.Rz_tab) self.MinusTplot_butt_RzPl.clicked.connect(lambda: self.f_Rz_plot(1)) self.PlusTplot_butt_RzPl.clicked.connect(lambda: self.f_Rz_plot(2)) self.tplot_butt_RzPl.clicked.connect(lambda: self.f_Rz_plot(3)) # Add widgets to layout # First row sublayout_RzPl.setSpacing(2) sublayout_RzPl.addWidget(self.tB_lbl_RzPl, 0, 0) sublayout_RzPl.addWidget(self.tB_ed_RzPl, 0, 1) sublayout_RzPl.addWidget(self.tE_lbl_RzPl, 0, 2) sublayout_RzPl.addWidget(self.tE_ed_RzPl, 0, 3) sublayout_RzPl.addWidget(self.tCnt_lbl_RzPl, 0, 4) sublayout_RzPl.addWidget(self.tCnt_ed_RzPl, 0, 5) sublayout_RzPl.addWidget(self.dt_lbl_RzPl, 0, 6) sublayout_RzPl.addWidget(self.dt_ed_RzPl, 0, 7) sublayout_RzPl.addWidget(self.Butt_dt_RzPl, 0, 8) # Second row sublayout_RzPl.addWidget(self.Fourier2_lbl0_RzPl, 1, 0) sublayout_RzPl.addWidget(self.Fourier2_cut_RzPl, 1, 1) sublayout_RzPl.addWidget(self.Fourier_lbl0_RzPl, 1, 2) sublayout_RzPl.addWidget(self.Fourier_cut_RzPl, 1, 3) sublayout_RzPl.addWidget(self.FourMult_lbl_RzPl, 1, 4) sublayout_RzPl.addWidget(self.FourMult_ed_RzPl, 1, 5) ###### sublayout_RzPl.addWidget(self.SavGol_lbl0_RzPl, 1, 6) sublayout_RzPl.addWidget(self.SavGol_ed0_RzPl, 1, 7) sublayout_RzPl.addWidget(self.SavGol_lbl1_RzPl, 1, 8) sublayout_RzPl.addWidget(self.SavGol_ed1_RzPl, 1, 9) sublayout_RzPl.addWidget(self.Binning_lbl_RzPl, 1, 10) sublayout_RzPl.addWidget(self.Binning_ed_RzPl, 1, 11) ###### sublayout_RzPl.addWidget(self.chzz_lbl_RzPl, 2, 0) sublayout_RzPl.addWidget(self.chzz_ed_RzPl, 2, 1) sublayout_RzPl.addWidget(self.chRR_lbl_RzPl, 2, 2) sublayout_RzPl.addWidget(self.chRR_ed_RzPl, 2, 3) ###### sublayout_RzPl.addWidget(self.vmin_lbl_RzPl, 2, 4) sublayout_RzPl.addWidget(self.vmin_ed_RzPl, 2, 5) sublayout_RzPl.addWidget(self.vmax_lbl_RzPl, 2, 6) sublayout_RzPl.addWidget(self.vmax_ed_RzPl, 2, 7) sublayout_RzPl.addWidget(self.Contour_lbl_RzPl, 2, 8) sublayout_RzPl.addWidget(self.Contour_ed_RzPl, 2, 9) sublayout_RzPl.addWidget(self.NNcont_lbl_RzPl, 2, 10) sublayout_RzPl.addWidget(self.NNcont_ed_RzPl, 2, 11) ##### ###### # Third row sublayout_RzPl.addWidget(self.tplot_lbl_RzPl, 3, 0) sublayout_RzPl.addWidget(self.tplot_ed_RzPl, 3, 1) sublayout_RzPl.addWidget(self.dtplot_lbl_RzPl, 3, 2) sublayout_RzPl.addWidget(self.dtplot_ed_RzPl, 3, 3) # Fourth row sublayout_RzPl.addWidget(self.rhop_lbl_RzPl, 4, 0) sublayout_RzPl.addWidget(self.rhop_ed_RzPl, 4, 1) sublayout_RzPl.addWidget(self.sendpoints_butt_RzPl, 4, 2) sublayout_RzPl.addWidget(self.clearpoints_butt_RzPl, 4, 3) # Plot control sublayout_RzPl.addWidget(self.ImgType_plot_RzPl, 1, 12) sublayout_RzPl.addWidget(self.type_plot_RzPl, 2, 12) sublayout_RzPl.addWidget(self.Save_plot_RzPl, 3, 7) sublayout_RzPl.addWidget(self.Interp_plot_RzPl, 3, 8) sublayout_RzPl.addWidget(self.MinusTplot_butt_RzPl, 3, 10) sublayout_RzPl.addWidget(self.PlusTplot_butt_RzPl, 3, 11) sublayout_RzPl.addWidget(self.tplot_butt_RzPl, 3, 12) # Add matplotlib plot self.figure_RzPl = Figure(figsize=(5, 3), constrained_layout=False) self.static_canvas_RzPl = FigureCanvas(self.figure_RzPl) layout_RzPl.addWidget(self.static_canvas_RzPl, QtCore.Qt.AlignTop) # align the plot up layout_RzPl.addStretch() # stretch plot in all free space self.toolbar = NavigationToolbar( self.static_canvas_RzPl, self.Rz_tab, coordinates=True) # add toolbar below the plot layout_RzPl.addWidget(self.toolbar) self._static_ax = self.static_canvas_RzPl.figure.subplots() # add axes # velcimetry data self.Monitor_RzPl = QtWidgets.QTextBrowser(self.Rz_tab) self.Monitor_RzPl.setText("NN\tt\tR\tz\tr\n") self.counter = 1 self.Monitor_RzPl.setMaximumSize(QtCore.QSize(1920, 50)) sublayout2_RzPl = QtWidgets.QVBoxLayout() # layout for monitor layout_RzPl.addLayout(sublayout2_RzPl) sublayout2_RzPl.addWidget(self.Monitor_RzPl, 0) # ---------------------------------------------------------------------------------- # SettRz tab - content # Create layouts layout_RzSet = QtWidgets.QVBoxLayout( self.SettRzPlot_tab) # main layout sublayout_RzSet = QtWidgets.QGridLayout() # layout for inputs layout_RzSet.addLayout(sublayout_RzSet) # Input widgets # labels self.one_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.one_lbl_RzSet.setText('Gaussian filter:') self.two_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.two_lbl_RzSet.setText('Median filter:') self.three_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.three_lbl_RzSet.setText('Bilateral filter:') self.four_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.four_lbl_RzSet.setText('Conservative smoothing filter:') # filters parameters self.BilKernSize_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.BilKernSize_lbl_RzSet.setText('Kernel size:') self.BilS0_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.BilS0_lbl_RzSet.setText('s0:') self.BilS1_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.BilS1_lbl_RzSet.setText('s1:') self.MedKernSize_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.MedKernSize_lbl_RzSet.setText('Kernel size:') self.ConsSize_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.ConsSize_lbl_RzSet.setText('Neighborhood size:') self.GausSigma_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.GausSigma_lbl_RzSet.setText('sigma:') # Line edits (inputs) self.GausSigma_ed_RzSet = QLineEdit(self.SettRzPlot_tab) self.GausSigma_ed_RzSet.setText('1.0') self.BilKern_type_RzSet = QComboBox(self.SettRzPlot_tab) self.BilKern_type_RzSet.addItems(['disk', 'square']) self.BilKernSize_ed_RzSet = QLineEdit(self.SettRzPlot_tab) self.BilKernSize_ed_RzSet.setText('1') self.BilS0_ed_RzSet = QLineEdit(self.SettRzPlot_tab) self.BilS0_ed_RzSet.setText('100') self.BilS1_ed_RzSet = QLineEdit(self.SettRzPlot_tab) self.BilS1_ed_RzSet.setText('100') self.MedKern_type_RzSet = QComboBox(self.SettRzPlot_tab) self.MedKern_type_RzSet.addItems(['disk', 'square']) self.MedKernSize_ed_RzSet = QLineEdit(self.SettRzPlot_tab) self.MedKernSize_ed_RzSet.setText('1') self.ConsSize_ed_RzSet = QLineEdit(self.SettRzPlot_tab) self.ConsSize_ed_RzSet.setText('2') sublayout_RzSet.setSpacing(2) # First row sublayout_RzSet.addWidget(self.one_lbl_RzSet, 0, 0) sublayout_RzSet.addWidget(self.GausSigma_lbl_RzSet, 0, 2) sublayout_RzSet.addWidget(self.GausSigma_ed_RzSet, 0, 3) # Second row sublayout_RzSet.addWidget(self.two_lbl_RzSet, 1, 0) sublayout_RzSet.addWidget(self.MedKern_type_RzSet, 1, 1) sublayout_RzSet.addWidget(self.MedKernSize_lbl_RzSet, 1, 2) sublayout_RzSet.addWidget(self.MedKernSize_ed_RzSet, 1, 3) # Third row sublayout_RzSet.addWidget(self.three_lbl_RzSet, 2, 0) sublayout_RzSet.addWidget(self.BilKern_type_RzSet, 2, 1) sublayout_RzSet.addWidget(self.BilKernSize_lbl_RzSet, 2, 2) sublayout_RzSet.addWidget(self.BilKernSize_ed_RzSet, 2, 3) sublayout_RzSet.addWidget(self.BilS0_lbl_RzSet, 2, 4) sublayout_RzSet.addWidget(self.BilS0_ed_RzSet, 2, 5) sublayout_RzSet.addWidget(self.BilS1_lbl_RzSet, 2, 6) sublayout_RzSet.addWidget(self.BilS1_ed_RzSet, 2, 7) # Fourth row sublayout_RzSet.addWidget(self.four_lbl_RzSet, 3, 0) sublayout_RzSet.addWidget(self.ConsSize_lbl_RzSet, 3, 2) sublayout_RzSet.addWidget(self.ConsSize_ed_RzSet, 3, 3) sublayout1_RzSet = QtWidgets.QVBoxLayout() # one more layout for title layout_RzSet.addLayout(sublayout1_RzSet) self.Info1_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.Info1_lbl_RzSet.setText( '====== Matrix for interpolation (scipy.interpolate.interp2d, type = cubic) or "set to zero" options ======' ) sublayout1_RzSet.addWidget(self.Info1_lbl_RzSet) sublayout2_RzSet = QtWidgets.QGridLayout( ) # one more layout for interpolation layout_RzSet.addLayout(sublayout2_RzSet) LOSlabels = {} self.LOSlabels = {} for i_L in range(20): LOSlabels['%d' % (i_L)] = (i_L, 0) for sText, pos in LOSlabels.items(): # QLabels self.LOSlabels[sText] = QLabel("LOS: %d" % (int(sText) + 1)) sublayout2_RzSet.addWidget(self.LOSlabels[sText], pos[0] + 1, pos[1]) checks = {} self.checks = {} for i_L in range(20): for i_R in range(8): checks['%d,%d' % (i_L, i_R)] = (i_L, i_R) for sText, pos in checks.items(): # QCheckBoxes self.checks[sText] = QCheckBox("%d,%d" % (pos[0] + 1, pos[1] + 1)) sublayout2_RzSet.addWidget(self.checks[sText], pos[0] + 1, pos[1] + 1) sublayout2_RzSet.setSpacing(2) sublayout3_RzSet = QtWidgets.QHBoxLayout() # one more layout for path layout_RzSet.addLayout(sublayout3_RzSet) self.path_lbl_RzSet = QLabel(self.SettRzPlot_tab) self.path_lbl_RzSet.setText( 'Path to save Rz plots (path should end with "/" symbol):') self.path_ed_RzSet = QLineEdit(self.SettRzPlot_tab) self.path_ed_RzSet.setText('/afs/ipp/home/o/osam/Documents/output/') sublayout3_RzSet.addWidget(self.path_lbl_RzSet) sublayout3_RzSet.addWidget(self.path_ed_RzSet) layout_RzSet.addStretch( ) # stretch free space (compress widgets at the top)
def __init__(self, *args, **kwargs): super(UiSubplotTool, self).__init__(*args, **kwargs) self.setObjectName('SubplotTool') self.resize(450, 265) gbox = QtWidgets.QGridLayout(self) self.setLayout(gbox) # groupbox borders groupbox = QtWidgets.QGroupBox('Borders', self) gbox.addWidget(groupbox, 6, 0, 1, 1) self.verticalLayout = QtWidgets.QVBoxLayout(groupbox) self.verticalLayout.setSpacing(0) # slider top self.hboxtop = QtWidgets.QHBoxLayout() self.labeltop = QtWidgets.QLabel('top', self) self.labeltop.setMinimumSize(QtCore.QSize(50, 0)) self.labeltop.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.slidertop = QtWidgets.QSlider(self) self.slidertop.setMouseTracking(False) self.slidertop.setProperty("value", 0) self.slidertop.setOrientation(QtCore.Qt.Horizontal) self.slidertop.setInvertedAppearance(False) self.slidertop.setInvertedControls(False) self.slidertop.setTickPosition(QtWidgets.QSlider.TicksAbove) self.slidertop.setTickInterval(100) self.topvalue = QtWidgets.QLabel('0', self) self.topvalue.setMinimumSize(QtCore.QSize(30, 0)) self.topvalue.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.verticalLayout.addLayout(self.hboxtop) self.hboxtop.addWidget(self.labeltop) self.hboxtop.addWidget(self.slidertop) self.hboxtop.addWidget(self.topvalue) # slider bottom hboxbottom = QtWidgets.QHBoxLayout() labelbottom = QtWidgets.QLabel('bottom', self) labelbottom.setMinimumSize(QtCore.QSize(50, 0)) labelbottom.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.sliderbottom = QtWidgets.QSlider(self) self.sliderbottom.setMouseTracking(False) self.sliderbottom.setProperty("value", 0) self.sliderbottom.setOrientation(QtCore.Qt.Horizontal) self.sliderbottom.setInvertedAppearance(False) self.sliderbottom.setInvertedControls(False) self.sliderbottom.setTickPosition(QtWidgets.QSlider.TicksAbove) self.sliderbottom.setTickInterval(100) self.bottomvalue = QtWidgets.QLabel('0', self) self.bottomvalue.setMinimumSize(QtCore.QSize(30, 0)) self.bottomvalue.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.verticalLayout.addLayout(hboxbottom) hboxbottom.addWidget(labelbottom) hboxbottom.addWidget(self.sliderbottom) hboxbottom.addWidget(self.bottomvalue) # slider left hboxleft = QtWidgets.QHBoxLayout() labelleft = QtWidgets.QLabel('left', self) labelleft.setMinimumSize(QtCore.QSize(50, 0)) labelleft.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.sliderleft = QtWidgets.QSlider(self) self.sliderleft.setMouseTracking(False) self.sliderleft.setProperty("value", 0) self.sliderleft.setOrientation(QtCore.Qt.Horizontal) self.sliderleft.setInvertedAppearance(False) self.sliderleft.setInvertedControls(False) self.sliderleft.setTickPosition(QtWidgets.QSlider.TicksAbove) self.sliderleft.setTickInterval(100) self.leftvalue = QtWidgets.QLabel('0', self) self.leftvalue.setMinimumSize(QtCore.QSize(30, 0)) self.leftvalue.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.verticalLayout.addLayout(hboxleft) hboxleft.addWidget(labelleft) hboxleft.addWidget(self.sliderleft) hboxleft.addWidget(self.leftvalue) # slider right hboxright = QtWidgets.QHBoxLayout() self.labelright = QtWidgets.QLabel('right', self) self.labelright.setMinimumSize(QtCore.QSize(50, 0)) self.labelright.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.sliderright = QtWidgets.QSlider(self) self.sliderright.setMouseTracking(False) self.sliderright.setProperty("value", 0) self.sliderright.setOrientation(QtCore.Qt.Horizontal) self.sliderright.setInvertedAppearance(False) self.sliderright.setInvertedControls(False) self.sliderright.setTickPosition(QtWidgets.QSlider.TicksAbove) self.sliderright.setTickInterval(100) self.rightvalue = QtWidgets.QLabel('0', self) self.rightvalue.setMinimumSize(QtCore.QSize(30, 0)) self.rightvalue.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.verticalLayout.addLayout(hboxright) hboxright.addWidget(self.labelright) hboxright.addWidget(self.sliderright) hboxright.addWidget(self.rightvalue) # groupbox spacings groupbox = QtWidgets.QGroupBox('Spacings', self) gbox.addWidget(groupbox, 7, 0, 1, 1) self.verticalLayout = QtWidgets.QVBoxLayout(groupbox) self.verticalLayout.setSpacing(0) # slider hspace hboxhspace = QtWidgets.QHBoxLayout() self.labelhspace = QtWidgets.QLabel('hspace', self) self.labelhspace.setMinimumSize(QtCore.QSize(50, 0)) self.labelhspace.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.sliderhspace = QtWidgets.QSlider(self) self.sliderhspace.setMouseTracking(False) self.sliderhspace.setProperty("value", 0) self.sliderhspace.setOrientation(QtCore.Qt.Horizontal) self.sliderhspace.setInvertedAppearance(False) self.sliderhspace.setInvertedControls(False) self.sliderhspace.setTickPosition(QtWidgets.QSlider.TicksAbove) self.sliderhspace.setTickInterval(100) self.hspacevalue = QtWidgets.QLabel('0', self) self.hspacevalue.setMinimumSize(QtCore.QSize(30, 0)) self.hspacevalue.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.verticalLayout.addLayout(hboxhspace) hboxhspace.addWidget(self.labelhspace) hboxhspace.addWidget(self.sliderhspace) hboxhspace.addWidget(self.hspacevalue) # slider hspace # slider wspace hboxwspace = QtWidgets.QHBoxLayout() self.labelwspace = QtWidgets.QLabel('wspace', self) self.labelwspace.setMinimumSize(QtCore.QSize(50, 0)) self.labelwspace.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.sliderwspace = QtWidgets.QSlider(self) self.sliderwspace.setMouseTracking(False) self.sliderwspace.setProperty("value", 0) self.sliderwspace.setOrientation(QtCore.Qt.Horizontal) self.sliderwspace.setInvertedAppearance(False) self.sliderwspace.setInvertedControls(False) self.sliderwspace.setTickPosition(QtWidgets.QSlider.TicksAbove) self.sliderwspace.setTickInterval(100) self.wspacevalue = QtWidgets.QLabel('0', self) self.wspacevalue.setMinimumSize(QtCore.QSize(30, 0)) self.wspacevalue.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.verticalLayout.addLayout(hboxwspace) hboxwspace.addWidget(self.labelwspace) hboxwspace.addWidget(self.sliderwspace) hboxwspace.addWidget(self.wspacevalue) # button bar hbox2 = QtWidgets.QHBoxLayout() gbox.addLayout(hbox2, 8, 0, 1, 1) self.tightlayout = QtWidgets.QPushButton('Tight Layout', self) spacer = QtWidgets.QSpacerItem(5, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.resetbutton = QtWidgets.QPushButton('Reset', self) self.donebutton = QtWidgets.QPushButton('Close', self) self.donebutton.setFocus() hbox2.addWidget(self.tightlayout) hbox2.addItem(spacer) hbox2.addWidget(self.resetbutton) hbox2.addWidget(self.donebutton) self.donebutton.clicked.connect(self.accept)
def sizeHint(self, *args, **kwargs): return QtCore.QSize(100, 400)
def __init__(self, gui, core, typ, res): self.gui, self.core = gui, core self.typ, self.res = typ, res QDialog.__init__(self, gui) # OA 6/11/18 added gui (self,gui) self.setModal(False) self.setWindowTitle('Plot of results') screenShape = QtWidgets.QDesktopWidget().screenGeometry() self.setGeometry( QRect(5, 5, screenShape.width() * .75, screenShape.height() * .7)) ## main horizontal layout self.horizontalLayout = QHBoxLayout(self) self.horizontalLayout.setContentsMargins(10, 20, 10, 10) ## the left panel vertical layout self.verticalLayout = QVBoxLayout() #self.verticalLayout.setGeometry(QRect(5,5,250,screenShape.height()*.68)) ## title if self.typ == 'B': title = 'Time-series graph' if self.typ == 'P': title = 'Horizontal profile graph' if self.typ == 'V': title = 'Vertical profile graph' if self.typ == 'X': title = 'Calibration graph' label = str(title + ' - ' + self.res) self.label = QtWidgets.QLabel(self) self.label.setMaximumSize(250, 24) self.label.setText(label) font = QFont() font.setPointSize(9) font.setBold(True) self.label.setFont(font) self.verticalLayout.addWidget(self.label, alignment=Qt.AlignHCenter) ## model time list self.tlist = self.core.getTlist2() ## frame self.frame = QtWidgets.QFrame(self) self.frame.setMaximumSize(QtCore.QSize(250, 60)) self.gl = QGridLayout(self.frame) ## type of result if self.res != 'W content': self.label_0 = QtWidgets.QLabel(self.frame) #self.label_0.setMaximumSize(QtCore.QSize(40, 20)) self.label_0.setText("Type of result") self.gl.addWidget(self.label_0, 0, 0, 1, 1) self.rgroup = QComboBox(self) if self.res == 'Flow': # EV 3/12/21 mm, mval = self.core.dicaddin['usedM_Modflow'] v1, v2 = mval[mm.index('UPW')], mval[mm.index('UZF')] mod = self.core.dicaddin['Model']['group'] if (v1 == 2 or v2 == 2) and (mod == 'Modflow series'): self.rgroup.addItems(['Head', 'W content' ]) #,'Flux']) #EV 02/03/20 else: self.rgroup.addItems(['Head']) if self.res in ['Transport', 'Chemistry']: self.rgroup.addItems([ 'Concentration', 'Weighted concentration', 'Mass discharge', 'Mass Flux' ]) self.rgroup.setCurrentIndex(0) self.gl.addWidget(self.rgroup, 0, 1, 1, 1) ## Plot order combo box for chemistry if self.res == 'Chemistry' and self.typ == 'B': self.label_1 = QtWidgets.QLabel(self.frame) #self.label_1.setMaximumSize(QtCore.QSize(40, 20)) self.label_1.setText("Plot order") self.gl.addWidget(self.label_1, 1, 0, 1, 1) self.plgroup = QComboBox(self) self.plgroup.addItems(['By zone', 'By species']) self.plgroup.setCurrentIndex(0) self.gl.addWidget(self.plgroup, 1, 1, 1, 1) #!self.verticalLayout.addWidget(self.plgroup) ## Time combo box for profile and calibration graph if self.typ in ['P', 'V', 'X']: #=='P' or self.typ=='X': #!self.frame = QtWidgets.QFrame(self) #!self.frame.setMaximumSize(QtCore.QSize(120, 38)) #!self.horizontalLayout2 = QHBoxLayout(self.frame) #!self.horizontalLayout2.setContentsMargins(0, 0, 0, 0) #!self.horizontalLayout2.setSpacing(0) self.label_2 = QtWidgets.QLabel(self.frame) self.label_2.setMaximumSize(QtCore.QSize(40, 20)) self.label_2.setText("Time") self.gl.addWidget(self.label_2, 1, 0, 1, 1) #!self.horizontalLayout2.addWidget(self.label_2) if self.typ == 'X': self.tlist = list(self.tlist) self.tlist.insert(0, 'All') self.Tstep = QComboBox(self.frame) self.Tstep.addItems([str(n) for n in self.tlist]) self.Tstep.setCurrentIndex(0) self.gl.addWidget(self.Tstep, 1, 1, 1, 1) #!self.horizontalLayout2.addWidget(self.Tstep) #!self.verticalLayout.addWidget(self.frame) self.verticalLayout.addWidget(self.frame) ## choise plot obsData if self.typ == 'B': # only for time series graphs for now (or typ=='P') self.checkBox = QCheckBox(self) self.checkBox.setText("Observed Data") self.verticalLayout.addWidget(self.checkBox) ## the options :need to go in the interface to search for zones and others dic = self.getChoices(self.res, self.typ) self.nb = myNoteBookCheck(self.gui, "Options", dic) self.nb.layout.removeWidget(self.nb.buttonBox) #EV 06/12 self.nb.buttonBox.deleteLater() del self.nb.buttonBox #self.nb.setGeometry(QRect(5, 5, 250,270)) self.verticalLayout.addWidget(self.nb) self.nb.apply() ## Apply button self.pushButton = QPushButton(self) self.pushButton.setText('Apply') self.verticalLayout.addWidget(self.pushButton, alignment=Qt.AlignHCenter) self.pushButton.clicked.connect(self.buildPlot) ## add vertical layout self.horizontalLayout.addLayout(self.verticalLayout) ## the right panel vertical layout self.verticalLayout2 = QVBoxLayout() ## the matplotlib figure self.figure = Figure(tight_layout=True, figsize=(7.8, 3), dpi=100) # EV 04/02/20 self.cnv = FigureCanvas(self.figure) #self._ax = self.cnv.figure.subplots()#.add_axes([0.1, 0.15, 0.7, 0.8]) ## add matplotlib figure #self.horizontalLayout.addWidget(self.cnv) self.verticalLayout2.addWidget(self.cnv) self.toolbar = NavigationToolbar(self.cnv, self) # EV 04/02/20 self.verticalLayout2.addWidget( self.toolbar, alignment=Qt.AlignHCenter) # EV 04/02/20 ## Export button self.pushButton2 = QPushButton(self) self.pushButton2.setText('Export') self.verticalLayout2.addWidget(self.pushButton2, alignment=Qt.AlignHCenter) self.pushButton2.clicked.connect(self.onExport) ## add vertical layout 2 self.horizontalLayout.addLayout(self.verticalLayout2) QMetaObject.connectSlotsByName(self) #OA 1/6/19
def minumumSizeHint(self): return QtCore.QSize(10, 10)
def sizeHint(self): w, h = self.get_width_height() return QtCore.QSize(w, h)