示例#1
0
    def set_mounted_style(self, state, clear_background=False):
        self.mounted_style = state

        if state:
            self.setIcon(0, PIN_ICON)
            self.setBackground(0, QtImport.QBrush(Colors.PLUM))
            self.setBackground(1, QtImport.QBrush(Colors.PLUM))
            self.setSelected(True)
            bold_fond = self.font(1)
            bold_fond.setBold(True)
            self.setFont(1, bold_fond)
            if self.parent():
                self.parent().setExpanded(True)
        else:
            self.setIcon(0, QtImport.QIcon())

            if clear_background:
                self.set_background_color(0)
            else:
                queue_entry = self.get_queue_entry()

                if queue_entry:
                    queue_entry._set_background_color()

            self.setSelected(False)
            self.setFontBold(False)
            self.setText(1, "")
示例#2
0
    def update_pin_icon(self):
        dc_tree_widget = self.listView().parent()

        if dc_tree_widget._loaded_sample_item:
            dc_tree_widget._loaded_sample_item.setIcon(0, QtImport.QPixmap())

        dc_tree_widget._loaded_sample_item = self
        self.setIcon(0, QtImport.QIcon(dc_tree_widget.pin_pixmap))
示例#3
0
    def refresh_plate_location(self):
        new_location = HWR.beamline.plate_manipulator.get_plate_location()
        self.plate_navigator_cell.setEnabled(True)

        if new_location:
            row = new_location[0]
            col = new_location[1]
            pos_x = new_location[2]
            pos_y = new_location[3]
            self.navigation_item.set_navigation_pos(pos_x, pos_y)
            self.plate_navigator_cell.update()
            if self.__current_location != new_location:
                empty_item = QtImport.QTableWidgetItem(QtImport.QIcon(), "")
                self.plate_navigator_table.setItem(self.__current_location[0],
                                                   self.__current_location[1],
                                                   empty_item)
                new_item = QtImport.QTableWidgetItem(
                    Icons.load_icon("sample_axis"), "")
                self.plate_navigator_table.setItem(row, col, new_item)
                self.__current_location = new_location
示例#4
0
    def state_changed(self, state_list):
        self.log_treewidget.clear()
        # state_list = [state_list]

        for state in state_list:
            temp_item = QtImport.QTreeWidgetItem()
            temp_item.setText(0, self.get_state_by_name(state["current_state"])["desc"])
            temp_item.setText(1, state["start_time"])
            temp_item.setText(2, state["end_time"])
            temp_item.setText(3, state["total_time"])
            temp_item.setText(
                4, self.get_state_by_name(state["previous_state"])["desc"]
            )
            self.log_treewidget.insertTopLevelItem(0, temp_item)

        for col in range(5):
            self.log_treewidget.resizeColumnToContents(col)

        new_state = state_list[-1]

        for col, state in enumerate(self.states_list):
            for row, condition in enumerate(self.cond_list):
                color = Colors.WHITE
                # if row % 5:
                #    color = Colors.WHITE
                if not col % 5 or not row % 5:
                    color = Colors.LIGHT_2_GRAY

                self.cond_states_table.item(row, col).setBackground(color)
                self.cond_states_table.item(row, col).setText("")
                self.cond_states_table.item(row, col).setIcon(QtImport.QIcon())

                for translation in self.trans_list:
                    if (
                        translation["source"] == new_state["current_state"]
                        and translation["dest"] == state["name"]
                    ):
                        if condition["name"] in translation["conditions_true"]:
                            self.cond_states_table.item(row, col).setBackground(
                                Colors.LIGHT_GREEN
                            )
                            # self.cond_states_table.item(row, col).setText(str(index))
                        elif condition["name"] in translation["conditions_false"]:
                            self.cond_states_table.item(row, col).setBackground(
                                Colors.LIGHT_RED
                            )
                            # self.cond_states_table.item(row, col).setText(str(index))
                        if (
                            condition["name"] in translation["conditions_true"]
                            or condition["name"] in translation["conditions_false"]
                        ):
                            if condition["value"]:
                                self.cond_states_table.item(row, col).setIcon(
                                    self.check_icon
                                )
                            else:
                                self.cond_states_table.item(row, col).setIcon(
                                    self.reject_icon
                                )

                if state["name"] == new_state["current_state"]:
                    if "error" in state.get("type", []):
                        color = Colors.LIGHT_RED
                    else:
                        color = Colors.LIGHT_GREEN
                    self.cond_states_table.item(row, col).setBackground(color)

        for graph_node in self.state_graph_node_list:
            graph_node.setSelected(
                graph_node.state_dict["name"] == new_state["current_state"]
            )
        self.graph_graphics_scene.update()