Python PySide.QtGui.QTableWidgetItem() Examples

The following are 24 code examples of PySide.QtGui.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 PySide.QtGui , or try the search function .
Example #1
Source File: app.py    From shortcircuit with MIT License 6 votes vote down vote up
def add_data_to_table(self, route):
        self.tableWidget_path.setRowCount(len(route))
        for i, row in enumerate(route):
            for j, col in enumerate(row):
                item = QtGui.QTableWidgetItem("{}".format(col))
                self.tableWidget_path.setItem(i, j, item)

                if j in [1, 2]:
                    self.tableWidget_path.item(i, j).setTextAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)

                if row[1] == "HS":
                    color = QtGui.QColor(223, 240, 216)
                elif row[1] == "LS":
                    color = QtGui.QColor(252, 248, 227)
                elif row[1] == "NS":
                    color = QtGui.QColor(242, 222, 222)
                else:
                    color = QtGui.QColor(210, 226, 242)

                if j == 3 and "wormhole" in col:
                    self.tableWidget_path.item(i, j).setIcon(self.icon_wormhole)
                self.tableWidget_path.item(i, j).setBackground(color)
                self.tableWidget_path.item(i, j).setForeground(QtGui.QColor(0, 0, 0)) 
Example #2
Source File: dataxrefcounter.py    From idapyscripts with MIT License 5 votes vote down vote up
def OnScan(self):
        self.tableWidget.setRowCount(0)
        self.export_btn.setDisabled(True)
        self.filter_btn.setDisabled(True)
        self.scan_btn.setDisabled(True)
        self.scan_btn.setText("Scanning...")
        self.parent.repaint()
        seg = int(self.seg_combo.itemText(self.seg_combo.currentIndex()).split(' ')[0], 16)
        min_refs = int(self.refcount_box.text())
        refs = dxc_scan_refs(seg, min_refs)
        self.tableWidget.setRowCount(len(refs))

        for i, row in enumerate(refs):
            addr_item = QtGui.QTableWidgetItem()
            addr_item.setData(QtCore.Qt.EditRole, row[0])
            addr_item.setData(QtCore.Qt.DisplayRole, str(hex(row[0])))
            count_item = QtGui.QTableWidgetItem()
            count_item.setData(QtCore.Qt.EditRole, row[1])
            count_item.setData(QtCore.Qt.DisplayRole, str(row[1]))
            self.tableWidget.setItem(i, 0, addr_item)
            self.tableWidget.setItem(i, 1, count_item)

        self.scan_btn.setText("Scan")
        self.scan_btn.setDisabled(False)
        self.filter_btn.setDisabled(False)
        self.export_btn.setDisabled(False) 
Example #3
Source File: ui.py    From CSGO-Market-Float-Finder with MIT License 5 votes vote down vote up
def __lt__(self, other):
        if isinstance(other, QCustomTableWidgetItem):
            try:
                selfDataValue = float(self.data(QtCore.Qt.EditRole))
                otherDataValue = float(other.data(QtCore.Qt.EditRole))
                return selfDataValue < otherDataValue
            except ValueError:
                # Can not be converted to float, so probably does not need to be (str, unicode)
                selfDataValue = self.data(QtCore.Qt.EditRole)
                otherDataValue = other.data(QtCore.Qt.EditRole)
                return selfDataValue < otherDataValue
        else:
            return QtGui.QTableWidgetItem.__lt__(self, other) 
Example #4
Source File: gui.py    From autopilot with Mozilla Public License 2.0 5 votes vote down vote up
def init_ui(self):
        """
        Initialized graphical elements. Literally just filling a table.
        """
        # set shape (rows by cols
        self.shape = (len(self.mice_weights), len(self.colnames.keys()))
        self.setRowCount(self.shape[0])
        self.setColumnCount(self.shape[1])


        for row in range(self.shape[0]):
            for j, col in enumerate(self.colnames.keys()):
                try:
                    if col == "date":
                        format_date = datetime.datetime.strptime(self.mice_weights[row][col], '%y%m%d-%H%M%S')
                        format_date = format_date.strftime('%b %d')
                        item = QtGui.QTableWidgetItem(format_date)
                    elif col == "stop":
                        stop_wt = str(self.mice_weights[row][col])
                        minimum = float(self.mice_weights[row]['minimum_mass'])
                        item = QtGui.QTableWidgetItem(stop_wt)
                        if float(stop_wt) < minimum:
                            item.setBackground(QtGui.QColor(255,0,0))

                    else:
                        item = QtGui.QTableWidgetItem(str(self.mice_weights[row][col]))
                except:
                    item = QtGui.QTableWidgetItem(str(self.mice_weights[row][col]))
                self.setItem(row, j, item)

        # make headers
        self.setHorizontalHeaderLabels(self.colnames.values())
        self.resizeColumnsToContents()
        self.updateGeometry()
        self.adjustSize()
        self.sortItems(0) 
Example #5
Source File: CanvasRbfEditor.py    From Fabric-RBF with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def addButton_onClicked(self):
        if(len(self.poseName.text()) > 0):
            rowPosition = self.table.rowCount()       
            self.table.insertRow(rowPosition)
            self.table.setVerticalHeaderItem(rowPosition, QtGui.QTableWidgetItem(self.poseName.text()))
            self.poseName.setText('')
            self.table.setItem(rowPosition , 0, self.floatAsItem(0.5))
            self._updateWidgetSize()

        
    # Delete selected row 
