Пример #1
0
 def __init__(self, parent):
     super(SelectorFilter, self).__init__(parent=parent)
     self.setObjectName("SelectorFilter")
     if filter_store.data_type == "perfo":
         self.setFixedHeight(0)
         self.setMinimumWidth(1150)
     self.set_background_color(color_bleu_gris)
     self.search_code = TextEdit(upper_mode=True)
     self.init_widget()
Пример #2
0
 def __init__(self, plan_prod, parent=None):
     super(BlocParamProd, self).__init__(parent=parent)
     # self.setFixedHeight(50)
     self.setFocusPolicy(Qt.ClickFocus)
     self.background_color = color_bleu_gris
     self.plan_prod = plan_prod
     self.hbox_master = QHBoxLayout()
     self.text_edit_tours = TextEdit(number_only=True, number_limit=1000)
     self.text_edit_tours.setText(str(self.plan_prod.tours))
     self.text_edit_tours.setStyleSheet(line_edit_green_stylesheet)
     self.text_edit_tours.textChanged.connect(self.handle_tours_changed)
     self.label_end = QLabel("Fin production : {}".format(timestamp_to_hour_little(self.plan_prod.end)))
     import time
     text_time_reglage = time.strftime("%H:%M:%S", time.gmtime(self.plan_prod.data_reglages.time_reglage * 60))
     self.label_time_reglage = QLabel("Réglage : {}".format(text_time_reglage))
     value_time_prod = self.plan_prod.end - self.plan_prod.start - self.plan_prod.data_reglages.time_reglage*3600
     text_prod = time.strftime("%H:%M:%S", time.gmtime(value_time_prod / 60))
     self.label_time_prod = QLabel("Production : {}".format(text_prod))
     self.update_label()
     self.init_ui()
Пример #3
0
class BlocParamProd(MondonWidget):
    def __init__(self, plan_prod, parent=None):
        super(BlocParamProd, self).__init__(parent=parent)
        # self.setFixedHeight(50)
        self.setFocusPolicy(Qt.ClickFocus)
        self.background_color = color_bleu_gris
        self.plan_prod = plan_prod
        self.hbox_master = QHBoxLayout()
        self.text_edit_tours = TextEdit(number_only=True, number_limit=1000)
        self.text_edit_tours.setText(str(self.plan_prod.tours))
        self.text_edit_tours.setStyleSheet(line_edit_green_stylesheet)
        self.text_edit_tours.textChanged.connect(self.handle_tours_changed)
        self.label_end = QLabel("Fin production : {}".format(timestamp_to_hour_little(self.plan_prod.end)))
        import time
        text_time_reglage = time.strftime("%H:%M:%S", time.gmtime(self.plan_prod.data_reglages.time_reglage * 60))
        self.label_time_reglage = QLabel("Réglage : {}".format(text_time_reglage))
        value_time_prod = self.plan_prod.end - self.plan_prod.start - self.plan_prod.data_reglages.time_reglage*3600
        text_prod = time.strftime("%H:%M:%S", time.gmtime(value_time_prod / 60))
        self.label_time_prod = QLabel("Production : {}".format(text_prod))
        self.update_label()
        self.init_ui()

    def init_ui(self):
        label_nb_tours = QLabel("Nombre de tours : ")
        label_nb_tours.setStyleSheet(white_12_label_stylesheet)
        self.hbox_master.addWidget(label_nb_tours)
        self.text_edit_tours.setFixedWidth(40)
        self.text_edit_tours.setAlignment(Qt.AlignCenter)
        self.hbox_master.addWidget(self.text_edit_tours)
        self.hbox_master.addStretch(1)
        label_prod = QLabel("PRODUCTION")
        label_prod.setStyleSheet(white_16_bold_label_stylesheet)
        self.hbox_master.addWidget(label_prod)
        self.hbox_master.addStretch(1)
        vbox = QVBoxLayout()
        label_debut = QLabel("Début production : {}".format(timestamp_to_hour_little(self.plan_prod.start)))
        label_debut.setStyleSheet(white_12_label_stylesheet)
        label_debut.setAlignment(Qt.AlignRight)
        self.label_end.setStyleSheet(white_12_label_stylesheet)
        self.label_end.setAlignment(Qt.AlignRight)
        self.label_time_reglage.setStyleSheet(white_12_label_stylesheet)
        self.label_time_reglage.setAlignment(Qt.AlignRight)
        self.label_time_prod.setStyleSheet(white_12_label_stylesheet)
        self.label_time_prod.setAlignment(Qt.AlignRight)
        vbox.addWidget(label_debut)
        vbox.addWidget(self.label_time_reglage)
        vbox.addWidget(self.label_time_prod)
        vbox.addWidget(self.label_end)
        self.hbox_master.addLayout(vbox)
        self.setLayout(self.hbox_master)

    def update_label(self):
        self.plan_prod.get_end()
        if self.text_edit_tours.text() != self.plan_prod.tours:
            self.text_edit_tours.setText(str(self.plan_prod.tours))
        self.label_end.setText("Fin production : {}".format(timestamp_to_hour_little(self.plan_prod.end)))
        import time
        text_time_reglage = time.strftime("%H:%M:%S", time.gmtime(self.plan_prod.data_reglages.time_reglage*60))
        self.label_time_reglage.setText("Réglage : {}".format(text_time_reglage))
        value_time_prod = self.plan_prod.end - self.plan_prod.start - self.plan_prod.data_reglages.time_reglage*60
        if value_time_prod < 0:
            value_time_prod = 0
        text_prod = time.strftime("%H:%M:%S", time.gmtime(value_time_prod))
        self.label_time_prod.setText("Production : {}".format(text_prod))

    def handle_tours_changed(self, text_edit_value):
        if text_edit_value == "":
            self.plan_prod.set_tours(0)
            self.text_edit_tours.setStyleSheet(line_edit_red_stylesheet)
        else:
            self.text_edit_tours.setStyleSheet(line_edit_green_stylesheet)
            self.plan_prod.set_tours(int(text_edit_value))
