Python PySide.QtGui.QListWidgetItem() Examples

The following are 13 code examples of PySide.QtGui.QListWidgetItem(). 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: casc_plugin.py    From CASC with GNU General Public License v2.0 9 votes vote down vote up
def signature_selected(self, item):
        self.subsignatures_list.clear()

        for ea, color in self.previous_colors:
            idc.SetColor(ea, idc.CIC_ITEM, color)
        self.previous_colors = []
        self.match_label.setText("")

        if item.parsed_signature is None:
            pass
        else:
            if isinstance(item.parsed_signature, LdbSignature):
                for i, subsig in enumerate(item.parsed_signature.subsignatures):
                    item2 = QtWidgets.QListWidgetItem("% 2d   %s:%s" % (i, str(subsig.offset), subsig.clamav_signature))
                    item2.subsignature_name = "$subsig_%02x" % i
                    self.subsignatures_list.addItem(item2)
            elif isinstance(item.parsed_signature, NdbSignature):
                self.match_label.setText("No match")

            print_console("Signature selected: %s" % item.text())
            self.yara_scanner.scan(item.yara_rule) 
Example #2
Source File: gui.py    From autopilot with Mozilla Public License 2.0 6 votes vote down vote up
def add_step(self):
        """
        Loads `PARAMS` from task object, adds base parameters to :py:attr:`.steps` list
        """
        task_type = self.task_list.currentItem().text()
        new_item = QtGui.QListWidgetItem()
        new_item.setText(task_type)
        task_params = copy.deepcopy(tasks.TASK_LIST[task_type].PARAMS)

        # Add params that are non-task specific
        # Name of task type
        task_params['task_type'] = {'type':'label','value':task_type}
        # Prepend name of step shittily
        task_params_temp = odict()
        task_params_temp['step_name'] = {'type':'str', 'tag':'Step Name', 'value':task_type}
        task_params_temp.update(task_params)
        task_params.clear()
        task_params.update(task_params_temp)
        # add graduation field
        task_params['graduation'] = {'type':'graduation', 'tag':'Graduation Criterion', 'value':{}}

        self.steps.append(task_params)
        self.step_list.addItem(new_item)
        self.step_list.setCurrentItem(new_item) 
Example #3
Source File: app.py    From shortcircuit with MIT License 5 votes vote down vote up
def _avoid_system_name(self, sys_name):
        if sys_name:
            if sys_name not in self.avoidance_list():
                QtGui.QListWidgetItem(sys_name, self.listWidget_avoid)
                self._avoid_message("Added", MainWindow.MSG_OK)
            else:
                self._avoid_message("Already in list!", MainWindow.MSG_ERROR)
        else:
            self._avoid_message("Invalid system name :(", MainWindow.MSG_ERROR) 
Example #4
Source File: IDASynergy.py    From IDASynergy with MIT License 5 votes vote down vote up
def set_controls(self, updated_files):
            for to_update in updated_files:
                item = QListWidgetItem('[%s] %s' % to_update)
                item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
                #if to_update[0] == "U":
                #    item.setCheckState(Qt.Unchecked)
                #else:
                item.setCheckState(Qt.Checked)
                self.ui.listFiles.addItem(item) 
Example #5
Source File: vfpfunc.py    From vfp2py with MIT License 5 votes vote down vote up
def rowsource(self, source):
            self._source = source
            table = DB._get_table_info(source).table
            for record in table:
                self.addItem(QtGui.QListWidgetItem(_str(record[0]))) 
