def __init__(self, data_file, parent=None): super(HDF5Browser, self).__init__(parent) self.data_file = data_file self.treeWidget = HDF5TreeWidget( data_file, parent=self, ) self.treeWidget.selectionModel().selectionChanged.connect( self.selection_changed) self.viewer = HDF5ItemViewer( parent=self, show_controls=True, ) self.refresh_tree_button = QtWidgets.QPushButton( ) #Create a refresh button self.refresh_tree_button.setText("Refresh Tree") #adding the refresh button self.treelayoutwidget = QtWidgets.QWidget( ) #construct a widget which can then contain the refresh button and the tree self.treelayoutwidget.setLayout(QtWidgets.QVBoxLayout()) self.treelayoutwidget.layout().addWidget(self.treeWidget) self.treelayoutwidget.layout().addWidget(self.refresh_tree_button) self.refresh_tree_button.clicked.connect( self.treeWidget.model.refresh_tree) splitter = QtWidgets.QSplitter() splitter.addWidget( self.treelayoutwidget ) #Add newly constructed widget (treeview and button) to the splitter splitter.addWidget(self.viewer) self.setLayout(QtWidgets.QHBoxLayout()) self.layout().addWidget(splitter)
def _init_ui(self): self.setWindowTitle('Spectrometers') self.controls_layout = QtWidgets.QHBoxLayout() controls_group = QtWidgets.QGroupBox() controls_group.setTitle('Spectrometers') controls_group.setLayout(self.controls_layout) self.controls = [] for spectrometer in self.spectrometers.spectrometers: control = spectrometer.get_qt_ui(control_only=True) self.controls_layout.addWidget(control) self.controls.append(control) self.display = SpectrometerDisplayUI(self.spectrometers) layout = QtWidgets.QVBoxLayout() layout.addWidget(controls_group) layout.addWidget(self.display) self.setLayout(layout)
def _make_gui(self, hide_border=True): """Creates and sets the widget layout :param hide_border: bool. See __init__ :return: """ self._QLabel = QtWidgets.QLabel(self) layout = QtWidgets.QHBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self._QLabel) self.setLayout(layout) self.setWindowTitle('SLM Phase') if hide_border: self.setWindowFlags(QtCore.Qt.CustomizeWindowHint | QtCore.Qt.FramelessWindowHint)
def __init__(self, cwl): super(CameraWithLocationControlUI, self).__init__() self.cwl = cwl cc = QuickControlBox("Settings") cc.add_doublespinbox("calibration_distance") cc.add_button("calibrate_xy_gui", "Calibrate XY") cc.auto_connect_by_name(self) self.calibration_controls = cc fc = QuickControlBox("Autofocus") fc.add_doublespinbox("af_step_size") fc.add_spinbox("af_steps") fc.add_button("autofocus_gui", "Autofocus") fc.add_button("quick_autofocus_gui", "Quick Autofocus") fc.auto_connect_by_name(self.cwl) self.focus_controls = fc # sc = l = QtWidgets.QHBoxLayout() l.addWidget(cc) l.addWidget(fc) self.setLayout(l)
def __init__( self, item=None, parent=None, figure_widget=None, show_controls=True, show_refresh=True, show_default_button=True, show_copy=True, renderer_combobox=None, refresh_button=None, copy_button=None, default_button=None, ): """Create a viewer widget for any dataset or datagroup object Arguments: item : HDF5 group or dataset (optional) The dataset (or group) to display parent : QWidget (optional) The Qt parent of the widget. show_controls : bool (optional) If True (default), show the refresh button and combobox. If False, just show the renderer. show_refresh : bool (optional) If show_controls is True, this sets whether the refresh button is visible. renderer_combobox : QComboBox (optional) If this is specified, use the supplied combobox instead of creating a new one. You probably want to specify show_controls=False. refresh_button : QPushButton (optional) If specified, use the supplied button instead of creating one. copy_button : QPushButton (optional) If specified, use the supplied button instead of creating one. default_button : QPushButton (optional) If specified, use the supplied button to select the default rendererinstead of creating one. """ super(HDF5ItemViewer, self).__init__(parent) if figure_widget is None: self.figure_widget = QtWidgets.QWidget() else: self.figure_widget = figure_widget if renderer_combobox is None: self.renderer_combobox = QtWidgets.QComboBox() else: self.renderer_combobox = renderer_combobox self.renderer_combobox.activated[int].connect(self.renderer_selected) if refresh_button is None: self.refresh_button = QtWidgets.QPushButton() self.refresh_button.setText("Refresh Figure") else: self.refresh_button = refresh_button self.refresh_button.clicked.connect(self.refresh) if default_button is None: self.default_button = QtWidgets.QPushButton() self.default_button.setText("Default Renderer") else: self.default_button = default_button self.default_button.clicked.connect(self.default_renderer) if copy_button is None: self.copy_button = QtWidgets.QPushButton() self.copy_button.setText("Copy Figure") else: self.copy_button = copy_button self.copy_button.clicked.connect(self.CopyActivated) self.clipboard = QtWidgets.QApplication.clipboard() self.setLayout(QtWidgets.QVBoxLayout()) self.layout().addWidget(self.figure_widget, stretch=1) self.layout().setContentsMargins(0, 0, 0, 0) self.renderers = list() if show_controls: # this part may be broken hb = QtWidgets.QHBoxLayout() hb.addWidget(self.renderer_combobox, stretch=1) if show_refresh: hb.addWidget(self.refresh_button, stretch=0) if show_copy: hb.addWidget(self.copy_button, stretch=0) if show_default_button: hb.addWidget(self.default_button, stretch=0) self.layout().addLayout(hb, stretch=0)