Пример #4
0
 def __init__(self, type_event, event=None):
     super(EventConfig, self).__init__(None)
     self.setWindowFlags(Qt.Dialog)
     self.setFocusPolicy(Qt.ClickFocus)
     self.type_event = type_event
     self.ensemble_dropdown = Dropdown(parent=self)
     self.info_text_edit = QTextEdit()
     self.start_hour = TextEdit(number_only=True,
                                number_min=6,
                                number_max=22,
                                width=self.WIDTH_TEXT_EDIT,
                                alignement="center",
                                init_value="")
     self.start_hour.textEdited.connect(lambda: self.on_settings_changed(
         value=self.start_hour.text(), name="start", unit="hour"))
     self.start_min = TextEdit(number_only=True,
                               number_min=0,
                               number_max=59,
                               init_value=0,
                               width=self.WIDTH_TEXT_EDIT,
                               alignement="center",
                               mode_min=True)
     self.start_min.textEdited.connect(lambda: self.on_settings_changed(
         value=self.start_min.text(), name="start", unit="min"))
     self.duration_hour = TextEdit(number_only=True,
                                   number_min=0,
                                   number_max=16,
                                   width=self.WIDTH_TEXT_EDIT,
                                   alignement="center",
                                   init_value="-")
     self.duration_hour.textEdited.connect(lambda: self.on_settings_changed(
         value=self.duration_hour.text(), name="duration", unit="hour"))
     self.duration_min = TextEdit(number_only=True,
                                  number_min=0,
                                  number_max=59,
                                  init_value="-",
                                  width=self.WIDTH_TEXT_EDIT,
                                  alignement="center",
                                  mode_min=True)
     self.duration_min.textEdited.connect(lambda: self.on_settings_changed(
         value=self.duration_min.text(), name="duration", unit="min"))
     self.end_hour = TextEdit(number_only=True,
                              number_min=6,
                              number_max=22,
                              width=self.WIDTH_TEXT_EDIT,
                              alignement="center",
                              init_value="-")
     self.end_hour.textEdited.connect(lambda: self.on_settings_changed(
         value=self.end_hour.text(), name="end", unit="hour"))
     self.end_min = TextEdit(number_only=True,
                             number_min=0,
                             number_max=59,
                             init_value=0,
                             width=self.WIDTH_TEXT_EDIT,
                             alignement="center",
                             mode_min=True)
     self.end_min.textEdited.connect(lambda: self.on_settings_changed(
         value=self.end_min.text(), name="end", unit="min"))
     self.event = event
     if event:
         self.p_id = event.p_id
         self.start = event.start
         self.end = event.end
         self.duration = self.end - self.start
         self.ensemble = event.ensemble
         self.info = event.info
         self.init_text_edit()
         self.init_info()
         self.init_ensemble()
     else:
         self.p_id = None
         self.start = None
         self.duration = None
         self.end = None
         self.ensemble = None
         self.info = None
     self.status_label = QLabel()
     self.bt_valid = QPushButton("Validé")
     self.init_widget()
     self.show()
     self.setFixedSize(self.size())
     self.update_bt_validate()