Example #6
Source File: placeDatumCmd.py    From FreeCAD_Assembly4 with GNU Lesser General Public License v2.1 5 votes vote down vote up
def onParentSelected(self):
        # clear the selection in the GUI window
        Gui.Selection.clearSelection()
        # build the LCS table
        self.attLCStable = []
        # the current text in the combo-box is the link's name...
        if self.parentList.currentIndex() > 0:
            parentName = self.parentTable[ self.parentList.currentIndex() ].Name
            parentPart = self.activeDoc.getObject( parentName )
            if parentPart:
                # we get the LCS from the linked part
                self.attLCStable = Asm4.getPartLCS( parentPart.LinkedObject )
                # linked part & doc
                dText = parentPart.LinkedObject.Document.Name +'#'
                # if the linked part has been renamed by the user
                pText = Asm4.nameLabel( parentPart.LinkedObject )
                self.parentDoc.setText( dText + pText )
                # highlight the selected part:
                Gui.Selection.addSelection( parentPart.Document.Name, 'Model', parentPart.Name+'.' )
        # something wrong
        else:
            return
        
        # build the list
        self.attLCSlist.clear()
        for lcs in self.attLCStable:
            newItem = QtGui.QListWidgetItem()
            newItem.setText(Asm4.nameLabel(lcs))
            newItem.setIcon( lcs.ViewObject.Icon )
            self.attLCSlist.addItem( newItem )
            #self.attLCStable.append(lcs)
        return



    # A target Datum has been clicked in the list 
Example #7
Source File: degreesOfFreedomAnimation.py    From FreeCAD_assembly2 with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self, constraintSystem):
        self.constraintSystem = constraintSystem
        self.form = FreeCADGui.PySideUic.loadUi( ':/assembly2/ui/degreesOfFreedomAnimation.ui' )
        self.form.setWindowIcon(QtGui.QIcon( ':/assembly2/icons/degreesOfFreedomAnimation.svg' ) )
        self.form.groupBox_DOF.setTitle('%i Degrees-of-freedom:' % len(constraintSystem.degreesOfFreedom))
        for i, d in enumerate(constraintSystem.degreesOfFreedom):
            item = QtGui.QListWidgetItem('%i. %s' % (i+1, str(d)[1:-1].replace('DegreeOfFreedom ','')), self.form.listWidget_DOF)
            if i == 0: item.setSelected(True)
        self.form.pushButton_animateSelected.clicked.connect(self.animateSelected)
        self.form.pushButton_animateAll.clicked.connect(self.animateAll)
        self.form.pushButton_set_as_default.clicked.connect( self.setDefaults )
        self.setIntialValues() 
Example #8
Source File: onionSkinRendererWindow.py    From onionSkinRenderer with MIT License 5 votes vote down vote up
def refreshObjectList(self):
        self.onionObjects_list.clear()
        for obj in self.mOnionObjectSet:
            listWidget = OnionListObject()
            listWidget.object_label.setText(obj.nodeName())
            listWidget.object_remove_btn.clicked.connect(lambda b_obj = obj: self.removeOnionObject(b_obj))
            listItem = QtGui.QListWidgetItem()
            listItem.setSizeHint(listWidget.sizeHint())
            self.onionObjects_list.addItem(listItem)
            self.onionObjects_list.setItemWidget(listItem, listWidget)

    # 
Example #9
Source File: onionSkinRendererWindow.py    From onionSkinRenderer with MIT License 5 votes vote down vote up
def refreshAbsoluteList(self):
        # remove any entries that don't exist anymore
        framesInList = []
        for i in reversed(xrange(self.absolute_list.count())):
            frame = self.absolute_list.item(i).data(QtCore.Qt.UserRole)
            framesInList.append(frame)
            if frame not in self.mAbsoluteOnionSet:
                self.absolute_list.takeItem(i)
        
        # add any missing entry
        for frame in self.mAbsoluteOnionSet:
            if frame not in framesInList:
                listWidget = OnionListFrame()
                listWidget.frame_number.setText(str(int(frame)))
                listWidget.frame_opacity_slider.setValue(onionCore.viewRenderOverrideInstance.getAbsoluteOpacity(int(frame)))
                listWidget.addRemoveButton()
                listWidget.frame_visibility_btn.setChecked(onionCore.viewRenderOverrideInstance.absoluteOnionExists(int(frame)))
                listWidget.frame_remove_btn.clicked.connect(lambda b_frame = frame: self.removeAbsoluteFrame(b_frame))
                listWidget.frame_visibility_btn.clicked.connect(self.toggleAbsoluteFrame)
                listWidget.frame_opacity_slider.sliderMoved.connect(self.setAbsoluteOpacity)
                listItem = QtGui.QListWidgetItem()
                listItem.setData(QtCore.Qt.UserRole, int(frame))
                listItem.setSizeHint(listWidget.sizeHint())
                # insert item at correct position
                correctRow = 0
                for i in xrange(self.absolute_list.count()):
                    if frame < self.absolute_list.item(i).data(QtCore.Qt.UserRole):
                        break
                    correctRow = i+1
                
                self.absolute_list.insertItem(correctRow, listItem)
                self.absolute_list.setItemWidget(listItem, listWidget)




    # ---------------------------
    # CONNECTIONS

    # 
