def __init__(self, parent, realtime_plot=False): QtImport.QWidget.__init__(self, parent) # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self.__current_location = [0, 0] # Graphic elements ---------------------------------------------------- self.plate_navigator_table = QtImport.QTableWidget(self) self.plate_navigator_cell = QtImport.QGraphicsView(self) # Layout -------------------------------------------------------------- _main_hlayout = QtImport.QHBoxLayout(self) _main_hlayout.addWidget(self.plate_navigator_table) _main_hlayout.addWidget(self.plate_navigator_cell) _main_hlayout.addStretch() _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # self.plate_navigator_cell.setSizePolicy # Qt signal/slot connections ------------------------------------------ self.plate_navigator_table.itemDoubleClicked.\ connect(self.navigation_table_double_clicked) # Other --------------------------------------------------------------- self.navigation_graphicsscene = QtImport.QGraphicsScene(self) self.plate_navigator_cell.setScene(self.navigation_graphicsscene) self.navigation_item = NavigationItem(self) # self.navigation_item.mouseDoubleClickedSignal.connect(\ # self.navigation_item_double_clicked) self.navigation_graphicsscene.addItem(self.navigation_item) self.navigation_graphicsscene.update() self.plate_navigator_cell.setEnabled(False) #font = self.plate_navigator_table.font() # font.setPointSize(8) # self.plate_navigator_table.setFont(font) self.plate_navigator_table.setEditTriggers( QtImport.QAbstractItemView.NoEditTriggers) self.plate_navigator_table.setHorizontalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff) self.plate_navigator_table.setVerticalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff) self.plate_navigator_cell.setHorizontalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff) self.plate_navigator_cell.setVerticalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff) if HWR.beamline.plate_manipulator is not None: self.init_plate_view()
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.state_machine_hwobj = None # Internal values ----------------------------------------------------- self.cond_list = None self.states_list = None self.trans_list = None self.state_graph_node_list = [] self.trans_graph_node_list = [] self.condition_value_dict = {} # Properties ---------------------------------------------------------- self.add_property("hwobj_state_machine", "string", "") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- _cond_states_gbox = QtImport.QGroupBox(r"States \ conditions", self) self.splitter = QtImport.QSplitter(QtImport.Qt.Vertical, self) self.cond_states_table = QtImport.QTableWidget(self.splitter) self.log_treewidget = QtImport.QTreeWidget(self.splitter) self.graph_graphics_view = QtImport.QGraphicsView(self) self.graph_graphics_scene = QtImport.QGraphicsScene(self) self.check_icon = Icons.load_icon("Check") self.reject_icon = Icons.load_icon("Delete") # Layout -------------------------------------------------------------- _cond_states_gbox_vlayout = QtImport.QVBoxLayout(_cond_states_gbox) _cond_states_gbox_vlayout.addWidget(self.splitter) _cond_states_gbox_vlayout.setSpacing(2) _cond_states_gbox_vlayout.setContentsMargins(2, 2, 2, 2) _main_vlayout = QtImport.QHBoxLayout(self) _main_vlayout.addWidget(_cond_states_gbox) _main_vlayout.addWidget(self.graph_graphics_view) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) # Other --------------------------------------------------------------- self.cond_states_table.verticalHeader().setDefaultSectionSize(20) self.cond_states_table.horizontalHeader().setDefaultSectionSize(20) # setSelectionMode(QtImport.QAbstractItemView::SingleSelection); font = self.cond_states_table.font() font.setPointSize(8) self.cond_states_table.setFont(font) self.splitter.setSizes([200, 20]) self.log_treewidget.setColumnCount(6) self.log_treewidget.setHeaderLabels( ["State", "Start time", "End time", "Total time", "Previous state", "Notes"] ) self.graph_graphics_view.setFixedSize(900, 600) self.graph_graphics_scene.setSceneRect(0, 0, 900, 600) self.graph_graphics_view.setScene(self.graph_graphics_scene) self.graph_graphics_view.setHorizontalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff ) self.graph_graphics_view.setVerticalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff ) self.graph_graphics_view.setDragMode(QtImport.QGraphicsView.RubberBandDrag) self.graph_graphics_view.setRenderHint(QtImport.QPainter.Antialiasing) self.graph_graphics_view.setRenderHint(QtImport.QPainter.TextAntialiasing)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self.axis_camera = None self.sc_camera = None # Properties ---------------------------------------------------------- self.add_property("hwobj_axis_camera", "string", "") self.add_property("hwobj_sc_camera", "string", "") # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- status_widget = QtImport.QWidget(self) status_label = QtImport.QLabel("Status: ", status_widget) self.status_ledit = QtImport.QLineEdit(status_widget) self.camera_live_cbx = QtImport.QCheckBox("Live view", self) self.camera_live_cbx.setChecked(False) self.progress_bar = QtImport.QProgressBar(self) self.progress_bar.setMinimum(0) camera_widget = QtImport.QWidget(self) self.axis_view = QtImport.QGraphicsView(camera_widget) axis_scene = QtImport.QGraphicsScene(self.axis_view) self.axis_view.setScene(axis_scene) self.axis_camera_pixmap_item = QtImport.QGraphicsPixmapItem() axis_scene.addItem(self.axis_camera_pixmap_item) self.sc_view = QtImport.QGraphicsView(camera_widget) sc_scene = QtImport.QGraphicsScene(self.sc_view) self.sc_view.setScene(sc_scene) self.sc_camera_pixmap_item = QtImport.QGraphicsPixmapItem() sc_scene.addItem(self.sc_camera_pixmap_item) # Layout -------------------------------------------------------------- _status_widget_hlayout = QtImport.QHBoxLayout(status_widget) _status_widget_hlayout.addWidget(status_label) _status_widget_hlayout.addWidget(self.status_ledit) _camera_widget_hlayout = QtImport.QHBoxLayout(camera_widget) _camera_widget_hlayout.addWidget(self.axis_view) _camera_widget_hlayout.addWidget(self.sc_view) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(status_widget) _main_vlayout.addWidget(self.camera_live_cbx) _main_vlayout.addWidget(camera_widget) _main_vlayout.addWidget(self.progress_bar) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.camera_live_cbx.stateChanged.connect( self.camera_live_state_changed) if HWR.beamline.sample_changer is not None: self.connect( HWR.beamline.sample_changer, SampleChanger.STATUS_CHANGED_EVENT, self.sample_changer_status_changed, ) self.connect(HWR.beamline.sample_changer, "progressInit", self.init_progress) self.connect(HWR.beamline.sample_changer, "progressStep", self.step_progress) self.connect(HWR.beamline.sample_changer, "progressStop", self.stop_progress)