def initUI(self): main_layout = QGridLayout() self.table = widj_tab1.table_setting(["ObjectName", "PARAMID"]) self.table.setRowCount(1) self.table.setItem(0, 1, QTableWidgetItem('None')) self.table1 = widj_tab1.table_setting(["ObjectName", "PARAMID"]) header = self.table.horizontalHeader() header.setSectionResizeMode(0, QHeaderView.Stretch) # ResizeToContents) button_open_source = widj_tab1.button_setting("ќткрыть исходный файл", self.open_xml) button_save = widj_tab1.button_setting("—генерировать", self.generate_xml) self.combo = QComboBox(self) self.combo.activated[str].connect(self.comboChange) # main_layout.setColumnStretch(10, 4) # self.only_disc.cb.setChecked(True) main_layout.addWidget(self.table1, 0, 11, 30, 6) main_layout.addWidget(self.table, 0, 0, 30, 10) main_layout.addWidget(button_open_source, 3, 17, 1, 1) main_layout.addWidget(button_save, 9, 17, 1, 1) main_layout.addWidget(self.combo, 15, 17, 1, 1) self.setLayout(main_layout)
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.evklid = widj_tab1.lile_label_name( "evklid", "[Все технологические]\Теплоснабжение\ГП0060 Котельная" ) self.klid = widj_tab1.lile_label_name( "klid", "[ВСЕ]\Теплоснабжение\ГП0060 Котельная" ) button_generat = widj_tab1.button_setting("Сгенерировать", self.gerait) self.table2 = widj_tab1.table_setting(["Register", "Name"]) self.table2.setRowCount(1) self.table2.setSelectionBehavior( QAbstractItemView.SelectItems ) # Выделяет всю строку self.text_panel_view = QTextEdit(objectName="text2") self.text_panel_view.setToolTip( 'Промежуточное значение') self.text_pattern = QTextEdit(objectName="text1") self.text_pattern.setToolTip('Правила вставки') self.text_pattern.setText( """f'''{MARKA}.In := ЭGP0060_BKU_REG_3x{Registrer}.ЗначениеУ; {MARKA}.Invalid := FC_StatusAI(ANY_TO_DINT(Э{Registrer}.ЗначениеУ_q));'''""" ) main_layout.addWidget(self.text_pattern, 17, 0, 10, 2) main_layout.addWidget(self.table2, 0, 0, 17, 1) main_layout.addWidget(self.text_panel_view, 0, 1, 17, 1) main_layout.addWidget(self.evklid, 17, 2, 1, 2) main_layout.addWidget(self.klid, 16, 2, 1, 2) main_layout.addWidget(button_generat, 25, 2, 1, 2) main_layout.addWidget(widj_tab1.line_btn_simple(self), 0, 2, 1, 2) main_layout.addWidget( widj_tab1.button_setting("Очистить", self.table_clean), 17, 2, 1, 2) # self.hide_all() self.setLayout(main_layout)
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)
def initUI(self): main_layout = QGridLayout() self.table = widj_tab1.table_setting(["Кадр", "Группа", "Уровень"]) self.button_add_row = widj_tab1.button_setting("Добавить строку", self.table_add) self.button_del_row = widj_tab1.button_setting("Удалить строку", self.table_del) self.button_upper = widj_tab1.button_setting("Вверх", partial(self.move_to, -1)) self.button_lower = widj_tab1.button_setting("Вниз", partial(self.move_to, 1)) button_to_main = widj_tab1.button_setting("Создать файл импорта", self.generate_menu) button_save = widj_tab1.button_setting("Сохранить шаблон", self.save_xml_el) button_open = widj_tab1.button_setting("Открыть шаблон", self.read_xml_el) header = self.table.horizontalHeader() header.setSectionResizeMode(0, QHeaderView.Stretch) # ResizeToContents) header.setSectionResizeMode(1, QHeaderView.Stretch) header.setSectionResizeMode(2, QHeaderView.Stretch) self.table.setSelectionBehavior( QAbstractItemView.SelectRows) # Выделяет всю строку self.table1 = widj_tab1.table_setting(["Кадр", "Группа", "Уровень"]) self.table1.setRowCount(1) # и одну строку в таблице self.table1.setFixedHeight(50) self.table1.horizontalHeader().hide() self.main_title = [ widj_tab1.line_btn(1, 1, self), widj_tab1.line_btn(1, 2, self), widj_tab1.qbox_line(), widj_tab1.check_box(self, 0) ] self.table1.setRowHeight(0, 50) self.table1.setCellWidget(0, 1, self.main_title[0]) self.table1.setCellWidget(0, 0, self.main_title[1]) self.table1.setCellWidget(0, 2, self.main_title[2]) main_layout.addWidget(self.table, 0, 0, 27, 1) main_layout.addWidget(self.table1, 27, 0, 1, 1) main_layout.addWidget(self.button_add_row, 1, 2, 1, 2) main_layout.addWidget(self.button_del_row, 2, 2, 1, 2) main_layout.addWidget(self.button_upper, 3, 2, 1, 1) main_layout.addWidget(self.button_lower, 3, 3, 1, 1) self.width = widj_tab1.lile_label("Ширина", '274') self.width_screen = widj_tab1.lile_label("Ширина окна", '1920') self.indent = widj_tab1.lile_label("Отступ ", '5') self.check_box_line = widj_tab1.check_box_line("Нижний фрейм") self.check_box_line.cb.stateChanged.connect(self.hideTable) self.edict = widj_tab1.line_botton_switch("Импорт из БД", "Импрортировать") self.edict.btn.clicked.connect(self.create_table1) main_layout.addWidget(self.check_box_line, 4, 2, 1, 2) main_layout.addWidget(self.edict, 5, 2, 1, 2) main_layout.addWidget(self.width_screen, 12, 2, 1, 2) main_layout.addWidget(self.width, 13, 2, 1, 2) main_layout.addWidget(self.indent, 14, 2, 1, 2) main_layout.addWidget(button_to_main, 26, 2, 1, 2) main_layout.addWidget(button_save, 27, 2, 1, 1) main_layout.addWidget(button_open, 27, 3, 1, 1) main_layout.addWidget(widj_tab1.line_btn(2, 1, self), 0, 2, 1, 2) self.hide_all() self.setLayout(main_layout)