Example #10
Source File: casc_plugin.py    From CASC with GNU General Public License v2.0 5 votes vote down vote up
def _add_signature(self, sig):
        signature = parse_signature(sig)
        if signature is None:
            idaapi.warning("Error parsing signature")
            return False
        signature.target_type = 0 #Don't check for PE header
        item = QtWidgets.QListWidgetItem(sig)
        item.parsed_signature = signature
        item.yara_rule = self.yara_scanner.compile(self.yara_scanner.convert(signature))
        if isinstance(signature, LdbSignature):
            pass
        self.signatures_list.addItem(item)
        return True 
Example #11
Source File: FastenersLib.py    From FreeCAD_Assembly4 with GNU Lesser General Public License v2.1 4 votes vote down vote up
def onParentList(self):
        # clear the LCS list
        self.attLCSlist.clear()
        self.attLCStable = []
        # clear the selection in the GUI window
        Gui.Selection.clearSelection()
        # keep the fastener selected
        Gui.Selection.addSelection( self.activeDoc.Name, 'Model', self.selectedFastener.Name+'.')
        # the current text in the combo-box is the link's name...
        # ... or it's 'Parent Assembly' then the parent is the 'Model' root App::Part		
        if self.parentList.currentText() == 'Parent Assembly':
            parentName = 'Parent Assembly'
            parentPart = self.activeDoc.getObject( 'Model' )
            # we get the LCS directly in the root App::Part 'Model'
            self.attLCStable = Asm4.getPartLCS( parentPart )
            self.parentDoc.setText( parentPart.Document.Name+'#'+Asm4.nameLabel(parentPart) )
        # if something is selected
        elif self.parentList.currentIndex() > 1:
            parentName = self.parentTable[ self.parentList.currentIndex() ].Name
            parentPart = self.activeDoc.getObject( parentName )
            if parentPart:
                # we get the LCS from the linked part
                self.attLCStable = Asm4.getPartLCS( parentPart.LinkedObject )
                # linked part & doc
                dText = parentPart.LinkedObject.Document.Name +'#'
                # if the linked part has been renamed by the user
                pText = Asm4.nameLabel( parentPart.LinkedObject )
                self.parentDoc.setText( dText + pText )
                # highlight the selected part:
                Gui.Selection.addSelection( parentPart.Document.Name, 'Model', parentPart.Name+'.' )
        # something wrong
        else:
            return
        
        # build the list
        self.attLCSlist.clear()
        for lcs in self.attLCStable:
            newItem = QtGui.QListWidgetItem()
            newItem.setText(Asm4.nameLabel(lcs))
            newItem.setIcon( lcs.ViewObject.Icon )
            self.attLCSlist.addItem( newItem )
            #self.attLCStable.append(lcs)
        return


    # An LCS has been clicked in 1 of the 2 lists, we highlight both LCS            | 
