def __init__(self, data, parent): """ Constructor. Args: data - the save edf info object holding the patient fields parent - the main gui window object """ super().__init__() self.left = 10 self.top = 10 self.title = 'EDF Anonymizer' size_object = QtWidgets.QDesktopWidget().screenGeometry(-1) self.width = size_object.width() * 0.2 self.height = size_object.height() * 0.2 self.field_defaults = [ bytes(" " * 80, 'utf-8'), bytes(" " * 80, 'utf-8'), bytes("01.01.01", 'utf-8'), bytes("01.01.01", 'utf-8') ] self.data = data self.parent = parent self.MONTHS = [ "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ] self.init_ui()
def setup_ui(self): """ Setup UI for the color options window. """ self.setWindowTitle(self.title) centerPoint = QtWidgets.QDesktopWidget().availableGeometry().center() self.setGeometry(centerPoint.x() - self.width / 2, centerPoint.y() - self.height / 2, self.width, self.height) grid_lt = QGridLayout() lbl_info = QLabel( "Add a frequency band with a name. You may add up to 5.") grid_lt.addWidget(lbl_info, 0, 0, 1, 5) lbl_name = QLabel("Name: ") grid_lt.addWidget(lbl_name, 1, 0) self.input_name = QLineEdit() grid_lt.addWidget(self.input_name, 1, 1) lbl_fs = QLabel("Frequency: ") grid_lt.addWidget(lbl_fs, 1, 2) self.input_fs0 = QDoubleSpinBox(self) self.input_fs0.setValue(0) self.input_fs0.setRange(0, self.data.fs / 2) grid_lt.addWidget(self.input_fs0, 1, 3) lbl_fs_to = QLabel(" to ") grid_lt.addWidget(lbl_fs_to, 1, 4) self.input_fs1 = QDoubleSpinBox(self) self.input_fs1.setValue(0) self.input_fs1.setRange(0, self.data.fs / 2) grid_lt.addWidget(self.input_fs1, 1, 5) hz_lbl = QLabel("Hz") grid_lt.addWidget(hz_lbl, 1, 6) self.btn_add = QPushButton("+") grid_lt.addWidget(self.btn_add, 1, 7) self.grid_list = QGridLayout() grid_lt.addLayout(self.grid_list, 2, 0, 1, 7) prev_fs = ["alpha", "beta", "gamma", "delta", "theta"] for fs_band in self.data.fs_bands.keys(): if not fs_band in prev_fs: self.fs_band_lbls[fs_band] = QLabel( fs_band + ": " + str(self.data.fs_bands[fs_band][0]) + " to " + str(self.data.fs_bands[fs_band][1]) + "Hz") self.grid_list.addWidget(self.fs_band_lbls[fs_band]) self.btn_exit = QPushButton('Ok', self) grid_lt.addWidget(self.btn_exit, 3, 5, 1, 2) self.setLayout(grid_lt) self.set_signals_slots() self.show()
def setup_ui(self): """ Setup the UI """ self.setWindowTitle(self.title) center_point = QtWidgets.QDesktopWidget().availableGeometry().center() self.setGeometry(center_point.x() - self.width / 2, center_point.y() - self.height / 2, self.width, self.height) grid = QGridLayout() self.chn_combobox = QComboBox() self.chn_combobox.addItems(["<select channel>"]) lbl_info = QLabel( "To hide the plot, click \n\"Clear\" and then \"Ok\".") grid.addWidget(lbl_info, 3, 0) my_font = QFont() my_font.setBold(True) lbl_info.setFont(my_font) lbl_chn = QLabel("Select a channel for \nspectrogram plotting: ") grid.addWidget(lbl_chn, 1, 0) grid.addWidget(self.chn_combobox, 1, 1, 1, 3) lblfsaxis = QLabel("x-axis (Hz): ") grid.addWidget(lblfsaxis, 2, 0) self.btn_get_min_fs = QDoubleSpinBox(self) self.btn_get_min_fs.setRange(0, self.parent.edf_info.fs / 2) self.btn_get_min_fs.setValue(self.data.min_fs) self.btn_get_min_fs.setDecimals(3) grid.addWidget(self.btn_get_min_fs, 2, 1) lblfsto = QLabel(" to ") grid.addWidget(lblfsto, 2, 2) self.btn_get_max_fs = QDoubleSpinBox(self) self.btn_get_max_fs.setDecimals(3) self.btn_get_max_fs.setRange(0, self.parent.edf_info.fs / 2) self.btn_get_max_fs.setValue(self.data.max_fs) grid.addWidget(self.btn_get_max_fs, 2, 3) self.btn_clear = QPushButton('Clear', self) grid.addWidget(self.btn_clear, 3, 1, 1, 2) self.btn_exit = QPushButton('Ok', self) grid.addWidget(self.btn_exit, 3, 3) self.setLayout(grid) self.set_sig_slots()
def setup_ui(self): """ Setup UI for the organize channels window. """ grid_lt = QGridLayout() self.scroll = QScrollArea() self.scroll.setMinimumWidth(120) self.scroll.setMinimumHeight(200) self.scroll.setWidgetResizable(True) self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.chn_qlist = QListWidget() self.chn_qlist.setSelectionMode(QAbstractItemView.SingleSelection) self.chn_qlist.setDragEnabled(True) self.chn_qlist.setDragDropMode(QAbstractItemView.InternalMove) self.chn_qlist.setDropIndicatorShown(True) self.scroll.setWidget(self.chn_qlist) self.populateChnList() self.setWindowTitle(self.title) centerPoint = QtWidgets.QDesktopWidget().availableGeometry().center() self.setGeometry(centerPoint.x() - self.width / 2, centerPoint.y() - self.height / 2, self.width, self.height) lbl_info = QLabel("Drag and drop channels \n to change their order: ") grid_lt.addWidget(lbl_info,0,0) btn_exit = QPushButton('Ok', self) btn_exit.clicked.connect(self.updateChnOrder) grid_lt.addWidget(btn_exit,2,0) grid_lt.addWidget(self.scroll,1,0) self.setLayout(grid_lt) self.show()
def setup_ui(self): """ Setup the UI for the filter options window. """ layout = QGridLayout() self.setWindowTitle(self.title) center_point = QtWidgets.QDesktopWidget().availableGeometry().center() self.setGeometry(center_point.x() - self.width / 2, center_point.y() - self.height / 2, self.width, self.height) self.btn_exit = QPushButton('Ok', self) layout.addWidget(self.btn_exit,4,3) self.cbox_lp = QCheckBox("Lowpass",self) self.cbox_lp.setToolTip("Click to filter") if self.data.do_lp: self.cbox_lp.setChecked(True) layout.addWidget(self.cbox_lp,0,0) self.btn_get_lp = QDoubleSpinBox(self) self.btn_get_lp.setValue(self.data.lp) self.btn_get_lp.setRange(0, self.data.fs / 2) layout.addWidget(self.btn_get_lp,0,1) lp_hz_lbl = QLabel("Hz",self) layout.addWidget(lp_hz_lbl,0,2) self.cbox_hp= QCheckBox("Highpass",self) self.cbox_hp.setToolTip("Click to filter") if self.data.do_hp: self.cbox_hp.setChecked(True) layout.addWidget(self.cbox_hp,1,0) self.btn_get_hp = QDoubleSpinBox(self) self.btn_get_hp.setValue(self.data.hp) self.btn_get_hp.setRange(0, self.data.fs / 2) layout.addWidget(self.btn_get_hp,1,1) hp_hz_lbl = QLabel("Hz",self) layout.addWidget(hp_hz_lbl,1,2) self.cbox_notch = QCheckBox("Notch",self) self.cbox_notch.setToolTip("Click to filter") if self.data.do_notch: self.cbox_notch.setChecked(True) layout.addWidget(self.cbox_notch,2,0) self.btn_get_notch = QDoubleSpinBox(self) self.btn_get_notch.setValue(self.data.notch) self.btn_get_notch.setRange(0, self.data.fs / 2) layout.addWidget(self.btn_get_notch,2,1) notch_hz_lbl = QLabel("Hz",self) layout.addWidget(notch_hz_lbl,2,2) self.cbox_bp = QCheckBox("Bandpass",self) self.cbox_bp.setToolTip("Click to filter") if self.data.do_bp: self.cbox_bp.setChecked(True) layout.addWidget(self.cbox_bp,3,0) self.btn_get_bp1 = QDoubleSpinBox(self) self.btn_get_bp1.setValue(self.data.bp1) self.btn_get_bp1.setRange(0, self.data.fs / 2) layout.addWidget(self.btn_get_bp1,3,1) bp_to_lbl = QLabel("to",self) layout.addWidget(bp_to_lbl,3,2) self.btn_get_bp2 = QDoubleSpinBox(self) self.btn_get_bp2.setValue(self.data.bp2) self.btn_get_bp2.setRange(0, self.data.fs / 2) layout.addWidget(self.btn_get_bp2,3,3) notch_hz_lbl = QLabel("Hz",self) layout.addWidget(notch_hz_lbl,3,4) self.setLayout(layout) self.set_signals_slots() self.show()
def setup_ui(self): """ Setup window UI """ layout = QGridLayout() layout.setSpacing(4) self.setWindowTitle(self.title) center_point = QtWidgets.QDesktopWidget().availableGeometry().center() self.setGeometry(center_point.x() - self.width / 2, center_point.y() - self.height / 2, self.width, self.height) info_lbl = QLabel(self) info_lbl.setText( "Loading predictions:" + "\n" + "\n - Must be pytorch (.pt) files" + "\n - Can load either predictions OR preprocessed data and a model" + "\n - Output is expected to be of length (k * number of samples in" + " the edf file) = c" + "\n where k and c are integers" "\n - Output will be assumed to be for non-overlapping intervals" + " of constant width" + "\n - Channel-wise predictions will be plotted starting from the" + " top of the screen" + "\n - Predictions are assumed to be binary" + "\n - To use multi-class predictions, select 'multi-class'" + "\n - For multi-class predictions, output must be size" + "\n (num predictions, <chns, optional>, num classes)") layout.addWidget(info_lbl, 0, 0, 1, 4) layout.addWidget(QLabel(), 1, 0, 1, 4) layout.addWidget(QHLine(), 2, 0, 1, 4) layout.addWidget(QLabel(), 3, 0, 1, 4) ud = 4 self.cbox_preds = QCheckBox("Plot predictions from file", self) self.cbox_model = QCheckBox("Plot model predictions", self) self.cbox_model.toggled.connect(self.model_checked) self.cbox_model.setToolTip("Click to plot model predictions") if self.data.plot_model_preds == 1: self.cbox_model.setChecked(True) elif self.data.plot_model_preds == 1: self.cbox_model.setChecked(False) self.data.plot_model_preds = 0 layout.addWidget(self.cbox_model, ud, 0) button_load_pt_file = QPushButton("Load preprocessed data", self) button_load_pt_file.clicked.connect(self.load_pt_data) button_load_pt_file.setToolTip( "Click to load preprocessed data (as a torch tensor)") layout.addWidget(button_load_pt_file, ud, 1) self.label_load_pt_file = QLabel("No data loaded.", self) if self.data.data_loaded == 1: self.label_load_pt_file.setText(self.data.data_fn) layout.addWidget(self.label_load_pt_file, ud, 2) groupbox_binary_edit_model = QGroupBox() self.radio_binary_model = QRadioButton("binary") self.radio_multiclass_model = QRadioButton("multi-class") if self.data.multi_class_model: self.radio_multiclass_model.setChecked(True) else: self.radio_binary_model.setChecked(True) hbox = QHBoxLayout() hbox.addWidget(self.radio_binary_model) hbox.addWidget(self.radio_multiclass_model) groupbox_binary_edit_model.setLayout(hbox) layout.addWidget(groupbox_binary_edit_model, ud, 3) ud += 1 layout.addWidget(QLabel(), ud, 0, 1, 4) ud += 1 button_load_model = QPushButton("Load model", self) button_load_model.clicked.connect(self.load_model) button_load_model.setToolTip("Click to load model") layout.addWidget(button_load_model, ud, 1) self.label_load_model = QLabel("No model loaded.", self) if self.data.model_loaded == 1: self.label_load_model.setText(self.data.model_fn) layout.addWidget(self.label_load_model, ud, 2) ud += 1 layout.addWidget(QLabel(), ud, 0, 1, 4) ud += 1 self.cbox_preds.toggled.connect(self.preds_checked) self.cbox_preds.setToolTip("Click to plot predictions from file") if self.data.plot_loaded_preds == 1: self.cbox_preds.setChecked(True) elif self.data.plot_loaded_preds == 1: self.cbox_preds.setChecked(False) self.data.plot_loaded_preds = 0 layout.addWidget(self.cbox_preds, ud, 0) button_load_preds = QPushButton("Load predictions", self) button_load_preds.clicked.connect(self.load_preds) button_load_preds.setToolTip("Click to load predictions") layout.addWidget(button_load_preds, ud, 1) self.label_load_preds = QLabel("No predictions loaded.", self) if self.data.preds_loaded == 1: self.label_load_preds.setText(self.data.preds_fn) layout.addWidget(self.label_load_preds, ud, 2) groupbox_binary_edit_preds = QGroupBox() self.radio_binary_preds = QRadioButton("binary") self.radio_multiclass_preds = QRadioButton("multi-class") if self.data.multi_class_preds: self.radio_multiclass_preds.setChecked(True) else: self.radio_binary_preds.setChecked(True) hbox = QHBoxLayout() hbox.addWidget(self.radio_binary_preds) hbox.addWidget(self.radio_multiclass_preds) groupbox_binary_edit_preds.setLayout(hbox) layout.addWidget(groupbox_binary_edit_preds, ud, 3) ud += 1 btn_exit = QPushButton('Ok', self) btn_exit.clicked.connect(self.check) layout.addWidget(btn_exit, ud, 4) self.setLayout(layout) self.show()
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 __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 setup_ui(self): """ Setup UI for the color options window. """ self.setWindowTitle(self.title) centerPoint = QtWidgets.QDesktopWidget().availableGeometry().center() self.setGeometry(centerPoint.x() - self.width / 2, centerPoint.y() - self.height / 2, self.width, self.height) grid_lt = QGridLayout() lbl_info = QLabel( "Select the color for each channel:\n Please note that any non-standard channel " + "\n or names not recognized by the program will be " + "\nassigned the color of the midline.") grid_lt.addWidget(lbl_info, 0, 0) lbl_left = QLabel("Left hemisphere:") grid_lt.addWidget(lbl_left, 1, 0) lbl_right = QLabel("Right hemisphere:") grid_lt.addWidget(lbl_right, 2, 0) lbl_mid = QLabel("Midline:") grid_lt.addWidget(lbl_mid, 3, 0) groupbox_left_colors = QGroupBox() self.radio_col_r_lt = QRadioButton("R") self.radio_col_g_lt = QRadioButton("G") self.radio_col_b_lt = QRadioButton("B") self.radio_col_k_lt = QRadioButton("") self.k_btn_lt = QPushButton("Custom") self.k_btn_lt.clicked.connect(self.select_col_k_lt) hbox_left = QHBoxLayout() hbox_left.addWidget(self.radio_col_r_lt) hbox_left.addWidget(self.radio_col_g_lt) hbox_left.addWidget(self.radio_col_b_lt) hbox_left.addWidget(self.radio_col_k_lt) hbox_left.addWidget(self.k_btn_lt) groupbox_left_colors.setLayout(hbox_left) grid_lt.addWidget(groupbox_left_colors, 1, 1) groupbox_right_colors = QGroupBox() self.radio_col_r_rt = QRadioButton("R") self.radio_col_g_rt = QRadioButton("G") self.radio_col_b_rt = QRadioButton("B") self.radio_col_k_rt = QRadioButton("") self.k_btn_rt = QPushButton("Custom") self.k_btn_rt.clicked.connect(self.select_col_k_rt) hbox_right = QHBoxLayout() hbox_right.addWidget(self.radio_col_r_rt) hbox_right.addWidget(self.radio_col_g_rt) hbox_right.addWidget(self.radio_col_b_rt) hbox_right.addWidget(self.radio_col_k_rt) hbox_right.addWidget(self.k_btn_rt) groupbox_right_colors.setLayout(hbox_right) grid_lt.addWidget(groupbox_right_colors, 2, 1) groupbox_mid_colors = QGroupBox() self.radio_col_r_mid = QRadioButton("R") self.radio_col_g_mid = QRadioButton("G") self.radio_col_b_mid = QRadioButton("B") self.radio_col_k_mid = QRadioButton("") self.k_btn_mid = QPushButton("Custom") self.k_btn_mid.clicked.connect(self.select_col_k_mid) hbox_mid = QHBoxLayout() hbox_mid.addWidget(self.radio_col_r_mid) hbox_mid.addWidget(self.radio_col_g_mid) hbox_mid.addWidget(self.radio_col_b_mid) hbox_mid.addWidget(self.radio_col_k_mid) hbox_mid.addWidget(self.k_btn_mid) groupbox_mid_colors.setLayout(hbox_mid) grid_lt.addWidget(groupbox_mid_colors, 3, 1) self._set_init_col("lt") self._set_init_col("rt") self._set_init_col("mid") btn_exit = QPushButton('Ok', self) btn_exit.clicked.connect(self.check) grid_lt.addWidget(btn_exit, 4, 0) self.setLayout(grid_lt) self.show()