Example #6
Source File: CanvasRbfEditor.py    From Fabric-RBF with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def floatAsItem(self, value):
        item = QTableWidgetItem()
        item.setData(Qt.EditRole, value)
        return item

    
    #Change commmand string when combo box changes 
Example #7
Source File: UITranslator_v1.0.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
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 = QtGui.QTableWidgetItem(ui_name)
                    table.insertRow(table.rowCount())
                    table.setItem(row, 0, ui_item)
                translate_item = QtGui.QTableWidgetItem(self.memoData['fileList'][file][ui_name])
                table.setItem(row, translate, translate_item)
            ui_name_ok = 1
            translate +=1 
Example #8
Source File: UITranslator_v1.0.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def changeTableHeader(self, index):
        table = self.uiList["dict_table"]
        oldHeader = str(table.horizontalHeaderItem(index).text())
        text, ok = QtGui.QInputDialog.getText(self, 'Change header label for column %d' % index,'Header:',QtGui.QLineEdit.Normal, oldHeader)
        if ok:
            if text in self.memoData['fileList'].keys():
                print("This Language already in the table.")
            else:
                table.setHorizontalHeaderItem(index, QtGui.QTableWidgetItem(text) )
    
    #~~~~~~~~~~~~~~
    # default ui function 
Example #9
Source File: UITranslator.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
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 #10
Source File: UITranslator.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
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 #11
Source File: vfpfunc.py    From vfp2py with MIT License 5 votes vote down vote up
def refresh(self):
            table = DB._get_table_info(self._source).table
            labels = table.field_names
            self.setColumnCount(len(labels))
            self.setRowCount(len(table))
            self.setVerticalHeaderLabels(['>' if record is table.current_record else '  ' for record in table])
            self.setHorizontalHeaderLabels(labels)

            for i, record in enumerate(table):
                for j, val in enumerate(record):
                    self.setItem(i, j, QtGui.QTableWidgetItem(_str(val))) 
Example #12
Source File: QtShim.py    From grap with MIT License 5 votes vote down vote up
def get_QTableWidgetItem():
    """QTableWidgetItem getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QTableWidgetItem
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QTableWidgetItem 
Example #13
Source File: QtShim.py    From grap with MIT License 5 votes vote down vote up
def get_QTableWidgetItem():
    """QTableWidgetItem getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QTableWidgetItem
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QTableWidgetItem 
Example #14
Source File: GearBox_template_1010.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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_2010.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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 #16
Source File: universal_tool_template_1115.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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 #17
Source File: universal_tool_template_1112.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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 #18
Source File: universal_tool_template_1100.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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 #19
Source File: universal_tool_template_1110.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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 #20
Source File: universal_tool_template_1020.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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 #21
Source File: universal_tool_template_1116.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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 #22
Source File: universal_tool_template_1000.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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 #23
Source File: universal_tool_template_1010.py    From universal_tool_template.py with MIT License 4 votes vote down vote up
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 #24
Source File: dataxrefcounter.py    From idapyscripts with MIT License 4 votes vote down vote up
def PopulateForm(self):
        vboxLayout = QtGui.QVBoxLayout()

        self.tableWidget.setRowCount(1)
        self.tableWidget.setColumnCount(2)
        self.tableWidget.setHorizontalHeaderItem(0, QtGui.QTableWidgetItem("Address"))
        self.tableWidget.setHorizontalHeaderItem(1, QtGui.QTableWidgetItem("Reference Count"))

        gridLayout = QtGui.QGridLayout()

        self.seg_combo.addItems(dxc_get_segments())
        self.seg_combo.setMaximumWidth(100)
        self.seg_combo.setFixedWidth(100)

        gridLayout.addWidget(QtGui.QLabel("Segment start:"), 0, 0)
        gridLayout.addWidget(self.seg_combo, 0, 1)

        gridLayout.addWidget(QtGui.QLabel("Minimum ref count:"), 1, 0)

        self.refcount_box.setMaximumWidth(100)
        self.refcount_box.setFixedWidth(100)
        self.refcount_box.setText("50")

        self.minfilter_box.setMaximumWidth(100)
        self.minfilter_box.setFixedWidth(100)
        self.maxfilter_box.setMaximumWidth(100)
        self.maxfilter_box.setFixedWidth(100)
        self.minfilter_box.setText("0")
        self.maxfilter_box.setText("100000")

        gridLayout.addWidget(self.export_btn, 0, 2)
        gridLayout.addWidget(self.refcount_box, 1, 1)
        gridLayout.addWidget(self.scan_btn, 1, 2)
        gridLayout.addWidget(self.minfilter_box, 2, 0)
        gridLayout.addWidget(self.maxfilter_box, 2, 1)
        gridLayout.addWidget(self.filter_btn, 2, 2)
        gridLayout.addWidget(self.tableWidget, 3, 0, 1, 5)

        self.export_btn.clicked.connect(self.OnExport)
        self.scan_btn.clicked.connect(self.OnScan)
        self.filter_btn.clicked.connect(self.OnFilter)
        self.tableWidget.cellDoubleClicked.connect(self.OnJump)
        self.tableWidget.horizontalHeader().sectionClicked.connect(self.OnSectionClicked)

        gridLayout.setColumnStretch(4, 1)
        vboxLayout.addLayout(gridLayout)

        self.parent.setLayout(vboxLayout)