Example #12
Source File: placeLinkCmd.py    From FreeCAD_Assembly4 with GNU Lesser General Public License v2.1 4 votes vote down vote up
def onParentSelected(self):
        # clear the selection in the GUI window
        Gui.Selection.clearSelection()
        # build the LCS table
        self.attLCStable = []
        # the current text in the combo-box is the link's name...
        # ... or it's 'Parent Assembly' then the parent is the 'Model' root App::Part
        if self.parentList.currentText() == 'Parent Assembly':
            parentName = 'Parent Assembly'
            parentPart = self.parentAssembly
            # we get the LCS directly in the root App::Part 'Model'
            self.attLCStable = Asm4.getPartLCS( parentPart )
            self.parentDoc.setText( parentPart.Document.Name+'#'+Asm4.nameLabel(parentPart) )
        # if something is selected
        elif self.parentList.currentIndex() > 1:
            parentName = self.parentTable[ self.parentList.currentIndex() ].Name
            parentPart = self.activeDoc.getObject( parentName )
            if parentPart:
                # we get the LCS from the linked part
                self.attLCStable = Asm4.getPartLCS( parentPart.LinkedObject )
                # linked part & doc
                dText = parentPart.LinkedObject.Document.Name +'#'
                # if the linked part has been renamed by the user
                pText = Asm4.nameLabel( parentPart.LinkedObject )
                self.parentDoc.setText( dText + pText )
                # highlight the selected part:
                Gui.Selection.addSelection( parentPart.Document.Name, 'Model', parentPart.Name+'.' )
        # something wrong
        else:
            return

        # build the list
        self.attLCSlist.clear()
        for lcs in self.attLCStable:
            newItem = QtGui.QListWidgetItem()
            newItem.setText(Asm4.nameLabel(lcs))
            newItem.setIcon( lcs.ViewObject.Icon )
            self.attLCSlist.addItem( newItem )
            #self.attLCStable.append(lcs)
        return




    # Rotations 
Example #13
Source File: casc_plugin.py    From CASC with GNU General Public License v2.0 4 votes vote down vote up
def PopulateWidget(self):
        signatures_widget = QtWidgets.QFrame()
        layout = QtWidgets.QVBoxLayout()

        layout.addWidget(QtWidgets.QLabel('Signatures'))
        self.signatures_list = QtWidgets.QListWidget()
        layout.addWidget(self.signatures_list)
        signatures_widget.setLayout(layout)

        container2 = QtWidgets.QGridLayout()
        container2.addWidget(signatures_widget, 0, 0)

        subsignatures_widget = QtWidgets.QFrame()
        layout = QtWidgets.QVBoxLayout()
        self.subsignatures_list = QtWidgets.QListWidget()
        layout.addWidget(QtWidgets.QLabel("LDB subsignatures"))
        layout.addWidget(self.subsignatures_list)
        subsignatures_widget.setLayout(layout)
        container2.addWidget(subsignatures_widget, 0, 1)
        #subsignatures_widget.hide()

        container3 = QtWidgets.QVBoxLayout()
        container3.addLayout(container2)
        self.match_label = QtWidgets.QLabel()
        container3.addWidget(self.match_label)
        self.signature_line_edit = QtWidgets.QLineEdit()
        container3.addWidget(self.signature_line_edit)
        container4 = QtWidgets.QHBoxLayout()
        container3.addLayout(container4)
        add_signature_button = QtWidgets.QPushButton("Add signature")
        remove_signature_button = QtWidgets.QPushButton("Remove signature")
        container4.addWidget(add_signature_button)
        container4.addWidget(remove_signature_button)

        self.signature_line_edit.returnPressed.connect(self.add_signature)
        add_signature_button.clicked.connect(self.add_signature)
        remove_signature_button.clicked.connect(self.remove_signature)
        self.signatures_list.itemActivated.connect(self.signature_selected)
        self.subsignatures_list.itemActivated.connect(self.subsignature_selected)

        item = QtWidgets.QListWidgetItem("Clear selection")
        item.parsed_signature = None
        self.signatures_list.addItem(item)

        self.setLayout(container3)