def home(self): """Do the home view.""" self.setCentralWidget(self._main) layout = QtWidgets.QVBoxLayout(self._main) static_canvas = FigureCanvas(Figure(figsize=(12, 8))) self._static_ax = static_canvas.figure.subplots() layout.addWidget(static_canvas) self.addToolBar(NavigationToolbar(static_canvas, self)) # slider limit # # ------------ # self.label_limit = QtWidgets.QLabel("Limit : 1.0") layout.addWidget(self.label_limit) h_layout = QtWidgets.QHBoxLayout() label_min = QtWidgets.QLabel("1") h_layout.addWidget(label_min) self.slider_limit = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.slider_limit.setTickPosition(QtWidgets.QSlider.TicksBothSides) self.slider_limit.setTickInterval(1) self.slider_limit.setSingleStep(1) self.slider_limit.setMinimum(10) self.slider_limit.setMaximum(40) self.slider_limit.setValue(1) self.slider_limit.valueChanged.connect(self.value_changed) self.slider_limit.sliderReleased.connect(self.update) h_layout.addWidget(self.slider_limit) label_max = QtWidgets.QLabel("4") h_layout.addWidget(label_max) layout.addLayout(h_layout) # slider size # # ------------ # self.label_size = QtWidgets.QLabel("Size : (8x8)") layout.addWidget(self.label_size) h_layout = QtWidgets.QHBoxLayout() label_min = QtWidgets.QLabel("2") h_layout.addWidget(label_min) self.slider_size = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.slider_size.setTickPosition(QtWidgets.QSlider.TicksBothSides) self.slider_size.setTickInterval(4) self.slider_size.setSingleStep(1) self.slider_size.setMinimum(2) self.slider_size.setMaximum(32) self.slider_size.setValue(8) self.slider_size.valueChanged.connect(self.value_changed) self.slider_size.sliderReleased.connect(self.update) h_layout.addWidget(self.slider_size) label_max = QtWidgets.QLabel("32") h_layout.addWidget(label_max) layout.addLayout(h_layout)
def __init__(self, strat_type): super().__init__() self.showFullScreen() self.strat_type = strat_type self.resize(1000, 500) self._main = QtWidgets.QWidget() self.layout = QtWidgets.QVBoxLayout() self._main.setLayout(self.layout) self.setCentralWidget(self._main) self.top = QtWidgets.QHBoxLayout() self.middle = QtWidgets.QHBoxLayout() self.bottom = QtWidgets.QVBoxLayout() self.layout.addLayout(self.top) self.layout.addLayout(self.middle) self.layout.addLayout(self.bottom) self.log = io.StringIO() self._create_price_graph(self.top) self._create_log_box(self.middle) self._create_equity_graph(self.middle) self._create_drawdown_graph(self.middle) self._create_distribution_graph(self.middle) self._start_button(self.bottom) self.threadpool = QThreadPool() self.threadpool.setMaxThreadCount(10)
def __init__(self, entries): super().__init__() self.entries = entries self.current_entry = -1 self.current_thumbnail = -1 event_filter = EventFilter(self) self.installEventFilter(event_filter) # The list of files on the left-hand side. self.filelist = QtWidgets.QListWidget() self.filelist.setMinimumWidth(400) for entry in entries: self.filelist.addItem(entry.display) self.filelist.currentRowChanged.connect(self.set_entry) thumbnails_box = QtWidgets.QWidget() thumbnails_layout = QtWidgets.QVBoxLayout() self.thumbnails = [] for i, name in enumerate(('test', 'expected', 'diff')): thumbnail = Thumbnail(self, i, name) thumbnails_layout.addWidget(thumbnail) self.thumbnails.append(thumbnail) thumbnails_box.setLayout(thumbnails_layout) images_layout = QtWidgets.QVBoxLayout() images_box = QtWidgets.QWidget() self.image_display = QtWidgets.QLabel() self.image_display.setAlignment( _enum('QtCore.Qt.AlignmentFlag').AlignHCenter | _enum('QtCore.Qt.AlignmentFlag').AlignVCenter) self.image_display.setMinimumSize(800, 600) images_layout.addWidget(self.image_display, 6) images_box.setLayout(images_layout) buttons_box = QtWidgets.QWidget() buttons_layout = QtWidgets.QHBoxLayout() accept_button = QtWidgets.QPushButton("Accept (A)") accept_button.clicked.connect(self.accept_test) buttons_layout.addWidget(accept_button) reject_button = QtWidgets.QPushButton("Reject (R)") reject_button.clicked.connect(self.reject_test) buttons_layout.addWidget(reject_button) buttons_box.setLayout(buttons_layout) images_layout.addWidget(buttons_box) main_layout = QtWidgets.QHBoxLayout() main_layout.addWidget(self.filelist, 1) main_layout.addWidget(thumbnails_box, 1) main_layout.addWidget(images_box, 3) self.setLayout(main_layout) self.setWindowTitle("matplotlib test triager") self.set_entry(0)
def __init__(self, l, r, u, d, parent=None): """""" QtWidgets.QDialog.__init__(self, parent) self.setWindowTitle('Set Heatmap Domain') self.setWindowIcon(QtGui.QIcon('kiwi.png')) self.setMinimumWidth(400) self.header = QtWidgets.QLabel("All distances are relative to the array center.") self.leftLabel = QtWidgets.QLabel("Left/West:") self.lledit = QtWidgets.QLineEdit(self) self.lledit.setText(str(l)) self.rightLabel = QtWidgets.QLabel("Right/East:") self.rledit = QtWidgets.QLineEdit(self) self.rledit.setText(str(r)) self.upLabel = QtWidgets.QLabel("Up/North:") self.uledit = QtWidgets.QLineEdit(self) self.uledit.setText(str(u)) self.downLabel = QtWidgets.QLabel("Down/South:") self.dledit = QtWidgets.QLineEdit(self) self.dledit.setText(str(d)) self.activate = QtWidgets.QPushButton("Set") Box = QtWidgets.QVBoxLayout() Box.addWidget(self.header) left = QtWidgets.QHBoxLayout() left.addWidget(self.leftLabel) left.addWidget(self.lledit) right = QtWidgets.QHBoxLayout() right.addWidget(self.rightLabel) right.addWidget(self.rledit) up = QtWidgets.QHBoxLayout() up.addWidget(self.upLabel) up.addWidget(self.uledit) down = QtWidgets.QHBoxLayout() down.addWidget(self.downLabel) down.addWidget(self.dledit) Box.addLayout(left) Box.addLayout(right) Box.addLayout(up) Box.addLayout(down) Box.addWidget(self.activate) # Now put everything into the frame self.setLayout(Box)
def Init(parent): # LAYOUT OF THE MAIN WINDOW layout = QtWidgets.QVBoxLayout(parent._main) # LAYOUT FOR THE TOOLBAR BUTTONS hbox = QtWidgets.QHBoxLayout() hbox.addWidget(parent.button_home) hbox.addWidget(parent.button_back) hbox.addWidget(parent.button_forward) hbox.addWidget(parent.button_pan) hbox.addWidget(parent.button_zoom) hbox.addStretch(1) layout.addLayout(hbox) # TIME NAVIGATION hboxtimeframes = QtWidgets.QHBoxLayout() hboxtimeframes.addWidget(parent.button_fov) hboxtimeframes.addWidget(parent.button_channel) hboxtimeframes.addStretch() hboxtimeframes.addWidget(parent.button_previousframe) hboxtimeframes.addWidget(parent.button_timeindex) hboxtimeframes.addWidget(parent.button_nextframe) hboxtimeframes.addStretch() # IMAGE DISPLAY hlayout = QtWidgets.QHBoxLayout() hlayout.addWidget(parent.m) hlayout.setContentsMargins(0, 0, 0, 0) layout.addLayout(hlayout) layout.addLayout(hboxtimeframes) # CORRECTIONS/ IMAGE EDITS hboxcorrectionsbuttons = QtWidgets.QHBoxLayout() hboxcorrectionsbuttons.addWidget(parent.button_add_region) hboxcorrectionsbuttons.addWidget(parent.button_newcell) hboxcorrectionsbuttons.addWidget(parent.button_split) hboxcorrectionsbuttons.addWidget(parent.button_mergewithneighbors) hboxcorrectionsbuttons.addWidget(parent.button_drawmouse) hboxcorrectionsbuttons.addWidget(parent.button_eraser) hboxcorrectionsbuttons.addWidget(parent.label_brushsize) hboxcorrectionsbuttons.addWidget(parent.spinbox_brushsize) hboxcorrectionsbuttons.addStretch(2) hboxcorrectionsbuttons.addWidget(parent.button_showval) hboxcorrectionsbuttons.addWidget(parent.button_hidemask) layout.addLayout(hboxcorrectionsbuttons) # LAYOUT FOR EDITING CELL VALUES, SHOW CELL VALUES AND HIDE MASK, CNN BUTTONS hboxcellval = QtWidgets.QHBoxLayout() hboxcellval.addWidget(parent.button_exval) hboxcellval.addWidget(parent.button_changecellvalue) hboxcellval.addWidget(parent.button_cellcorrespondence) hboxcellval.addStretch(1) hboxcellval.addWidget(parent.button_cnn) hboxcellval.addWidget(parent.button_extractfluorescence) layout.addLayout(hboxcellval)
def __layout(self): # first line self.hboxfirst=QtWidgets.QHBoxLayout() self.hboxfirst.addWidget(self.lblMessages) self.hboxfirst.addStretch(1) self.hboxfirst.addStretch(1) self.hboxfirst.addWidget(self.lblinfo) self.hboxfirst.addWidget(self.lblAuthors) self.hboxfirst.addStretch(1) # second line self.hboxsecond=QtWidgets.QHBoxLayout() self.hboxsecond.addStretch(1) self.hboxsecond.addWidget(self.lblOperator) self.hboxsecond.addWidget(self.txtOperator) self.hboxsecond.addStretch(1) self.hboxsecond.addWidget(self.lblLocation) self.hboxsecond.addWidget(self.txtLocation) self.hboxsecond.addStretch(1) self.hboxsecond.addWidget(self.lblComments) self.hboxsecond.addWidget(self.txtComments) self.hboxsecond.addStretch(1) # third line self.hboxthird=QtWidgets.QHBoxLayout() self.hboxthird.addStretch(1) self.hboxthird.addWidget(self.btnStart) self.hboxthird.addStretch(1) self.hboxthird.addWidget(self.btnStop) self.hboxthird.addStretch(1) self.hboxthird.addWidget(self.lblScanInterval) # Interval self.hboxthird.addWidget(self.txtScanInterval) # self.hboxthird.addWidget(self.lblUnit) # self.hboxthird.addWidget(self.btnInterval) self.hboxthird.addStretch(1) # down self.hboxdo=QtWidgets.QHBoxLayout() self.hboxdo.addWidget(self.lblTimeMessages) self.hboxdo.addStretch(1) self.hboxdo.addStretch(1) self.hboxdo.addWidget(self.btnQuit) # vertical layout self.vbox=QtWidgets.QVBoxLayout() self.vbox.addLayout(self.hboxfirst) self.vbox.addLayout(self.hboxsecond) self.vbox.addLayout(self.hboxthird) self.vbox.addWidget(self.PSensorPlot) self.vbox.addLayout(self.hboxdo) #3 Apply Layout. This is how the window area looks self.setLayout(self.vbox)
def __init__(self, parent, label, accessor, sense_ohms=0.1, disabled=False): super().__init__(parent) self.accessor = accessor self.label = label self.sense_ohms = sense_ohms self.disabled = disabled layout = QtWidgets.QVBoxLayout(self) lbl = QtWidgets.QLabel(self.label) lbl.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter) lbl.setStyleSheet('QLabel { font-weight: bold; color: #93a1a1; } ') layout.addWidget(lbl) sub = QtWidgets.QWidget() sub_layout = QtWidgets.QHBoxLayout(sub) self.V = QtWidgets.QLabel('nan V') self.V.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.V.setStyleSheet('QLabel { font-weight: bold; color: #268bd2; } ') sub_layout.addWidget(self.V) self.I = QtWidgets.QLabel('nan mA') self.I.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.I.setStyleSheet('QLabel { font-weight: bold; color: #6c71c4; } ') sub_layout.addWidget(self.I) layout.addWidget(sub)
def __init__(self, name, props, default=None): super(TextParam, self).__init__(name, props) self.setLayout( QtWidgets.QHBoxLayout() ) self.lineedit = QtWidgets.QLineEdit() self.layout().addWidget(self.lineedit) self.set_value(default or props['default']) self.lineedit.editingFinished.connect(self.update)
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, parent, grid_path): super().__init__(parent) self.camera = Camera(self) self.item_model = TableModel(grid_path) self.selection_model = QtCore.QItemSelectionModel(self.item_model) self.table = Table(self.item_model, self.selection_model, self.camera) self.plot = Plot(self.item_model, self.selection_model) self.stats = Stats(self, self.item_model) self.layout = QtWidgets.QHBoxLayout(self) self.left_layout = QtWidgets.QVBoxLayout() self.left_layout.addWidget(self.stats) self.left_layout.addWidget(self.camera) self.left_layout.addWidget(self.table) self.layout.addLayout(self.left_layout) self.layout.addWidget(self.plot, 1) self.setLayout(self.layout)
def __init__(self, dimension): """ Construct the widget Args: dimension: xarray.DataArray """ super().__init__() main_layout = QW.QHBoxLayout(self) #: The dimension represented by this widget self.dimension = dimension self.title = QW.QLabel(dimension.name) self.textbox = QW.QLineEdit() self.slider = QW.QSlider(orientation=QtCore.Qt.Horizontal) self.slider.setMinimum(0) self.slider.setMaximum(dimension.size - 1) self.slider.valueChanged.connect(self._update_from_slider) self.textbox.returnPressed.connect(self._update_from_value) self.slider.setValue(0) self.textbox.setText(str(self.dimension[0].values)) main_layout.addWidget(self.title) main_layout.addWidget(self.textbox) main_layout.addWidget(self.slider)
def __init__(self, db, fig_dispatch, text_dispatch, result_dispatch, *, max_results=100): self.db = db self._hvw = HeaderViewerWidget(fig_dispatch, text_dispatch) self.fig_dispatch = fig_dispatch self.text_dispatch = text_dispatch self.result_dispatch = result_dispatch self.max_results = max_results self._results_summary = QtWidgets.QLabel() self._results = QtWidgets.QListWidget() self._results.currentItemChanged.connect( self._on_results_selection_changed) self._search_bar = QtWidgets.QLineEdit() self._search_bar.textChanged.connect(self._on_search_text_changed) self.widget = QtWidgets.QWidget() layout = QtWidgets.QVBoxLayout() sublayout = QtWidgets.QHBoxLayout() results_pane = QtWidgets.QVBoxLayout() results_pane.addWidget(self._results_summary) results_pane.addWidget(self._results) layout.addWidget(self._search_bar) layout.addLayout(sublayout) sublayout.addLayout(results_pane) sublayout.addWidget(self._hvw.widget) self.widget.setLayout(layout) self.search()
def __init__(self, name, label, cmap, parent=None): super().__init__(parent) self.setObjectName(name) self.layout = QtWidgets.QVBoxLayout(self) self.layout.setAlignment(Qt.AlignLeft) self.label = QtWidgets.QLabel(label) self.label.setStyleSheet("QLabel { font-size: 10px; }") self.b = QtWidgets.QCheckBox("Add opacity point: ", self) self.b.stateChanged.connect(self.clickBox) self.b.setLayoutDirection(Qt.RightToLeft) nF = QtWidgets.QFrame() layout1 = QtWidgets.QHBoxLayout(nF) layout1.setContentsMargins(0, 0, 0, 0) layout1.setAlignment(Qt.AlignLeft) layout1.addWidget(self.b) layout1.addWidget(self.setup_cmap_frame(cmap)) self.layout.addWidget(self.label) self.layout.addWidget(nF) # Set shape of this QWidget self.setFrameShape(QtWidgets.QFrame.StyledPanel) self.setFrameShadow(QtWidgets.QFrame.Raised)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.setObjectName("SubplotTool") self._widgets = {} main_layout = QtWidgets.QHBoxLayout() self.setLayout(main_layout) for group, spinboxes, buttons in [ ("Borders", ["top", "bottom", "left", "right"], ["Export values"]), ("Spacings", ["hspace", "wspace"], ["Tight layout", "Reset", "Close"]), ]: layout = QtWidgets.QVBoxLayout() main_layout.addLayout(layout) box = QtWidgets.QGroupBox(group) layout.addWidget(box) inner = QtWidgets.QFormLayout(box) for name in spinboxes: self._widgets[name] = widget = QtWidgets.QDoubleSpinBox() widget.setMinimum(0) widget.setMaximum(1) widget.setDecimals(3) widget.setSingleStep(0.005) widget.setKeyboardTracking(False) inner.addRow(name, widget) layout.addStretch(1) for name in buttons: self._widgets[name] = widget = QtWidgets.QPushButton(name) # Don't trigger on <enter>, which is used to input values. widget.setAutoDefault(False) layout.addWidget(widget) self._widgets["Close"].setFocus()
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_sublayouts(self): # Panel sublayout self.panel_sublayout = QtWidgets.QHBoxLayout() panel_sublayout_inner = QtWidgets.QVBoxLayout() # Server sublayout server_sublayout_grid = QtWidgets.QGridLayout() server_sublayout_grid.addWidget(self.labels["server"], 0, 0) server_sublayout_grid.addWidget(self.labels["interface"], 0, 1) server_sublayout_grid.addWidget(self.ports, 1, 0) server_sublayout_grid.addWidget(self.textboxes["host"], 1, 0) server_sublayout_grid.addWidget(self.interface, 1, 1) server_sublayout_grid.addWidget(self.mode, 2, 0) server_sublayout_grid.addWidget(self.buttons["connect"], 2, 1) # Controls sublayout control_sublayout_grid = QtWidgets.QGridLayout() control_sublayout_grid.addWidget(self.labels["scan"], 0, 0) control_sublayout_grid.addWidget(self.buttons["start"], 1, 0) control_sublayout_grid.addWidget(self.buttons["stop"], 1, 1) control_sublayout_grid.addWidget(self.buttons["save_scan"], 2, 0) control_sublayout_grid.addWidget(self.buttons["load_scan"], 2, 1) control_sublayout_grid.addWidget(self.labels["clutter"], 3, 0) control_sublayout_grid.addWidget(self.buttons["create_cl"], 4, 0) control_sublayout_grid.addWidget(self.buttons["load_cl"], 4, 1) control_sublayout_grid.addWidget(self.labels["clutter_file"], 5, 0, 1, 2) # Settings sublayout settings_sublayout_grid = QtWidgets.QGridLayout() settings_sublayout_grid.addWidget(self.labels["sensor"], 0, 0) settings_sublayout_grid.addWidget(self.textboxes["sensor"], 0, 1) settings_sublayout_grid.addWidget(self.labels["start_range"], 1, 0) settings_sublayout_grid.addWidget(self.labels["end_range"], 1, 1) settings_sublayout_grid.addWidget(self.textboxes["start_range"], 2, 0) settings_sublayout_grid.addWidget(self.textboxes["end_range"], 2, 1) settings_sublayout_grid.addWidget(self.labels["frequency"], 3, 0) settings_sublayout_grid.addWidget(self.textboxes["frequency"], 3, 1) settings_sublayout_grid.addWidget(self.labels["gain"], 4, 0) settings_sublayout_grid.addWidget(self.textboxes["gain"], 4, 1) settings_sublayout_grid.addWidget(self.labels["sweeps"], 5, 0) settings_sublayout_grid.addWidget(self.textboxes["sweeps"], 5, 1) settings_sublayout_grid.addWidget(self.labels["sweep_buffer"], 6, 0) settings_sublayout_grid.addWidget(self.textboxes["sweep_buffer"], 6, 1) settings_sublayout_grid.addWidget(self.labels["power_bins"], 7, 0) settings_sublayout_grid.addWidget(self.textboxes["power_bins"], 7, 1) panel_sublayout_inner.addStretch(10) panel_sublayout_inner.addLayout(server_sublayout_grid) panel_sublayout_inner.addStretch(2) panel_sublayout_inner.addLayout(control_sublayout_grid) panel_sublayout_inner.addStretch(4) panel_sublayout_inner.addLayout(settings_sublayout_grid) panel_sublayout_inner.addStretch(20) self.panel_sublayout.addStretch(5) self.panel_sublayout.addLayout(panel_sublayout_inner) self.panel_sublayout.addStretch(10)
def RecreateSpace(self): self.ClearSpace(False) for i in range(len(self.weightNames)): hLayout = QtWidgets.QHBoxLayout() hLayout.addWidget(self.weightNames[i]) for j in range(len(self.weights[0])): hLayout.addWidget(self.boxValues[i,j]) self.vLayout.addLayout(hLayout) pass
def __init__(self,parent=None,selected=None,raw_adc=False,raw_time=False,pedestal=None,distribute=None,fft=False,**ignored): super().__init__(parent) self._layout = QtWidgets.QVBoxLayout(self) self.set_selected(selected) self.fft_checkbox = QtWidgets.QCheckBox('Plot FFT') self.fft_checkbox.setCheckState(QtCore.Qt.Checked if fft else QtCore.Qt.Unchecked) self._layout.addWidget(self.fft_checkbox) self.raw_checkbox = QtWidgets.QCheckBox('Plot raw ADC counts') self.raw_checkbox.setCheckState(QtCore.Qt.Checked if raw_adc else QtCore.Qt.Unchecked) self._layout.addWidget(self.raw_checkbox) self.raw_time_checkbox = QtWidgets.QCheckBox('Plot sample index') self.raw_time_checkbox.setCheckState(QtCore.Qt.Checked if raw_time else QtCore.Qt.Unchecked) self._layout.addWidget(self.raw_time_checkbox) redist_layout = QtWidgets.QHBoxLayout() self.redist_checkbox = QtWidgets.QCheckBox('Redistribute signals') self.redist_checkbox.setCheckState(QtCore.Qt.Checked if distribute else QtCore.Qt.Unchecked) redist_layout.addWidget(self.redist_checkbox) self.redist_amount = QtWidgets.QLineEdit('0' if distribute is None else str(distribute)) redist_layout.addWidget(self.redist_amount) self._layout.addLayout(redist_layout) ped_layout = QtWidgets.QHBoxLayout() self.baseline_checkbox = QtWidgets.QCheckBox('Correct baselines') self.baseline_checkbox.setCheckState(QtCore.Qt.Checked if pedestal else QtCore.Qt.Unchecked) ped_layout.addWidget(self.baseline_checkbox) self.ped_min = QtWidgets.QLineEdit('0' if pedestal is None else str(pedestal[0])) self.ped_min.setFixedWidth(100) ped_layout.addWidget(self.ped_min) self.ped_max = QtWidgets.QLineEdit('50' if pedestal is None else str(pedestal[1])) self.ped_max.setFixedWidth(100) ped_layout.addWidget(self.ped_max) self._layout.addLayout(ped_layout) buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) self._layout.addWidget(buttons)
def __init__(self): super().__init__() self._main = QtWidgets.QWidget() self.setCentralWidget(self._main) self.main_layout = QtWidgets.QHBoxLayout(self._main) self.init_left_space(self.main_layout) self.init_middle_space(self.main_layout) self.init_panel_space(self.main_layout) self.init_data() self.cmap = cm.gray
def __init__(self): self.qapp = QtWidgets.QApplication(sys.argv) super(TimePlot, self).__init__() self._main = QtWidgets.QWidget() self.setCentralWidget(self._main) self.layout = QtWidgets.QGridLayout(self._main) # Empty objects that will be used during visualization. self.fig = None self.frames = None # Slider stuff hbox_timeline = QtWidgets.QHBoxLayout() self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.slider.setMinimum(0) self.slider.valueChanged.connect(self.slider_valuechanged) hbox_timeline.addWidget(self.slider) self.layout.addLayout(hbox_timeline, 1, 0) # Bottom buttons hbox_buttons = QtWidgets.QHBoxLayout() hbox_buttons.addStretch(1) # Button for saving movies. save_movie_btn = QtWidgets.QPushButton( "&Save as movie") # Shortcut is Alt+S save_movie_btn.clicked.connect(self._save_movie_clicked) # Button for next episode. next_btn = QtWidgets.QPushButton("&Next episode") # Shortcut is Alt+N next_btn.clicked.connect(self._next_clicked) # Quit button. quit_btn = QtWidgets.QPushButton("&Quit") # Shortcut is Alt+Q quit_btn.clicked.connect(self.closeEvent) # Add buttons to widget. hbox_buttons.addWidget(save_movie_btn) hbox_buttons.addWidget(next_btn) hbox_buttons.addWidget(quit_btn) self.layout.addLayout(hbox_buttons, 2, 0) self.is_closed = False self.is_playing = False
def __init__(self, name, props): # TODO could calculate default index automatically if non-integer supplied super(ComboboxParam, self).__init__(name, props) self.setLayout( QtWidgets.QHBoxLayout() ) self.combobox = QtWidgets.QComboBox() self.layout().addWidget(self.combobox) options = [False, True] if props['type'] == 'bool' else props['options'] self.choices = OrderedDict( (str(choice), choice) for choice in options ) assert str(props['default']) in self.choices self.combobox.addItems(list(self.choices.keys())) self.set_value(str(props['default'])) self.combobox.currentIndexChanged.connect(self.update)
def __init__(self, parent=None): super(StartP, self).__init__(parent) comboLabel = QtWidgets.QLabel('Graphic Type:') self.combo = QtWidgets.QComboBox(self) self.combo.addItem('Pies on Map') self.combo.addItem('Grid') self.combo.addItem('Aggregated') self.comboValue = '' self.combo.activated[str].connect(self.onActivated) hbox = QtWidgets.QHBoxLayout() hbox.addWidget(comboLabel) hbox.addWidget(self.combo) self.setLayout(hbox)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.setObjectName("SubplotTool") self._widgets = {} layout = QtWidgets.QHBoxLayout() self.setLayout(layout) left = QtWidgets.QVBoxLayout() layout.addLayout(left) right = QtWidgets.QVBoxLayout() layout.addLayout(right) box = QtWidgets.QGroupBox("Borders") left.addWidget(box) inner = QtWidgets.QFormLayout(box) for side in ["top", "bottom", "left", "right"]: self._widgets[side] = widget = QtWidgets.QDoubleSpinBox() widget.setMinimum(0) widget.setMaximum(1) widget.setDecimals(3) widget.setSingleStep(.005) widget.setKeyboardTracking(False) inner.addRow(side, widget) left.addStretch(1) box = QtWidgets.QGroupBox("Spacings") right.addWidget(box) inner = QtWidgets.QFormLayout(box) for side in ["hspace", "wspace"]: self._widgets[side] = widget = QtWidgets.QDoubleSpinBox() widget.setMinimum(0) widget.setMaximum(1) widget.setDecimals(3) widget.setSingleStep(.005) widget.setKeyboardTracking(False) inner.addRow(side, widget) right.addStretch(1) widget = QtWidgets.QPushButton("Export values") self._widgets["Export values"] = widget # Don't trigger on <enter>, which is used to input values. widget.setAutoDefault(False) left.addWidget(widget) for action in ["Tight layout", "Reset", "Close"]: self._widgets[action] = widget = QtWidgets.QPushButton(action) widget.setAutoDefault(False) right.addWidget(widget) self._widgets["Close"].setFocus()
def __init__(self, wib_server='127.0.0.1', config='femb0.json', grid=False): super().__init__() self.wib = WIB(wib_server) self.config = config self._main = QtWidgets.QWidget() self._main.setFocusPolicy(QtCore.Qt.StrongFocus) self.setCentralWidget(self._main) layout = QtWidgets.QVBoxLayout(self._main) self.grid = QtWidgets.QGridLayout() if grid: self.views = [Hist2DView(), FFTView(), MeanView(), RMSView()] for i, v in enumerate(self.views): self.grid.addWidget(v, i % 2, i // 2) else: self.views = [Hist2DView(), MeanRMSView(), FFTView()] for i, v in enumerate(self.views): self.grid.addWidget(v, 0, i) layout.addLayout(self.grid) nav_layout = QtWidgets.QHBoxLayout() button = QtWidgets.QPushButton('Configure') nav_layout.addWidget(button) button.setToolTip('Configure WIB and front end') button.clicked.connect(self.configure_wib) button = QtWidgets.QPushButton('Acquire') nav_layout.addWidget(button) button.setToolTip('Read WIB Spy Buffer') button.clicked.connect(self.acquire_data) button = QtWidgets.QPushButton('Continuous') nav_layout.addWidget(button) button.setToolTip('Repeat acquisitions until stopped') button.clicked.connect(self.toggle_continuous) self.continuious_button = button self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self.acquire_data) layout.addLayout(nav_layout) self.plot()
def __init__(self, parent): super().__init__(parent) self.layout = QtWidgets.QHBoxLayout(self) # create a mpl figure self.figure = create_figure() self.edit_buttons = SingleEditButtonsWidget(self) # create the figurecanvas object self.canvas = FigureCanvas(self.figure) self.layout.addWidget(self.canvas) self.layout.addStretch(1) self.layout.addWidget(self.edit_buttons) self.plot = None
def initializePage(self): groups = int(self.field('groupCount2')) alleles = int(self.field('alleleCount2')) integerValidator = QtGui.QIntValidator(0, 10, self) vbox = self.layout() for i in range(groups): hbox1 = QtWidgets.QHBoxLayout() hbox2 = QtWidgets.QHBoxLayout() glabel = QtWidgets.QLabel("group " + str(i + 1) + ":") gname = QtWidgets.QLineEdit() gname.setText('0') self.registerField('group' + str(i), gname) hbox1.addWidget(glabel) hbox1.addWidget(gname) for j in range(alleles): label = QtWidgets.QLabel(str(j + 1) + ":") line = QtWidgets.QLineEdit() line.setValidator(integerValidator) line.setText('0') self.registerField(str(i) + '-' + str(j), line) hbox2.addWidget(label) hbox2.addWidget(line) vbox.addLayout(hbox1) vbox.addLayout(hbox2)
def __init__(self, header, db): self.widget = QtWidgets.QWidget() self._header = header self._db = db export_csv_btn = QtWidgets.QPushButton('CSV') export_csv_btn.clicked.connect(self._export_csv) export_xlsx_btn = QtWidgets.QPushButton('Excel') export_xlsx_btn.clicked.connect(self._export_xlsx) copy_uid_btn = QtWidgets.QPushButton('Copy UID to Clipbaord') copy_uid_btn.clicked.connect( lambda: self._copy_uid(self._header['start']['uid'])) layout = QtWidgets.QHBoxLayout() layout.addWidget(export_csv_btn) layout.addWidget(export_xlsx_btn) layout.addWidget(copy_uid_btn) self.widget.setLayout(layout)
def setup_cmap_frame(self, cmap): nF = QtWidgets.QFrame() layout = QtWidgets.QHBoxLayout(nF) layout.setContentsMargins(5, 0, 5, 0) label = QtWidgets.QLabel('cmap: ') layout.addWidget(label) # Type dropdown list, training or test images self.type_combobox = QtWidgets.QComboBox() for colormap in sorted(Settings.colormaps): self.type_combobox.addItem(colormap) self.type_combobox.currentIndexChanged.connect(self.cmap_selectionchange) self.type_combobox.setCurrentText(cmap) layout.addWidget(self.type_combobox) return nF
def __init__(self, item_model, selection_model, camera): super().__init__() self.item_model = item_model self.selection_model = selection_model self.camera = camera self.picture_pending_idx = None self.table_view = QtWidgets.QTableView() self.table_view.setModel(item_model) self.table_view.setSelectionModel(selection_model) self.table_view.sectionSize = lambda idx: 300 self.selection_model.currentRowChanged.connect(self.update_selected) self.add_button = QtWidgets.QPushButton("Add row") self.add_button.clicked.connect(self.append_point) self.picture_button = Table.BigButton("Take picture") self.picture_button.setEnabled(False) self.picture_button.clicked.connect(self.take_picture) self.delete_button = QtWidgets.QPushButton("Delete row") self.delete_button.setEnabled(False) self.delete_button.clicked.connect(self.remove_point) self.deselect_button = QtWidgets.QPushButton("Deselect") self.deselect_button.clicked.connect(self.deselect_current) self.layout = QtWidgets.QVBoxLayout(self) self.buttons_layout = QtWidgets.QVBoxLayout() self.button_layout = QtWidgets.QHBoxLayout() self.button_layout.addWidget(self.add_button) self.button_layout.addWidget(self.delete_button) self.button_layout.addWidget(self.deselect_button) self.buttons_layout.addLayout(self.button_layout) self.buttons_layout.addWidget(self.picture_button) self.layout.addWidget(self.table_view) self.layout.addLayout(self.buttons_layout) self.setLayout(self.layout)
def __init__(self, parent, label, accessor): super().__init__(parent) self.accessor = accessor self.label = label layout = QtWidgets.QVBoxLayout(self) lbl = QtWidgets.QLabel(self.label) lbl.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter) lbl.setStyleSheet('QLabel { font-weight: bold; color: #93a1a1; } ') layout.addWidget(lbl) sub = QtWidgets.QWidget() sub_layout = QtWidgets.QHBoxLayout(sub) self.T = QtWidgets.QLabel('nan C') self.T.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter) self.T.setStyleSheet('QLabel { font-weight: bold; color: #2aa198; } ') sub_layout.addWidget(self.T) layout.addWidget(sub)