Пример #5
0
class EventConfig(QWidget):
    WIDTH_TEXT_EDIT = 30

    def __init__(self, type_event, event=None):
        super(EventConfig, self).__init__(None)
        self.setWindowFlags(Qt.Dialog)
        self.setFocusPolicy(Qt.ClickFocus)
        self.type_event = type_event
        self.ensemble_dropdown = Dropdown(parent=self)
        self.info_text_edit = QTextEdit()
        self.start_hour = TextEdit(number_only=True,
                                   number_min=6,
                                   number_max=22,
                                   width=self.WIDTH_TEXT_EDIT,
                                   alignement="center",
                                   init_value="")
        self.start_hour.textEdited.connect(lambda: self.on_settings_changed(
            value=self.start_hour.text(), name="start", unit="hour"))
        self.start_min = TextEdit(number_only=True,
                                  number_min=0,
                                  number_max=59,
                                  init_value=0,
                                  width=self.WIDTH_TEXT_EDIT,
                                  alignement="center",
                                  mode_min=True)
        self.start_min.textEdited.connect(lambda: self.on_settings_changed(
            value=self.start_min.text(), name="start", unit="min"))
        self.duration_hour = TextEdit(number_only=True,
                                      number_min=0,
                                      number_max=16,
                                      width=self.WIDTH_TEXT_EDIT,
                                      alignement="center",
                                      init_value="-")
        self.duration_hour.textEdited.connect(lambda: self.on_settings_changed(
            value=self.duration_hour.text(), name="duration", unit="hour"))
        self.duration_min = TextEdit(number_only=True,
                                     number_min=0,
                                     number_max=59,
                                     init_value="-",
                                     width=self.WIDTH_TEXT_EDIT,
                                     alignement="center",
                                     mode_min=True)
        self.duration_min.textEdited.connect(lambda: self.on_settings_changed(
            value=self.duration_min.text(), name="duration", unit="min"))
        self.end_hour = TextEdit(number_only=True,
                                 number_min=6,
                                 number_max=22,
                                 width=self.WIDTH_TEXT_EDIT,
                                 alignement="center",
                                 init_value="-")
        self.end_hour.textEdited.connect(lambda: self.on_settings_changed(
            value=self.end_hour.text(), name="end", unit="hour"))
        self.end_min = TextEdit(number_only=True,
                                number_min=0,
                                number_max=59,
                                init_value=0,
                                width=self.WIDTH_TEXT_EDIT,
                                alignement="center",
                                mode_min=True)
        self.end_min.textEdited.connect(lambda: self.on_settings_changed(
            value=self.end_min.text(), name="end", unit="min"))
        self.event = event
        if event:
            self.p_id = event.p_id
            self.start = event.start
            self.end = event.end
            self.duration = self.end - self.start
            self.ensemble = event.ensemble
            self.info = event.info
            self.init_text_edit()
            self.init_info()
            self.init_ensemble()
        else:
            self.p_id = None
            self.start = None
            self.duration = None
            self.end = None
            self.ensemble = None
            self.info = None
        self.status_label = QLabel()
        self.bt_valid = QPushButton("Validé")
        self.init_widget()
        self.show()
        self.setFixedSize(self.size())
        self.update_bt_validate()

    def init_text_edit(self):
        self.start_min.setText(str(get_min_in_timestamp(self.start)))
        self.start_hour.setText(str(get_hour_in_timestamp(self.start)))
        self.end_min.setText(str(get_min_in_timestamp(self.end)))
        self.end_hour.setText(str(get_hour_in_timestamp(self.end)))
        self.duration_min.setText(str(self.get_min_in_duration(self.duration)))
        self.duration_hour.setText(
            str(self.get_hour_in_duration(self.duration)))

    def init_info(self):
        if self.info is not None:
            self.info_text_edit.setText(self.info)

    def init_ensemble(self):
        if self.ensemble is not None:
            self.ensemble_dropdown.update_value_selected(self.ensemble)

    def update_bt_validate(self):
        if self.is_valid_event():
            self.bt_valid.setDisabled(False)
        else:
            self.bt_valid.setDisabled(True)

    def is_valid_event(self):
        if self.start is None or self.end is None:
            self.status_label.setText(
                "Début ou fin de l'événement non renseigné")
            self.status_label.setStyleSheet(red_12_label_stylesheet)
            return False
        if get_hour_in_timestamp(self.start) < 6:
            self.status_label.setText("Début de l'événement avant 06:00")
            self.status_label.setStyleSheet(red_12_label_stylesheet)
            return False
        if self.end > timestamp_at_time(self.start, hours=22):
            self.status_label.setText("Fin de l'événement après 22:00")
            self.status_label.setStyleSheet(red_12_label_stylesheet)
            return False
        if self.end < self.start:
            self.status_label.setText("Fin de l'événement supérieur au début")
            self.status_label.setStyleSheet(red_12_label_stylesheet)
            return False
        self.status_label.setText("Evénement valide")
        self.status_label.setStyleSheet(green_12_label_stylesheet)
        return True

    def on_settings_changed(self, value, name, unit):
        if name == "start":
            self.on_start_settings_changed(value=value, unit=unit)
        if name == "duration":
            self.on_duration_settings_changed(value=value, unit=unit)
        if name == "end":
            self.on_end_settings_changed(value=value, unit=unit)
        self.update_bt_validate()

    def on_start_settings_changed(self, value, unit):
        # Récupère les valeurs des champs start
        try:
            start_hour = int(self.start_hour.text())
        except ValueError:
            start_hour = None
        try:
            start_min = int(self.start_min.text())
        except ValueError:
            start_min = None
        if start_hour is None or start_min is None:
            self.start = None
        # Limite le start à 22h
        if unit == "min" and start_hour == 22:
            self.start_min.setText("00")
        if unit == "hour" and value == 22 and start_min > 0:
            self.start_min.setText("21")
        # Update le ts start
        if start_hour is not None and start_min is not None:
            self.start = self.get_timestamp_at_time(start_hour, start_min)
        # Calcul la durée et update les champs duration
        if self.start and self.end:
            self.duration = self.end - self.start
            self.update_text_edit(name="duration")
        # Calcul la fin et update les champs fin
        elif self.start and self.duration:
            self.end = self.start + self.duration
            self.update_text_edit(name="end")

    def on_duration_settings_changed(self, value, unit):
        # Récupère les valeurs des champs duration
        # Update hour à 00 si la minute est renseigné et que l'heure est à "-"
        if self.duration_hour.text() == "-" and self.duration_min:
            self.duration_hour.setText("00")
        try:
            duration_hour = int(self.duration_hour.text())
        except ValueError:
            duration_hour = None
        # Update min à 00 si l'heure est renseigné et que la min est à "-"
        if duration_hour and self.duration_min.text() == "-":
            self.duration_min.setText("00")
        try:
            duration_min = int(self.duration_min.text())
        except ValueError:
            duration_min = None
        if duration_hour is None or duration_min is None:
            self.duration = None
        # Limite le duration à 22h
        if unit == "min" and duration_hour == 22:
            self.duration_min.setText("00")
        if unit == "hour" and value == 22 and duration_min > 0:
            self.duration_min.setText("21")
        # Update le ts duration
        if duration_hour is not None and duration_min is not None:
            self.duration = self.get_duration_time(hours=duration_hour,
                                                   p_min=duration_min)
        # Calcul la fin et update les champs fin
        if self.start and self.duration:
            self.end = self.start + self.duration
            self.update_text_edit(name="end")
        # Calcul le start et update les champs start
        elif self.end and self.duration:
            self.start = self.end - self.duration
            self.update_text_edit(name="start")

    def on_end_settings_changed(self, value, unit):
        # Récupère les valeurs des champs end
        try:
            end_hour = int(self.end_hour.text())
        except ValueError:
            end_hour = None
        try:
            end_min = int(self.end_min.text())
        except ValueError:
            end_min = None
        if end_hour is None or end_min is None:
            self.end = None
        # Limite le end à 22h
        if unit == "min" and end_hour == 22:
            self.end_min.setText("00")
        if unit == "hour" and value == 22 and end_min > 0:
            self.end_min.setText("21")
        # Update le ts end
        if end_hour is not None and end_min is not None:
            self.end = self.get_timestamp_at_time(end_hour, end_min)
        # Calcul la durée et update les champs duration
        if self.start and self.end:
            self.duration = self.end - self.start
            self.update_text_edit(name="duration")
        # Calcul le start et update les champs start
        elif self.end and self.duration:
            self.start = self.end - self.duration
            self.update_text_edit(name="start")

    def update_text_edit(self, name):
        text_edit_hour = None
        text_edit_min = None
        ts = None
        if name == "start":
            text_edit_hour = self.start_hour
            text_edit_min = self.start_min
            ts = self.start
        if name == "duration":
            text_edit_hour = self.duration_hour
            text_edit_min = self.duration_min
        if name == "end":
            text_edit_hour = self.end_hour
            text_edit_min = self.end_min
            ts = self.end
        if text_edit_hour and text_edit_min and ts:
            if text_edit_hour.text() != str(get_hour_in_timestamp(ts)):
                text_edit_hour.setText(str(get_hour_in_timestamp(ts)))
            if text_edit_min.text() != str(get_min_in_timestamp(ts)):
                text_edit_min.setText(str(get_min_in_timestamp(ts)))
        else:
            if text_edit_hour.text() != str(
                    self.get_hour_in_duration(self.duration)):
                text_edit_hour.setText(
                    str(self.get_hour_in_duration(self.duration)))
            if text_edit_min.text() != str(
                    self.get_min_in_duration(self.duration)):
                text_edit_min.setText(
                    str(self.get_min_in_duration(self.duration)))

    @staticmethod
    def get_hour_in_duration(seconds):
        return int(seconds / 3600)

    @staticmethod
    def get_min_in_duration(seconds):
        hours = int(seconds / 3600)
        new_seconds = seconds - hours * 3600
        return int(new_seconds / 60)

    @staticmethod
    def get_duration_time(hours, p_min):
        return (hours * 60 + p_min) * 60

    @staticmethod
    def get_timestamp_at_time(hours, p_min):
        ts_at_day_ago = timestamp_at_day_ago(settings_store_gestion.day_ago)
        ts = timestamp_at_time(ts=ts_at_day_ago, hours=hours, min=p_min)
        return ts

    def init_widget(self):
        vbox = QVBoxLayout()
        vbox.setContentsMargins(5, 5, 5, 5)
        vbox.addWidget(self.get_bloc_title())
        vbox.addWidget(self.get_bloc_settings())
        vbox.addWidget(self.get_bloc_info())
        vbox.addWidget(self.get_bloc_bt())
        vbox.addWidget(self.status_label)
        self.setLayout(vbox)

    def get_bloc_title(self):
        title_contain = QWidget(parent=self)
        self.set_background_color(title_contain)
        title_label = QLabel(self.get_title())
        title_label.setStyleSheet(white_16_bold_label_stylesheet)
        title_contain_hbox = QHBoxLayout()
        title_contain_hbox.addWidget(title_label)
        title_contain.setLayout(title_contain_hbox)
        return title_contain

    def get_bloc_settings(self):
        settings_contain = QWidget(parent=self)
        self.set_background_color(settings_contain)
        settings_contain_vbox = QVBoxLayout()
        settings_contain_vbox.addLayout(
            self.get_line_setting("Début :", self.start_hour, self.start_min))
        settings_contain_vbox.addLayout(
            self.get_line_setting("Durée :", self.duration_hour,
                                  self.duration_min))
        settings_contain_vbox.addLayout(
            self.get_line_setting("Fin :", self.end_hour, self.end_min))
        settings_contain.setLayout(settings_contain_vbox)
        return settings_contain

    @staticmethod
    def get_line_setting(text, text_edit_hour, text_edit_min):
        hbox = QHBoxLayout()
        hbox.setSpacing(0)
        label = QLabel(text)
        label.setStyleSheet(white_14_label_no_background_stylesheet)
        hbox.addWidget(label)
        hbox.addStretch()
        hbox.addWidget(text_edit_hour)
        double_point_label = QLabel("h :")
        double_point_label.setStyleSheet(
            white_14_label_no_background_stylesheet)
        hbox.addWidget(double_point_label)
        hbox.addWidget(text_edit_min)
        min_label = QLabel("min")
        min_label.setStyleSheet(white_14_label_no_background_stylesheet)
        hbox.addWidget(min_label)
        return hbox

    def get_bloc_info(self):
        info_contain = QWidget(parent=self)
        self.set_background_color(info_contain)
        info_contain_vbox = QVBoxLayout()
        if self.type_event == "tool":
            self.ensemble_dropdown.set_placeholder(
                "Sélectionner l'ensemble concerné")
            ensemble_dropdown_items = [
                "Colle à froid", "Enrouleurs", "Groupe appel enrouleur",
                "Calandre", "Colle à chaud", "Cadre guidage",
                "Groupe imprimeur", "Dérouleur papier", "Dérouleur polypro"
            ]
            for item in ensemble_dropdown_items:
                self.ensemble_dropdown.add_item(item)
                self.ensemble_dropdown.VALUE_SELECTED_SIGNAL.connect(
                    self.add_ensemble)
            info_contain_vbox.addWidget(self.ensemble_dropdown)

        self.info_text_edit.setPlaceholderText("Information complémentaire...")
        self.info_text_edit.setStyleSheet(white_text_edit_stylesheet)
        self.info_text_edit.setFixedHeight(50)
        self.info_text_edit.textChanged.connect(
            lambda: self.on_info_text_changed(self.info_text_edit))
        info_contain_vbox.addWidget(self.info_text_edit)
        info_contain.setLayout(info_contain_vbox)
        return info_contain

    def add_ensemble(self, text):
        self.ensemble = text

    def on_info_text_changed(self, text_edit):
        self.info = text_edit.toPlainText()

    def get_bloc_bt(self):
        bt_contain = QWidget(parent=self)
        self.set_background_color(bt_contain)
        bt_contain_hbox = QHBoxLayout()
        self.bt_valid.setStyleSheet(button_little_stylesheet)
        self.bt_valid.setFixedSize(80, 25)
        self.bt_valid.clicked.connect(self.save_event)
        bt_cancel = QPushButton("Annuler")
        bt_cancel.clicked.connect(self.close)
        bt_cancel.setStyleSheet(button_little_red_stylesheet)
        bt_cancel.setFixedSize(80, 25)
        bt_contain_hbox.addWidget(self.bt_valid)
        bt_contain_hbox.addWidget(bt_cancel)
        bt_contain.setLayout(bt_contain_hbox)
        return bt_contain

    def get_title(self):
        if self.type_event == "clean":
            return "Ajouter un nettoyage machine"
        if self.type_event == "stop":
            return "Ajouter un arrêt production"
        if self.type_event == "tool":
            return "Ajouter une action de maintenance"

    @staticmethod
    def set_background_color(widget):
        widget.setStyleSheet("background-color:{color_bleu_gris};".format(
            color_bleu_gris=color_bleu_gris.hex_string))

    def save_event(self):
        settings_store_gestion.save_event(self)
        self.close()
