def _trigger_controls_create(self): rb_trig_auto = QtGui.QRadioButton("Auto") rb_trig_norm = QtGui.QRadioButton("Norm") rb_trig_stop = QtGui.QRadioButton("Stop") rb_trig_auto.setChecked(True) self._bg_trig_mode = QtGui.QButtonGroup() self._bg_trig_mode.addButton(rb_trig_auto, TriggerMode.AUTO) self._bg_trig_mode.addButton(rb_trig_norm, TriggerMode.NORM) self._bg_trig_mode.addButton(rb_trig_stop, TriggerMode.STOP) rb_trig_src0 = QtGui.QRadioButton("A0") rb_trig_src1 = QtGui.QRadioButton("A1") rb_trig_src0.setChecked(True) self._bg_trig_src = QtGui.QButtonGroup() self._bg_trig_src.addButton(rb_trig_src0, 0) self._bg_trig_src.addButton(rb_trig_src1, 1) self._sld_trig_lvl = QtGui.QSlider(QtCore.Qt.Horizontal) self._sld_trig_lvl.setTracking(True) self._sld_trig_lvl.setValue(50) rb_trig_edge_raising = QtGui.QRadioButton("Raising") rb_trig_edge_falling = QtGui.QRadioButton("Falling") rb_trig_edge_both = QtGui.QRadioButton("Both") rb_trig_edge_raising.setChecked(True) self._bg_trig_edge = QtGui.QButtonGroup() self._bg_trig_edge.addButton(rb_trig_edge_raising, TriggerEdge.RAISING) self._bg_trig_edge.addButton(rb_trig_edge_falling, TriggerEdge.FALLING) self._bg_trig_edge.addButton(rb_trig_edge_both, TriggerEdge.BOTH) self._bg_trig_mode.buttonClicked.connect(self._control_changed) self._bg_trig_src.buttonClicked.connect(self._control_changed) self._bg_trig_edge.buttonClicked.connect(self._control_changed) self._sld_trig_lvl.valueChanged.connect(self._trig_lvl_changed) # timer for hiding trigger helper cursor self._trig_cursor_timer = QtCore.QTimer() self._trig_cursor_timer.setSingleShot(True) self._trig_cursor_timer.timeout.connect(self._cursor_trig.hide) layout = QtGui.QGridLayout() layout.addWidget(rb_trig_auto, 0, 0, 1, 1) layout.addWidget(rb_trig_norm, 0, 1, 1, 1) layout.addWidget(rb_trig_stop, 0, 2, 1, 1) layout.addWidget(QtGui.QLabel("Source:"), 1, 0, 1, 1) layout.addWidget(rb_trig_src0, 1, 1, 1, 1) layout.addWidget(rb_trig_src1, 1, 2, 1, 1) layout.addWidget(QtGui.QLabel("Level:"), 2, 0, 1, 1) layout.addWidget(self._sld_trig_lvl, 2, 1, 1, 2) layout.addWidget(rb_trig_edge_raising, 3, 0, 1, 1) layout.addWidget(rb_trig_edge_falling, 3, 1, 1, 1) layout.addWidget(rb_trig_edge_both, 3, 2, 1, 1) return layout
def __init__(self): pg.LayoutWidget.__init__(self) currRow = 0 img = renderTeX('$C(\\vec{r})\\propto \\mathrm{exp}(-r^2/a^2)' + '$\n$' + '\\Phi(\\vec{k}) \\propto \\mathrm{exp}(-a^2 k^2/4)$') eqnLabel = QtGui.QLabel(alignment=QtCore.Qt.AlignHCenter) eqnLabel.setPixmap(QtGui.QPixmap.fromImage(img)) self.addWidget(eqnLabel,row=currRow,col=0,colspan=2) currRow += 1 self.addWidget(QtGui.QLabel('a:'), row=currRow, col=0) self.aSpinBox = pg.SpinBox(value=1.,bounds=[0,None],suffix='m', siPrefix=True, dec=True, step=0.5, minStep=0.1) self.addWidget(self.aSpinBox, row=currRow, col=1) currRow += 1 self.covRB = QtGui.QRadioButton('Covariance') self.specRB = QtGui.QRadioButton('Spectrum') csButtonGroup = QtGui.QButtonGroup() csButtonGroup.addButton(self.covRB) csButtonGroup.addButton(self.specRB) csButtonGroup.setExclusive(True) self.csButtonGroup = csButtonGroup self.addWidget(self.covRB, row=currRow, col=0) self.addWidget(self.specRB, row=currRow, col=1) currRow += 1 genButton = QtGui.QPushButton('Generate field') genButton.clicked.connect(self.generate) self.addWidget(genButton, row=currRow, colspan=2)
def getWestLayout(self): event_control = self.getEventControlButtons() draw_control = self.getDrawingControlButtons() # Add the quit button? quit_control = self.getQuitLayout() self._westLayout = QtGui.QVBoxLayout() self._westLayout.addLayout(event_control) self._westLayout.addStretch(1) self._westLayout.addLayout(draw_control) self._westLayout.addStretch(1) # Add a section to allow users to just view one window instead of two/three self._viewButtonGroup = QtGui.QButtonGroup() # Draw all planes: self._allViewsButton = QtGui.QRadioButton("All") self._allViewsButton.clicked.connect(self.viewSelectWorker) self._viewButtonGroup.addButton(self._allViewsButton) # Put the buttons in a layout self._viewChoiceLayout = QtGui.QVBoxLayout() # Make a label for this stuff: self._viewChoiceLabel = QtGui.QLabel("View Options") self._viewChoiceLayout.addWidget(self._viewChoiceLabel) self._viewChoiceLayout.addWidget(self._allViewsButton) i = 0 self._viewButtonArray = [] for plane in range(self._event_manager.n_views()): button = QtGui.QRadioButton("Plane" + str(i)) i += 1 self._viewButtonGroup.addButton(button) button.clicked.connect(self.viewSelectWorker) self._viewButtonArray.append(button) self._viewChoiceLayout.addWidget(button) self._westLayout.addLayout(self._viewChoiceLayout) self._westLayout.addStretch(1) self._westLayout.addWidget(quit_control) self._westWidget = QtGui.QWidget() self._westWidget.setLayout(self._westLayout) self._westWidget.setMaximumWidth(150) self._westWidget.setMinimumWidth(100) return self._westWidget
def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.grid = QtGui.QGridLayout() self.label = QtGui.QLabel(self) self.label.setText("Video URL: ") self.grid.addWidget(self.label, 1, 1, 1, 1) self.le = QtGui.QLineEdit("", self) self.grid.addWidget(self.le, 1, 2, 1, 2) self.radiobuttonEn = QtGui.QRadioButton("English", self) self.grid.addWidget(self.radiobuttonEn, 2, 1, 1, 1) self.radiobuttonJp = QtGui.QRadioButton("Japanese", self) self.grid.addWidget(self.radiobuttonJp, 2, 2, 1, 1) self.radiobuttonTc = QtGui.QRadioButton("Tranditional Chinese", self) self.grid.addWidget(self.radiobuttonTc, 2, 3, 1, 1) self.btnGp = QtGui.QButtonGroup(self) self.btnGp.addButton(self.radiobuttonEn, 1) self.btnGp.addButton(self.radiobuttonJp, 2) self.btnGp.addButton(self.radiobuttonTc, 3) self.lang = '' self.btnGp.buttonClicked.connect(self.radioBtnOnClicked) self.btnConvert = QtGui.QPushButton('Get subtitle', self) self.grid.addWidget(self.btnConvert, 3, 1, 1, 1) self.btnConvert.clicked.connect(self.convert) self.btnSave = QtGui.QPushButton('Save File', self) self.grid.addWidget(self.btnSave, 3, 2, 1, 1) self.btnSave.clicked.connect(self.file_save) self.btnSave.setEnabled(False) self.btnReet = QtGui.QPushButton('Reset', self) self.grid.addWidget(self.btnReet, 3, 3, 1, 1) self.btnReet.clicked.connect(self.reset) self.textbox = QtGui.QLabel(self) self.grid.addWidget(self.textbox, 4, 1, 1, 3) self.textbox.resize(100, 10) self.setLayout(self.grid) self.show()
def __init__(self, window, font, parent=None): super(RocDialog, self).__init__() self.window = window self.font = font self.dialog_layout = QtGui.QGridLayout() self.setLayout(self.dialog_layout) self.title = QtGui.QLabel('Rate of Change Preferences') self.title.setFont(self.font) self.radio_group = QtGui.QButtonGroup() self.point_button = QtGui.QRadioButton('Point-Wise Rate of Change') self.window_button = QtGui.QRadioButton('Moving Window Rate of Change') self.window_size_slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.window_size_slider.setValue(window.delta) self.window_size_slider.setRange(1, 100) # self.window_size_slider.add # self.window_size_slider.setTickInterval() self.window_size_label = QtGui.QLabel('Delta Size') self.window_size_val = QtGui.QLabel(str(window.delta) + ' samples') # self.window_size_val.setFont(font) self.sampling_slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.sampling_slider.setValue(window.sampling_interval) self.sampling_label = QtGui.QLabel('Sampling Interval') self.sampling_val = QtGui.QLabel(str(window.sampling_interval) + ' ms') # self.sampling_val.setFont(font) self.sampling_slider.setEnabled(False) self.refresh_slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.referesh_label = QtGui.QLabel('Referesh Rate') self.refresh_slider.setValue(window.refresh_rate) self.refresh_val = QtGui.QLabel(str(window.refresh_rate) + ' samples') # self.refresh_val.setFont(font) # self.refresh_slider.setEnabled(False) # #Roc properties # window.sampling_interval = 100 # window.rocMethod = 'point' # window.delta =15 # window.refresh_rate = 10 # window.refresh_counter = 0 self.initUI()
def __init__(self, parent=None): super().__init__(parent) self._emitGuiChange = True ## make radio buttons and layout ## self.buttons = { self.NOGRID: QtGui.QRadioButton('No grid'), self.GUESSSHAPE: QtGui.QRadioButton('Guess shape'), self.SPECIFYSHAPE: QtGui.QRadioButton('Specify shape'), } btnLayout = QtGui.QVBoxLayout() self.btnGroup = QtGui.QButtonGroup(self) for i in [self.NOGRID, self.GUESSSHAPE, self.SPECIFYSHAPE]: btn = self.buttons[i] self.btnGroup.addButton(btn, i) btnLayout.addWidget(btn) btnBox = QtGui.QGroupBox('Grid') btnBox.setLayout(btnLayout) ## make shape spec widget ## self.shapeSpec = ShapeSpecification() shapeLayout = QtGui.QVBoxLayout() shapeLayout.addWidget(self.shapeSpec) shapeBox = QtGui.QGroupBox('Shape') shapeBox.setLayout(shapeLayout) # Widget layout layout = QtGui.QHBoxLayout() layout.addWidget(btnBox) layout.addWidget(shapeBox) layout.addStretch() self.setLayout(layout) ## Connect signals/slots ## self.btnGroup.buttonToggled.connect(self.gridButtonSelected) self.shapeSpec.confirm.clicked.connect(self.shapeSpecified)
def plot_amplitude_map(self): # Create animation window self.ampMap = pg.ImageView() print(self.ampMap.view.state['limits']) self.ampMap.view.setLimits(xMin=0, xMax=16, yMin=0, yMax=16, minXRange=0, maxXRange=16, minYRange=0, maxYRange=16) print(self.ampMap.view.state['limits']) # allowed = ['xMin', 'xMax', 'yMin', 'yMax', 'minXRange', 'maxXRange', 'minYRange', 'maxYRange'] self.ampMap.setWindowTitle("Mapped Animating") # Preload data sp.dat['SigPy']['gridChannelData'] = map_channel_data_to_grid() if 'toaIndx' not in sp.dat['SigPy'] : print("Note! To plot CNN SW event data, please first run Detect Slow-Wave Events.") # self.ampMap.showMessage("Note! To plot CNN SW event data, please first run Detect Slow-Wave Events.") else: sp.dat['SigPy']['gridEventData'] = map_event_data_to_grid_with_trailing_edge() gridDataToAnimate = sp.dat['SigPy']['gridChannelData'] self.ampMap.setImage(self.add_row_padding_to_grid_data(gridDataToAnimate)) self.ampMap.show() ## ======= TOP NAV =========== ## -- Play pause speed controls # Set default animation speed to sampling frequency fps self.ampMap.singleStepVal = np.round((sp.dat['SigPy']['sampleRate'] / 2)[0], 1) self.ampMap.currentFrameRate = sp.dat['SigPy']['sampleRate'] self.ampMap.realFrameRate = sp.dat['SigPy']['sampleRate'] self.ampMap.currentFrameRate = self.ampMap.realFrameRate * 2 # Start at double speed # Create play pause speed controls self.btnPlayPause = QtGui.QPushButton('') self.btn_animation_set_pause() self.speedSlider = QtGui.QSlider() self.speedSlider.setOrientation(QtCore.Qt.Horizontal) self.speedSlider.setMinimum(0) self.speedSlider.setMaximum(self.ampMap.singleStepVal * 16) self.speedSlider.setValue(self.ampMap.currentFrameRate) self.speedSlider.setSingleStep(self.ampMap.singleStepVal) self.speedSlider.valueChanged.connect(self.change_frameRate) fpsLabelStr = str(np.round((self.ampMap.currentFrameRate / self.ampMap.realFrameRate)[0],1)[0]) + " x" self.fpsLabel = QtGui.QLabel(fpsLabelStr) ## -- Data select -- live / events / amplitude self.radioGrpAnimationData = QtGui.QButtonGroup() self.btnAmplitude = QtGui.QRadioButton('Amplitude') self.btnCNNEvents = QtGui.QRadioButton('CNN Events') self.btnLive = QtGui.QRadioButton('Live') self.btnAmplitude.clicked.connect(self.change_animation_data_to_chans) self.btnCNNEvents.clicked.connect(self.change_animation_data_to_events) self.btnAmplitude.setChecked(1); self.radioGrpAnimationData.addButton(self.btnAmplitude, 0) self.radioGrpAnimationData.addButton(self.btnCNNEvents, 1) self.radioGrpAnimationData.setExclusive(True) ## -- Add toolbar widgets to a proxy container widget self.LayoutWidgetPlayPauseSpeed = QtGui.QWidget() self.qGridLayout = QtGui.QGridLayout() # self.qGridLayout.setRowMinimumHeight(0, 50) self.qGridLayout.setHorizontalSpacing(14) self.qGridLayout.setContentsMargins(8,0,8,0) self.qGridLayout.addWidget(self.btnPlayPause, 0,0) self.qGridLayout.addWidget(self.speedSlider, 0,1) self.qGridLayout.addWidget(self.fpsLabel, 0,2) self.qGridLayout.addWidget(self.btnAmplitude, 0,3) self.qGridLayout.addWidget(self.btnCNNEvents, 0,4) self.LayoutWidgetPlayPauseSpeed.setLayout(self.qGridLayout) self.proxyWidget = QtGui.QGraphicsProxyWidget() self.proxyWidget.setWidget(self.LayoutWidgetPlayPauseSpeed) self.proxyWidget.setPos(0, 0) print("self.ampMap.ui: ", self.ampMap.ui) self.ampMap.scene.addItem(self.proxyWidget) # Automatically start animation self.play_animation()
def getEastLayout(self): # This function just makes a dummy eastern layout to use. label1 = QtGui.QLabel("Larlite EVD") geoName = self._geometry.name() label2 = QtGui.QLabel(geoName.capitalize()) font = label1.font() font.setBold(True) label1.setFont(font) label2.setFont(font) self._eastWidget = QtGui.QWidget() # This is the total layout self._eastLayout = QtGui.QVBoxLayout() # add the information sections: self._eastLayout.addWidget(label1) self._eastLayout.addWidget(label2) self._eastLayout.addStretch(1) # The wires are a special case. # Use a check box to control wire drawing self._wireButtonGroup = QtGui.QButtonGroup() # Draw no wires: self._noneWireButton = QtGui.QRadioButton("None") self._noneWireButton.clicked.connect(self.wireChoiceWorker) self._wireButtonGroup.addButton(self._noneWireButton) # Draw Wires: self._wireButton = QtGui.QRadioButton("Wire") self._wireButton.clicked.connect(self.wireChoiceWorker) self._wireButtonGroup.addButton(self._wireButton) # Draw Raw Digit self._rawDigitButton = QtGui.QRadioButton("Raw Digit") self._rawDigitButton.clicked.connect(self.wireChoiceWorker) self._wireButtonGroup.addButton(self._rawDigitButton) # Make a layout for this stuff: self._wireChoiceLayout = QtGui.QVBoxLayout() self._wireChoiceLabel = QtGui.QLabel("Wire Draw Options") self._wireChoiceLayout.addWidget(self._wireChoiceLabel) self._wireChoiceLayout.addWidget(self._noneWireButton) self._wireChoiceLayout.addWidget(self._wireButton) self._wireChoiceLayout.addWidget(self._rawDigitButton) self._eastLayout.addLayout(self._wireChoiceLayout) # Set the default to be no wires self._noneWireButton.toggle() self._paramsDrawBox = QtGui.QCheckBox("Draw Params.") self._paramsDrawBox.stateChanged.connect(self.paramsDrawBoxWorker) self._eastLayout.addWidget(self._paramsDrawBox) # Set a box for mcTruth Info self._truthDrawBox = QtGui.QCheckBox("MC Truth") self._truthDrawBox.stateChanged.connect(self.truthDrawBoxWorker) self._eastLayout.addWidget(self._truthDrawBox) # Now we get the list of items that are drawable: drawableProducts = self._event_manager.getDrawableProducts() # print drawableProducts self._listOfRecoBoxes = [] for product in drawableProducts: thisBox = recoBox( self, product, drawableProducts[product][1], self._event_manager.getProducers(drawableProducts[product][1])) self._listOfRecoBoxes.append(thisBox) thisBox.activated[str].connect(self.recoBoxHandler) self._eastLayout.addWidget(thisBox) self._eastLayout.addStretch(2) self._eastWidget.setLayout(self._eastLayout) self._eastWidget.setMaximumWidth(150) self._eastWidget.setMinimumWidth(100) return self._eastWidget
def add_button_layout(self): self._bg1 = QtGui.QButtonGroup(self) self._tpc_all_button = QtGui.QRadioButton("All Cryos and TPCs") self._tpc_all_button.setToolTip("Shows all TPCs.") self._tpc_all_button.clicked.connect(self.viewSelectionWorker) self._bg1.addButton(self._tpc_all_button) self._tpc_buttons = [] for cryo in range(self._geometry.nCryos()): for tpc in range(self._geometry.nTPCs()): tpc_button = QtGui.QRadioButton("Cryo "+str(cryo)+", TPC "+str(tpc)) tpc_button.setToolTip("Shows only Cryo "+str(cryo)+", TPC "+str(tpc)) tpc_button.clicked.connect(self.viewSelectionWorker) self._bg1.addButton(tpc_button) self._tpc_buttons.append(tpc_button) self._buttonLayout = QtGui.QHBoxLayout() self._buttonLayout.addWidget(self._tpc_all_button) for item in self._tpc_buttons: self._buttonLayout.addWidget(item) self._bg2 = QtGui.QButtonGroup(self) txt = QtGui.QLabel("Show:") self._show_raw_btn = QtGui.QRadioButton("Raw Data") self._show_raw_btn.clicked.connect(self._raw_flash_switch_worker) self._show_raw_btn.setChecked(True) self._show_raw = True self._bg2.addButton(self._show_raw_btn) self._show_flash_btn = QtGui.QRadioButton("Flashes") self._show_flash_btn.clicked.connect(self._raw_flash_switch_worker) self._bg2.addButton(self._show_flash_btn) self._raw_flash_btn_layout = QtGui.QHBoxLayout() self._raw_flash_btn_layout.addWidget(txt) self._raw_flash_btn_layout.addWidget(self._show_raw_btn) self._raw_flash_btn_layout.addWidget(self._show_flash_btn) # self._time_range_layout = QtGui.QHBoxLayout() # self._time_range_title = QtGui.QLabel("Time range [us]:") # self._time_range_layout.addWidget(self._time_range_title) # self._time_range = QRangeSlider() # self._time_range.setMin(-10) # self._time_range.setMax(100) # self._time_range.setRange(0, 10) # self._time_range.endValueChanged.connect(self.time_range_worker) # self._time_range.maxValueChanged.connect(self.time_range_worker) # self._time_range.minValueChanged.connect(self.time_range_worker) # self._time_range.startValueChanged.connect(self.time_range_worker) # self._time_range.minValueChanged.connect(self.time_range_worker) # self._time_range.maxValueChanged.connect(self.time_range_worker) # self._time_range.startValueChanged.connect(self.time_range_worker) # self._time_range.endValueChanged.connect(self.time_range_worker) # self._time_range_layout.addWidget(self._time_range) # for p in self._pmts: # p.set_time_range(self._time_range.getRange()) self._totalLayout.addLayout(self._buttonLayout) self._totalLayout.addLayout(self._raw_flash_btn_layout)
def getEastLayout(self): super(livegui, self).getEastLayout() self._title1 = QtGui.QLabel("TITUS <i>Live</i>") self._title1a = QtGui.QLabel("The event display") self._title1b = QtGui.QLabel("for SBN @ Fermilab") self._title1c = QtGui.QLabel("Version " + self.get_git_version()) geoName = self._geometry.name() self._title2 = QtGui.QLabel('Detector: '+geoName.upper()) font = self._title1.font() font.setBold(True) self._title1.setFont(font) self._title2.setFont(font) self._eastWidget = QtGui.QWidget() # This is the total layout self._eastLayout = QtGui.QVBoxLayout() # add the information sections: self._eastLayout.addWidget(self._title1) self._eastLayout.addWidget(self._title1a) self._eastLayout.addWidget(self._title1b) self._eastLayout.addWidget(self._title1c) self._eastLayout.addWidget(self._title2) self._eastLayout.addStretch(1) self._stageLabel = QtGui.QLabel("Stage:") self._stageSelection = QtGui.QComboBox() self._stageSelection.activated[str].connect(self.stageSelectHandler) # Make sure "all" is default and on top: self._stageSelection.addItem("all") for stage in self._event_manager.getStages(): if stage != "all": self._stageSelection.addItem(stage) self._eastLayout.addWidget(self._stageLabel) self._eastLayout.addWidget(self._stageSelection) self._eastLayout.addStretch(1) # The wires are a special case. # Use a check box to control wire drawing self._wireButtonGroup = QtGui.QButtonGroup() # Draw no wires: self._noneWireButton = QtGui.QRadioButton("None") self._noneWireButton.clicked.connect(self.wireChoiceWorker) self._wireButtonGroup.addButton(self._noneWireButton) # Draw Wires: self._wireButton = QtGui.QRadioButton("Wire") self._wireButton.clicked.connect(self.wireChoiceWorker) self._wireButtonGroup.addButton(self._wireButton) products = self._event_manager.get_products('recob::Wire') default_products = self._event_manager.get_default_products('recob::Wire') self._wireChoice = waveformBox(self, 'recob::Wire', products, default_products) self._wireLayout = QtGui.QHBoxLayout() self._wireLayout.addWidget(self._wireButton) self._wireLayout.addWidget(self._wireChoice) # Draw Raw Digit self._rawDigitButton = QtGui.QRadioButton("Raw Digit") self._rawDigitButton.clicked.connect(self.wireChoiceWorker) self._wireButtonGroup.addButton(self._rawDigitButton) products = self._event_manager.get_products('raw::RawDigit') default_products = self._event_manager.get_default_products('raw::RawDigit') self._rawDigitChoice = waveformBox(self, 'raw::RawDigit', products, default_products) self._rawDigitLayout = QtGui.QHBoxLayout() self._rawDigitLayout.addWidget(self._rawDigitButton) self._rawDigitLayout.addWidget(self._rawDigitChoice) # Draw Optical Waveforms: self._opdetWvfButton = QtGui.QRadioButton("OpDetWaveform") self._opdetWvfButton.clicked.connect(self.opdetWvfChoiceWorker) self._wireButtonGroup.addButton(self._opdetWvfButton) # Make a layout for this stuff: self._wireChoiceLayout = QtGui.QVBoxLayout() self._wireChoiceLabel = QtGui.QLabel("Draw Options") self._wireChoiceLayout.addWidget(self._wireChoiceLabel) self._wireChoiceLayout.addWidget(self._noneWireButton) self._wireChoiceLayout.addLayout(self._wireLayout) # self._wireChoiceLayout.addWidget(self._wireButton) self._wireChoiceLayout.addLayout(self._rawDigitLayout) # self._wireChoiceLayout.addWidget(self._rawDigitButton) self._wireChoiceLayout.addWidget(self._opdetWvfButton) self._eastLayout.addLayout(self._wireChoiceLayout) # Set the default to be no wires self._noneWireButton.toggle() # Microboone only: if self._geometry.name() == "uboone": self._noiseFilterBox = QtGui.QCheckBox("Noise Filter") self._noiseFilterBox.stateChanged.connect(self.noiseFilterWorker) self._eastLayout.addWidget(self._noiseFilterBox) # Now we get the list of items that are drawable: drawableProducts = self._event_manager.getDrawableProducts() # print drawableProducts self._listOfRecoBoxes = [] for product in drawableProducts: thisBox = recoBox(self, product, drawableProducts[product][1], self._event_manager.getProducers( drawableProducts[product][1])) self._listOfRecoBoxes.append(thisBox) thisBox.activated[str].connect(self.recoBoxHandler) self._eastLayout.addWidget(thisBox) self._eastLayout.addStretch(2) # Add the auto file switch stuff: self._eastLayout.addWidget(self._autoFileLabel) autoFileLayout = QtGui.QHBoxLayout() autoFileLayout.addWidget(self._fileUpdateDelayLabel) autoFileLayout.addWidget(self._fileUpdateDelayEntry) self._eastLayout.addLayout(autoFileLayout) self._eastLayout.addWidget(self._fileUpdatePauseButton) self._eastLayout.addStretch(1) # Add the auto event switch stuff: self._eastLayout.addWidget(self._autoRunLabel) autoDelayLayout = QtGui.QHBoxLayout() autoDelayLayout.addWidget(self._eventUpdateDelayLabel) autoDelayLayout.addWidget(self._eventUpdateDelayEntry) self._eastLayout.addLayout(autoDelayLayout) self._eastLayout.addWidget(self._eventUpdatePauseButton) self._eastLayout.addStretch(1) self._eastWidget.setLayout(self._eastLayout) self._eastWidget.setMaximumWidth(190) self._eastWidget.setMinimumWidth(140) return self._eastWidget
button = QtGui.QPushButton("Messung aufnehmen") layout = pg.LayoutWidget() layout.addWidget(win, row=1, col=0, colspan=4) layout.addWidget(RealtimeCheckBox, row=0, col=0) layout.addWidget(button, row=0, col=1) state_info = QtGui.QLabel() state_info.setText('Zustand') layout.addWidget(state_info, row=0, col=2) plot_info = QtGui.QLabel() plot_info.setText( 'Messungsinfo:\n\tAbtastperiode\n\tAbtastzeit:\n\t(Abtastbereich: )') layout.addWidget(plot_info, row=2, col=0, colspan=4) filter_option_widget = QtGui.QWidget() filter_option_layout = QtGui.QHBoxLayout() filter_option_widget.setLayout(filter_option_layout) filter_option_group = QtGui.QButtonGroup() filter_option_kalman = QtGui.QRadioButton('Kalman') filter_option_kompl = QtGui.QRadioButton('Komplementär') filter_option_FIR = QtGui.QRadioButton('FIR') filter_option_FIR.setChecked(True) filter_option_layout.addWidget(filter_option_kompl) filter_option_layout.addWidget(filter_option_kalman) filter_option_layout.addWidget(filter_option_FIR) filter_option_group.addButton(filter_option_kompl) filter_option_group.addButton(filter_option_kalman) filter_option_group.addButton(filter_option_FIR) layout.addWidget(filter_option_widget, row=0, col=3) layout.show() ######### Visualization - Plotsconfiguration ########### # Nicken Plot
def __init__(self, window,font,parent=None): super(SmoothingDialog, self).__init__() self.window = window self.font = font self.dialog_layout = QtGui.QGridLayout() self.setLayout(self.dialog_layout) self.title = QtGui.QLabel('Smoothing Algorithm Preferences') self.title.setFont(self.font) self.temp_title = QtGui.QLabel("Smoothing Preferences") self.temp_title.setFont(self.font) self.ewma_title = QtGui.QLabel("EWMA Filter Preferences") self.ewma_title.setFont(self.font) self.median_title = QtGui.QLabel("Median Filter Preferences") self.median_title.setFont(self.font) self.temp_cb = QtGui.QCheckBox('Temperature Smoothing', self) self.roc_cb = QtGui.QCheckBox('Rate of Change Smoothing', self) if(self.window.tempSmooth=="True"): self.temp_cb.setChecked(True) else: self.temp_cb.setChecked(False) if (self.window.rocSmooth == "True"): self.roc_cb.setChecked(True) else: self.roc_cb.setChecked(False) self.temp_cb.stateChanged.connect(self.temp_checkbox_change) self.roc_cb.stateChanged.connect(self.roc_checkbox_change) self.radio_group = QtGui.QButtonGroup() self.ewma_button = QtGui.QRadioButton('EWMA Filter') self.ewma_button.setToolTip("Exponential Weighted Moving Average") self.median_button = QtGui.QRadioButton('Median Filter') self.median_button.setEnabled(False) self.savgol_button = QtGui.QRadioButton('Savitzky-Golay Filter (Experimental)') # self.savgol_button.setEnabled(False) self.window_button = QtGui.QRadioButton('Moving Average Filter') self.temp_window_size_slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.temp_window_size_slider.setValue(int(self.window.temp_window_size)) self.temp_window_size_slider.setMinimum(1) self.temp_window_size_slider.setMaximum(99) self.temp_window_size_slider.setTickPosition(QtGui.QSlider.TicksBothSides) self.temp_window_size_slider.setTickInterval(10) self.temp_window_size_slider.setSingleStep(2) self.temp_window_size_slider.valueChanged.connect(self.slider_change) self.temp_window_size_label = QtGui.QLabel('Temperature Smoothing Window Size') self.temp_window_size_val = QtGui.QLabel(str(self.window.temp_window_size) + ' Samples') self.roc_window_size_slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.roc_window_size_slider.setValue(int(self.window.roc_window_size)) self.roc_window_size_slider.setMinimum(1) self.roc_window_size_slider.setMaximum(99) self.roc_window_size_slider.setTickPosition(QtGui.QSlider.TicksBothSides) self.roc_window_size_slider.setTickInterval(10) self.roc_window_size_slider.setSingleStep(2) self.roc_window_size_slider.valueChanged.connect(self.slider_change) self.roc_window_size_label = QtGui.QLabel('RoC Smoothing Window Size') self.roc_window_size_val = QtGui.QLabel(str(window.roc_window_size) + ' Samples') self.exp_weight_slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.exp_weight_slider.setValue(int(self.window.exp_weight*100)) self.exp_weight_slider.setMinimum(10) self.exp_weight_slider.setMaximum(100) self.exp_weight_slider.setTickPosition(QtGui.QSlider.TicksBothSides) self.exp_weight_slider.setTickInterval(10) self.exp_weight_slider.setSingleStep(10) self.exp_weight_slider.valueChanged.connect(self.slider_change) self.exp_weight_label = QtGui.QLabel('Exponential Weight') self.exp_weight_val = QtGui.QLabel(str(window.exp_weight) ) self.kernel_size_slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.kernel_size_slider.setValue(int(self.window.kernel_size)) self.kernel_size_slider.setMinimum(3) self.kernel_size_slider.setMaximum(99) self.kernel_size_slider.setTickPosition(QtGui.QSlider.TicksBothSides) self.kernel_size_slider.setTickInterval(10) self.kernel_size_slider.setSingleStep(2) self.kernel_size_slider.valueChanged.connect(self.slider_change) self.kernel_size_label = QtGui.QLabel('Kernel Size') self.kernel_size_val = QtGui.QLabel(str(window.kernel_size) + ' Samples') self.exp_weight_widget = QtGui.QWidget() self.exp_weight_widget.setVisible(False) self.kernel_size_widget = QtGui.QWidget() self.kernel_size_widget.setVisible(False) self.radio_select() self.initUI()
spectrumPlot.setLabel('left', 'Counts') #Channel Widget Box radio512 = QWid.QRadioButton("512") radio1024 = QWid.QRadioButton("1024") channelGroupBox = QWid.QGroupBox() channelGroupBox.setTitle('Channel Options') channelLayoutBox = QWid.QVBoxLayout() channelLayoutBox.addWidget(radio512) channelLayoutBox.addWidget(radio1024) channelGroupBox.setLayout(channelLayoutBox) channelButtons = QtGui.QButtonGroup() channelButtons.addButton(radio512) channelButtons.addButton(radio1024) if moss.dataLength == 512: radio512.click() elif moss.dataLength == 1024: radio1024.click() #Naming and Numbering of spectrum spectrumNameTextBox = QtGui.QLineEdit(placeholderText='Spectrum name') spectrumNumberTextBox = QtGui.QLineEdit(placeholderText='Spectrum number') spectrumNameButton = QtGui.QPushButton('Rename') nameGroupBox = QtGui.QGroupBox() nameGroupBox.setTitle('Name Options')
def init_ui(self): self.setWindowTitle('Vessel') hbox = QtGui.QHBoxLayout() self.setLayout(hbox) app = self.app self.plotwidget = myPlotObject(app=app) hbox.addWidget(self.plotwidget, 4) vbox = QtGui.QVBoxLayout() self.chosenVoxelsButtonGroup = QtGui.QButtonGroup() self.labelInitialVoxelsButton = QtGui.QPushButton("Label Initial Voxels") self.labelInitialVoxelsButton.setCheckable(True) self.labelBoundaryVoxelsButton = QtGui.QPushButton("Label Boundary Voxels") self.labelBoundaryVoxelsButton.setCheckable(True) self.chosenVoxelsButtonGroup.addButton(self.labelInitialVoxelsButton, 1) self.chosenVoxelsButtonGroup.addButton(self.labelBoundaryVoxelsButton, 2) self.partitionNamesButtonGroup = QtGui.QButtonGroup() self.LMCAButton = QtGui.QPushButton("LMCA") self.LMCAButton.setCheckable(True) self.RMCAButton = QtGui.QPushButton("RMCA") self.RMCAButton.setCheckable(True) self.ACAButton = QtGui.QPushButton("ACA") self.ACAButton.setCheckable(True) self.LPCAButton = QtGui.QPushButton("LPCA") self.LPCAButton.setCheckable(True) self.RPCAButton = QtGui.QPushButton("RPCA") self.RPCAButton.setCheckable(True) self.partitionNamesButtonGroup.addButton(self.LMCAButton, 11) self.partitionNamesButtonGroup.addButton(self.RMCAButton, 12) self.partitionNamesButtonGroup.addButton(self.ACAButton, 13) self.partitionNamesButtonGroup.addButton(self.LPCAButton, 14) self.partitionNamesButtonGroup.addButton(self.RPCAButton, 15) self.loadChosenVoselsButton = QtGui.QPushButton("Load Chosen Voxels") self.saveChosenVoselsButton = QtGui.QPushButton("Save Chosen Voxels") self.clearChosenVoselsButton = QtGui.QPushButton("Clear Chosen Voxels") self.showPartitionsButton = QtGui.QPushButton("Show Partitions") self.randomWalkBFSButton = QtGui.QPushButton("Random Walk BFS") self.loadSegmentNodeInfoDictButton = QtGui.QPushButton("Load segment/node InfoDict") self.showNodeButton = QtGui.QPushButton("Show Node") self.performFluidSimulationButton = QtGui.QPushButton("Fluid Simulation") self.loadFluidResultButton = QtGui.QPushButton("Load Fluid Result") self.showPressureResultButton = QtGui.QPushButton("Show Pressure Result") self.showVelocityResultButton = QtGui.QPushButton("Show Velocity Result") self.showSegmentButton = QtGui.QPushButton("Show Segment") self.segmentIndexBox = QtGui.QLineEdit() vbox.addWidget(self.labelInitialVoxelsButton, 1) vbox.addWidget(self.labelBoundaryVoxelsButton, 1) vbox.addWidget(self.LMCAButton, 1) vbox.addWidget(self.RMCAButton, 1) vbox.addWidget(self.ACAButton, 1) vbox.addWidget(self.LPCAButton, 1) vbox.addWidget(self.RPCAButton, 1) vbox.addWidget(self.loadChosenVoselsButton, 1) vbox.addWidget(self.saveChosenVoselsButton, 1) vbox.addWidget(self.clearChosenVoselsButton, 1) vbox.addWidget(self.randomWalkBFSButton, 1) vbox.addWidget(self.showPartitionsButton, 1) vbox.addWidget(self.loadSegmentNodeInfoDictButton, 1) vbox.addWidget(self.showNodeButton, 1) vbox.addWidget(self.performFluidSimulationButton, 1) vbox.addWidget(self.loadFluidResultButton, 1) vbox.addWidget(self.showPressureResultButton, 1) vbox.addWidget(self.showVelocityResultButton, 1) vbox.addWidget(self.showSegmentButton, 1) vbox.addWidget(self.segmentIndexBox, 1) vbox.addStretch(1) hbox.addLayout(vbox, 1) self.setGeometry(30, 30, 1500, 900) self.show()
load_btn.clicked.connect(load_model) btn_layout.addWidget(load_btn, 0, 0) save_btn = QtGui.QPushButton("Save") save_btn.clicked.connect(save_model) btn_layout.addWidget(save_btn, 0, 1) evolve_btn = QtGui.QPushButton("Evolve") evolve_btn.clicked.connect(evolve) btn_layout.addWidget(evolve_btn, 0, 2) reset_btn = QtGui.QPushButton("Reset") reset_btn.clicked.connect(reset_models) btn_layout.addWidget(reset_btn, 0, 3) b_group = QtGui.QButtonGroup() b_id_to_mm = {} i = 0 for mt, motion in enumerate(motion_dict.keys()): for md, model in enumerate(models): mm_btn = QtGui.QRadioButton(w) mm_btn.setText(model_select_cb[md].text() + " " + motion_names[mt]) # the identifying tuple is replaced by an int index because it has to b_id_to_mm[i] = (mt, md) b_group.addButton(mm_btn, i) mm_btn.toggled.connect(lambda state: model_motion_select) layout.addWidget(mm_btn, md + 1, mt + 1) i += 1 # play and pause motion