Python PySide2.QtWidgets.QTableWidgetItem() Examples
The following are 15
code examples of PySide2.QtWidgets.QTableWidgetItem().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PySide2.QtWidgets
, or try the search function
.
Example #1
Source File: tab_item_view.py From Il2cppSpy with MIT License | 5 votes |
def add_row(self, row: int, item_text: str, item_text_color: QColor = color.TABLE_CODE_TEXT_COLOR, item_background_color=color.TABLE_CODE_BACKGROUND_COLOR, header_text: str = ''): self.table_widget.setRowCount(row + 1) table_header = QTableWidgetItem(header_text) self.table_widget.setVerticalHeaderItem(row, table_header) table_item = QTableWidgetItem(item_text) table_item.setTextColor(item_text_color) table_item.setFlags(table_item.flags() ^ Qt.ItemIsEditable) table_item.setBackgroundColor(item_background_color) self.table_widget.setItem(row, 0, table_item)
Example #2
Source File: configuration.py From node-launcher with MIT License | 5 votes |
def handle_add_action(self): self.table.cellChanged.disconnect() row_index = self.table.rowCount() self.table.insertRow(row_index) identifierItem = QTableWidgetItem() identifierItem.setFlags(editDisabledFlags) self.table.setItem(row_index, 0, identifierItem) self.table.cellChanged.connect(self.handle_cell_change)
Example #3
Source File: UITranslator.py From universal_tool_template.py with MIT License | 5 votes |
def newLang_action(self): if len(self.memoData['fileList'].keys()) == 0: print("You need have UI name structure loaded in order to create a new language.") else: text, ok = QtWidgets.QInputDialog.getText(self, 'New Translation Creation', 'Enter language file name (eg. lang_cn):') if ok: if text in self.memoData['fileList'].keys(): print("This Language already in the table.") else: self.uiList['dict_table'].insertColumn(self.uiList['dict_table'].columnCount()) index = self.uiList['dict_table'].columnCount() - 1 self.uiList['dict_table'].setHorizontalHeaderItem(index, QtWidgets.QTableWidgetItem(text) )
Example #4
Source File: UITranslator.py From universal_tool_template.py with MIT License | 5 votes |
def memory_to_source_ui(self): # update ui once memory gets update txt='\n'.join([row for row in self.memoData['fileList']]) self.uiList['source_txtEdit'].setText(txt) # table table = self.uiList['dict_table'] table.clear() table.setRowCount(0) table.setColumnCount(0) headers = ["UI Name"] table.insertColumn(table.columnCount()) for key in self.memoData['fileList']: headers.append(key) table.insertColumn(table.columnCount()) table.setHorizontalHeaderLabels(headers) ui_name_ok = 0 translate = 1 for file in self.memoData['fileList']: for row, ui_name in enumerate(self.memoData['fileList'][file]): #create ui list if ui_name_ok == 0: ui_item = QtWidgets.QTableWidgetItem(ui_name) table.insertRow(table.rowCount()) table.setItem(row, 0, ui_item) translate_item = QtWidgets.QTableWidgetItem(self.memoData['fileList'][file][ui_name]) table.setItem(row, translate, translate_item) ui_name_ok = 1 translate +=1
Example #5
Source File: qstate_table.py From angr-management with BSD 2-Clause "Simplified" License | 5 votes |
def widgets(self): state = self.state name = state.gui_data.name base_name = state.gui_data.base_name is_changed = 'No' if state.gui_data.is_original else 'Yes' mode = state.mode address = '%#x' % state.addr if isinstance(state.addr, int) else 'Symbolic' state_options = {o for o, v in state.options._options.items() if v is True} options_plus = state_options - angr.sim_options.modes[mode] options_minus = angr.sim_options.modes[mode] - state_options options = ' '.join([' '.join('+' + o for o in options_plus), ' '.join('-' + o for o in options_minus)]) widgets = [ QTableWidgetItem(name), QTableWidgetItem(address), QTableWidgetItem(is_changed), QTableWidgetItem(base_name), QTableWidgetItem(mode), QTableWidgetItem(options), ] if state.gui_data.is_base: color = QColor(0, 0, 0x80) elif state.gui_data.is_original: color = QColor(0, 0x80, 0) else: color = QColor(0, 0, 0) for w in widgets: w.setFlags(w.flags() & ~Qt.ItemIsEditable) w.setForeground(color) return widgets
Example #6
Source File: configuration.py From node-launcher with MIT License | 4 votes |
def update_row(self, key, value, identifier=None, row_index=None): """ Updates a table row by row index or identifier, with key and value. :param key: Key for that row :param value: Value for that row :param identifier: identifier of the row to be updated :param row_index: Index of the row to be updated :return: None """ if identifier is None and row_index is None: return # Disconnecting cellChanged event so we don't get a feedback loop self.table.cellChanged.disconnect() if row_index is not None: for column_index, cell_text in enumerate([identifier, key, value]): item = QTableWidgetItem() item.setText(str(cell_text) if cell_text is not None else '') if column_index != 2: item.setFlags(editDisabledFlags) self.table.setItem(row_index, column_index, item) elif identifier is not None: for row_index in range(self.table.rowCount()): row_identifier = self.table.item(row_index, 0).text() if row_identifier == identifier: key_item = QTableWidgetItem() key_item.setText(key) key_item.setFlags(editDisabledFlags) value_item = QTableWidgetItem() value_item.setText(str(value)) self.table.setItem(row_index, 1, key_item) self.table.setItem(row_index, 2, value_item) break # Connecting the cellChanged event again self.table.cellChanged.connect(self.handle_cell_change) self.table.resizeColumnsToContents()
Example #7
Source File: universal_tool_template_1116.py From universal_tool_template.py with MIT License | 4 votes |
def setupUI(self): super(self.__class__,self).setupUI('grid') #------------------------------ # user ui creation part #------------------------------ # + template: qui version since universal tool template v7 # - no extra variable name, all text based creation and reference self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h') self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h') self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v') self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v') self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form') self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data') self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout') cur_table = self.uiList['my_table'] cur_table.setRowCount(0) cur_table.setColumnCount(1) cur_table.insertColumn(cur_table.columnCount()) cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') # cur_table.insertRow(0) cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item) cur_table.setHorizontalHeaderLabels(('a','b')) ''' self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('input_split | fileBtn_layout', 'main_layout') ''' self.memoData['settingUI']=[] #------------- end ui creation -------------------- keep_margin_layout = ['main_layout'] keep_margin_layout_obj = [] # add tab layouts for each in self.uiList.values(): if isinstance(each, QtWidgets.QTabWidget): for i in range(each.count()): keep_margin_layout_obj.append( each.widget(i).layout() ) for name, each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj: each.setContentsMargins(0, 0, 0, 0) self.quickInfo('Ready') # self.statusBar().hide()
Example #8
Source File: universal_tool_template_1020.py From universal_tool_template.py with MIT License | 4 votes |
def setupUI(self): super(self.__class__,self).setupUI('grid') #------------------------------ # user ui creation part #------------------------------ # + template: qui version since universal tool template v7 # - no extra variable name, all text based creation and reference self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h') self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h') self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v') self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v') self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form') self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data') self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout') cur_table = self.uiList['my_table'] cur_table.setRowCount(0) cur_table.setColumnCount(1) cur_table.insertColumn(cur_table.columnCount()) cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') # cur_table.insertRow(0) cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item) cur_table.setHorizontalHeaderLabels(('a','b')) ''' self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('input_split | fileBtn_layout', 'main_layout') ''' #------------- end ui creation -------------------- keep_margin_layout = ['main_layout'] keep_margin_layout_obj = [] # add tab layouts for each in self.uiList.values(): if isinstance(each, QtWidgets.QTabWidget): for i in range(each.count()): keep_margin_layout_obj.append( each.widget(i).layout() ) for name, each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj: each.setContentsMargins(0, 0, 0, 0) self.quickInfo('Ready') # self.statusBar().hide()
Example #9
Source File: universal_tool_template_2010.py From universal_tool_template.py with MIT License | 4 votes |
def setupUI(self): super(self.__class__,self).setupUI('grid') #------------------------------ # user ui creation part #------------------------------ self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h') self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h') self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v') self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v') self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form') self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox;Personal Data') self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('test_space;5;5;5;3 | testSpace_btn;Test Space', 'testSpace_layout;hbox') self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp | testSpace_layout', 'main_layout') cur_table = self.uiList['my_table'] cur_table.setRowCount(0) cur_table.setColumnCount(1) cur_table.insertColumn(cur_table.columnCount()) cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') # cur_table.insertRow(0) cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item) cur_table.setHorizontalHeaderLabels(('a','b')) ''' self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('input_split | fileBtn_layout', 'main_layout') ''' self.memoData['settingUI']=[] #------------- end ui creation -------------------- keep_margin_layout = ['main_layout'] keep_margin_layout_obj = [] # add tab layouts for each in self.uiList.values(): if isinstance(each, QtWidgets.QTabWidget): for i in range(each.count()): keep_margin_layout_obj.append( each.widget(i).layout() ) for name, each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj: each.setContentsMargins(0, 0, 0, 0) self.quickInfo('Ready') # self.statusBar().hide()
Example #10
Source File: GearBox_template_1010.py From universal_tool_template.py with MIT License | 4 votes |
def setupUI(self): super(self.__class__,self).setupUI('grid') #------------------------------ # user ui creation part #------------------------------ # + template: qui version since universal tool template v7 # - no extra variable name, all text based creation and reference self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h') self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h') self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v') self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v') self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form') self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data') self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout') cur_table = self.uiList['my_table'] cur_table.setRowCount(0) cur_table.setColumnCount(1) cur_table.insertColumn(cur_table.columnCount()) cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') # cur_table.insertRow(0) cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item) cur_table.setHorizontalHeaderLabels(('a','b')) ''' self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('input_split | fileBtn_layout', 'main_layout') ''' #------------- end ui creation -------------------- keep_margin_layout = ['main_layout'] keep_margin_layout_obj = [] # add tab layouts for each in self.uiList.values(): if isinstance(each, QtWidgets.QTabWidget): for i in range(each.count()): keep_margin_layout_obj.append( each.widget(i).layout() ) for name, each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj: each.setContentsMargins(0, 0, 0, 0) self.quickInfo('Ready') # self.statusBar().hide()
Example #11
Source File: universal_tool_template_1115.py From universal_tool_template.py with MIT License | 4 votes |
def setupUI(self): super(self.__class__,self).setupUI('grid') #------------------------------ # user ui creation part #------------------------------ # + template: qui version since universal tool template v7 # - no extra variable name, all text based creation and reference self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h') self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h') self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v') self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v') self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form') self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data') self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout') cur_table = self.uiList['my_table'] cur_table.setRowCount(0) cur_table.setColumnCount(1) cur_table.insertColumn(cur_table.columnCount()) cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') # cur_table.insertRow(0) cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item) cur_table.setHorizontalHeaderLabels(('a','b')) ''' self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('input_split | fileBtn_layout', 'main_layout') ''' #------------- end ui creation -------------------- keep_margin_layout = ['main_layout'] keep_margin_layout_obj = [] # add tab layouts for each in self.uiList.values(): if isinstance(each, QtWidgets.QTabWidget): for i in range(each.count()): keep_margin_layout_obj.append( each.widget(i).layout() ) for name, each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj: each.setContentsMargins(0, 0, 0, 0) self.quickInfo('Ready') # self.statusBar().hide()
Example #12
Source File: universal_tool_template_1112.py From universal_tool_template.py with MIT License | 4 votes |
def setupUI(self): super(self.__class__,self).setupUI('grid') #------------------------------ # user ui creation part #------------------------------ # + template: qui version since universal tool template v7 # - no extra variable name, all text based creation and reference self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h') self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h') self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v') self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v') self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form') self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data') self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout') cur_table = self.uiList['my_table'] cur_table.setRowCount(0) cur_table.setColumnCount(1) cur_table.insertColumn(cur_table.columnCount()) cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') # cur_table.insertRow(0) cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item) cur_table.setHorizontalHeaderLabels(('a','b')) ''' self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('input_split | fileBtn_layout', 'main_layout') ''' #------------- end ui creation -------------------- keep_margin_layout = ['main_layout'] keep_margin_layout_obj = [] # add tab layouts for each in self.uiList.values(): if isinstance(each, QtWidgets.QTabWidget): for i in range(each.count()): keep_margin_layout_obj.append( each.widget(i).layout() ) for name, each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj: each.setContentsMargins(0, 0, 0, 0) self.quickInfo('Ready') # self.statusBar().hide()
Example #13
Source File: universal_tool_template_1100.py From universal_tool_template.py with MIT License | 4 votes |
def setupUI(self): super(self.__class__,self).setupUI('grid') #------------------------------ # user ui creation part #------------------------------ # + template: qui version since universal tool template v7 # - no extra variable name, all text based creation and reference self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h') self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h') self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v') self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v') self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form') self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data') self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout') cur_table = self.uiList['my_table'] cur_table.setRowCount(0) cur_table.setColumnCount(1) cur_table.insertColumn(cur_table.columnCount()) cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') # cur_table.insertRow(0) cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item) cur_table.setHorizontalHeaderLabels(('a','b')) ''' self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('input_split | fileBtn_layout', 'main_layout') ''' #------------- end ui creation -------------------- keep_margin_layout = ['main_layout'] keep_margin_layout_obj = [] # add tab layouts for each in self.uiList.values(): if isinstance(each, QtWidgets.QTabWidget): for i in range(each.count()): keep_margin_layout_obj.append( each.widget(i).layout() ) for name, each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj: each.setContentsMargins(0, 0, 0, 0) self.quickInfo('Ready') # self.statusBar().hide()
Example #14
Source File: universal_tool_template_1110.py From universal_tool_template.py with MIT License | 4 votes |
def setupUI(self): super(self.__class__,self).setupUI('grid') #------------------------------ # user ui creation part #------------------------------ # + template: qui version since universal tool template v7 # - no extra variable name, all text based creation and reference self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h') self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h') self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v') self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v') self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form') self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data') self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout') cur_table = self.uiList['my_table'] cur_table.setRowCount(0) cur_table.setColumnCount(1) cur_table.insertColumn(cur_table.columnCount()) cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') # cur_table.insertRow(0) cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item) cur_table.setHorizontalHeaderLabels(('a','b')) ''' self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('input_split | fileBtn_layout', 'main_layout') ''' #------------- end ui creation -------------------- keep_margin_layout = ['main_layout'] keep_margin_layout_obj = [] # add tab layouts for each in self.uiList.values(): if isinstance(each, QtWidgets.QTabWidget): for i in range(each.count()): keep_margin_layout_obj.append( each.widget(i).layout() ) for name, each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj: each.setContentsMargins(0, 0, 0, 0) self.quickInfo('Ready') # self.statusBar().hide()
Example #15
Source File: universal_tool_template_1010.py From universal_tool_template.py with MIT License | 4 votes |
def setupUI(self): super(self.__class__,self).setupUI('grid') #------------------------------ # user ui creation part #------------------------------ # + template: qui version since universal tool template v7 # - no extra variable name, all text based creation and reference self.qui('box_btn;Box | sphere_btn;Sphere | ring_btn;Ring', 'my_layout;grid', 'h') self.qui('box2_btn;Box2 | sphere2_btn;Sphere2 | ring2_btn;Ring2', 'my_layout', 'h') self.qui('cat_btn;Cat | dog_btn;Dog | pig_btn;Pig', 'pet_layout;grid', 'v') self.qui('cat2_btn;Cat2 | dog2_btn;Dog2 | pig2_btn;Pig2', 'pet_layout', 'v') self.qui('name_input@Name:;John | email_input@Email:;test@test.com', 'entry_form') self.qui('user2_btn;User2 | info2_btn;Info2', 'my_grp;vbox,Personal Data') self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('my_layout | my_table | input_split | entry_form | fileBtn_layout | pet_layout | my_grp', 'main_layout') cur_table = self.uiList['my_table'] cur_table.setRowCount(0) cur_table.setColumnCount(1) cur_table.insertColumn(cur_table.columnCount()) cur_item = QtWidgets.QTableWidgetItem('ok') #QtWidgets.QPushButton('Cool') # cur_table.insertRow(0) cur_table.setItem(0,1, cur_item) #setCellWidget(0,0,cur_item) cur_table.setHorizontalHeaderLabels(('a','b')) ''' self.qui('source_txt | process_btn;Process and Update', 'upper_vbox') self.qui('upper_vbox | result_txt', 'input_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('input_split | fileBtn_layout', 'main_layout') ''' #------------- end ui creation -------------------- keep_margin_layout = ['main_layout'] keep_margin_layout_obj = [] # add tab layouts for each in self.uiList.values(): if isinstance(each, QtWidgets.QTabWidget): for i in range(each.count()): keep_margin_layout_obj.append( each.widget(i).layout() ) for name, each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name not in keep_margin_layout and not name.endswith('_grp_layout') and each not in keep_margin_layout_obj: each.setContentsMargins(0, 0, 0, 0) self.quickInfo('Ready') # self.statusBar().hide()