Пример #6
0
 def create_text_edit(self, value, min=0, max=60):
     """
     S'occupe de créer un champs éditable
     """
     # On crée le champs éditable
     text_edit = TextEdit()
     text_edit.setText(str(value))
     text_edit.setAlignment(Qt.AlignCenter | Qt.AlignVCenter)
     text_edit.setStyleSheet(line_edit_stylesheet)
     text_edit.setAttribute(Qt.WA_MacShowFocusRect, 0)
     text_edit.setFixedSize(20, 20)
     text_edit.setValidator(QIntValidator(min, max))
     text_edit.returnPressed.connect(lambda: self.editable_item_change(
         text_edit.text(), text_edit, clear_focus=True))
     text_edit.textChanged.connect(
         lambda: self.editable_item_change(text_edit.text(), text_edit))
     self.array_text_edit.append(text_edit)
     return text_edit
Пример #7
0
class SelectorFilter(MondonWidget):
    def __init__(self, parent):
        super(SelectorFilter, self).__init__(parent=parent)
        self.setObjectName("SelectorFilter")
        if filter_store.data_type == "perfo":
            self.setFixedHeight(0)
            self.setMinimumWidth(1150)
        self.set_background_color(color_bleu_gris)
        self.search_code = TextEdit(upper_mode=True)
        self.init_widget()

    def init_widget(self):
        hbox = QHBoxLayout()
        hbox.setContentsMargins(10, 10, 30, 10)
        hbox.setSpacing(10)
        if filter_store.data_type == "bobine":
            hbox.addLayout(self.get_search_bar())
        if filter_store.data_type == "bobine":
            for index in range(len(filter_store.list_filter_bobine_fille)):
                hbox.addWidget(
                    SelectorCollumFilter(
                        parent=self,
                        title=filter_store.title_filter_bobine_fille[index],
                        name_filter=filter_store.
                        list_filter_bobine_fille[index],
                        sort_mode=filter_store.sort_mode_bobine_fille[index],
                        filter_mode=filter_store.
                        filter_mode_bobine_fille[index]))
        if filter_store.data_type == "poly":
            for index in range(len(filter_store.list_filter_poly)):
                hbox.addWidget(
                    SelectorCollumFilter(
                        parent=self,
                        title=filter_store.title_filter_poly[index],
                        name_filter=filter_store.list_filter_poly[index],
                        sort_mode=filter_store.sort_mode_poly[index],
                        filter_mode=filter_store.filter_mode_poly[index]))
        if filter_store.data_type == "refente":
            for index in range(len(filter_store.list_filter_refente)):
                hbox.addWidget(
                    SelectorCollumFilter(
                        parent=self,
                        title=filter_store.title_filter_refente[index],
                        name_filter=filter_store.list_filter_refente[index],
                        sort_mode=filter_store.sort_mode_refente[index],
                        filter_mode=filter_store.filter_mode_refente[index]))
        if filter_store.data_type == "papier":
            for index in range(len(filter_store.list_filter_papier)):
                hbox.addWidget(
                    SelectorCollumFilter(
                        parent=self,
                        title=filter_store.title_filter_papier[index],
                        name_filter=filter_store.list_filter_papier[index],
                        sort_mode=filter_store.sort_mode_papier[index],
                        filter_mode=filter_store.filter_mode_papier[index]))
        self.setLayout(hbox)

    @staticmethod
    def get_label(text):
        label = QLabel(text)
        label.setStyleSheet(black_14_label_stylesheet)
        return label

    def get_search_bar(self):
        self.search_code.setStyleSheet(line_edit_stylesheet)
        self.search_code.textChanged.connect(self.handle_search_code_changed)
        self.search_code.setFixedWidth(250 - 21)
        icone_search = Image(parent=self,
                             img="commun/assets/images/icon_search.png",
                             size=21,
                             background_color=color_blanc)
        layout_search_bar = QHBoxLayout()
        layout_search_bar.setSpacing(0)
        layout_search_bar.setContentsMargins(0, 0, 0, 0)
        layout_search_bar.addWidget(self.search_code)
        layout_search_bar.addWidget(icone_search)
        return layout_search_bar

    def handle_search_code_changed(self):
        filter_store.set_search_code(search_code=self.search_code.text())