Exemple #1
0
    def initUI(self):

        main_layout = QGridLayout()

        self.table = widj_tab1.table_setting(
            ["Name"])
        self.table.setSelectionBehavior(QAbstractItemView.SelectItems)  # Выделяет всю строку
        self.table.setRowCount(1)

        self.prefix = widj_tab1.lile_label_name("Префикс", "")

        button_generat = widj_tab1.button_setting("Сгенерировать", self.gerait)

        self.table.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents)
        self.table2 = widj_tab1.table_setting(
            ["Name", "Marka"])
        self.table2.setFixedHeight(400)
        self.table2.setRowCount(1)
        self.table3 = widj_tab1.table_setting(
            ["Marka"])
        self.table3.setFixedWidth(800)

        main_layout.addWidget(self.table, 0, 0, 27, 1)
        main_layout.addWidget(self.table3, 0, 1, 27, 1)
        main_layout.addWidget(self.table2, 27, 0, 1, 2)

        main_layout.addWidget(self.prefix, 17, 2, 1, 2)
        main_layout.addWidget(button_generat, 27, 2, 1, 2)

        # self.hide_all()

        self.setLayout(main_layout)
        # connet the scroll bar signle to our slot
        self.table.verticalScrollBar().valueChanged.connect(self.__chnge_position)
        self.table3.verticalScrollBar().valueChanged.connect(self.__chnge_position)
    def initUI(self):

        main_layout = QGridLayout()

        self.table = widj_tab1.table_setting([
            "MARKA", "NAME", "KLASSNAME", "EVKLASSNAME", "PLCNAME",
            "PLC_ADRESS", "OBJSIGN"
        ])
        self.table.setSelectionBehavior(
            QAbstractItemView.SelectItems
        )  # Выделяет всю строку

        button_open = widj_tab1.button_setting("Открыть xml",
                                               self.open_xml)
        button_except = widj_tab1.button_setting("Добавить",
                                                 self.tab_view)
        button_clean = widj_tab1.button_setting("Очистить",
                                                self.table_clean)
        button_generat = widj_tab1.button_setting("Сгенерировать",
                                                  self.gerait_xml)
        self.xml_template = QLabel("None")
        self.xml_template.setWordWrap(True)

        self.text_panel = QTextEdit()
        self.text_panel.setText(
            """[dict(MARKA=f"GP0011_SPPV_{item1}", NAME=f"{item2}", OBJSIGN=f"P", KLASSNAME="[ВСЕ]\Водоснабжение\ГП0011 СППВ", EVKLASSNAME="[Все технологические]\Водоснабжение\ГП0011 СППВ", PLCNAME="ICore_2") for item1, item2 in [["K12_WORK", "Работа"], ["K12_ALARM", "Авария"],["K13_WORK", "Работа"], ["K13_ALARM", "Авария"]]]"""
        )

        self.table.setMaximumWidth(1700)
        self.table.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents)

        main_layout.addWidget(self.table, 0, 0, 27, 1)
        # main_layout.addWidget(self.text_panel, 27, 0, 1, 1)
        # main_layout.addWidget(self.xml_template, 12, 2, 1, 2)

        main_layout.addWidget(button_clean, 15, 2, 1, 2)
        # main_layout.addWidget(button_except, 15, 2, 1, 1)
        main_layout.addWidget(button_open, 14, 2, 1, 2)

        # main_layout.addWidget(button_generat, 27, 2, 1, 2)

        # self.hide_all()

        self.setLayout(main_layout)