Python PyQt5.QtWidgets.QListWidgetItem() Examples

The following are 30 code examples of PyQt5.QtWidgets.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 PyQt5.QtWidgets , or try the search function .
Example #1
Source File: Archive.py    From Traffic-Rules-Violation-Detection with GNU General Public License v3.0 20 votes vote down vote up
def __init__(self, parent=None):
        super(ArchiveWindow, self).__init__(parent)
        loadUi('UI/Archive.ui', self)

        self.cancel.clicked.connect(self.close)

        self.log_tabwidget.clear()
        self.violation_list = QListWidget(self)
        self.log_tabwidget.addTab(self.violation_list, "Violations")
        self.violation_list.clear()
        rows = Database.get_instance().get_violations_from_cam(None, cleared=True)
        for row in rows:
            listWidget = ViolationItem()
            listWidget.setData(row)
            listWidgetItem = QtWidgets.QListWidgetItem(self.violation_list)
            listWidgetItem.setSizeHint(listWidget.sizeHint())
            self.violation_list.addItem(listWidgetItem)
            self.violation_list.setItemWidget(listWidgetItem, listWidget) 
Example #2
Source File: ddt4all.py    From ddt4all with GNU General Public License v3.0 16 votes vote down vote up
def scan_project(self, project):
        if project == "ALL":
            self.scan()
            return
        self.ecu_scan.clear()
        self.ecu_scan.scan(self.progressstatus, self.infostatus, project)
        self.ecu_scan.scan_kwp(self.progressstatus, self.infostatus, project)

        for ecu in self.ecu_scan.ecus.keys():
            self.ecunamemap[ecu] = self.ecu_scan.ecus[ecu].name
            item = widgets.QListWidgetItem(ecu)
            if '.xml' in self.ecu_scan.ecus[ecu].href.lower():
                item.setForeground(core.Qt.yellow)
            else:
                item.setForeground(core.Qt.green)
            self.treeview_ecu.addItem(item)

        for ecu in self.ecu_scan.approximate_ecus.keys():
            self.ecunamemap[ecu] = self.ecu_scan.approximate_ecus[ecu].name
            item = widgets.QListWidgetItem(ecu)
            item.setForeground(core.Qt.red)
            self.treeview_ecu.addItem(item) 
Example #3
Source File: Project.py    From Python-GUI with MIT License 11 votes vote down vote up
def boxclose(self):
        teamname = self.open_screen.OpenTheTeam.text()
        myteam= sqlite3.connect('TEAM.db')
        curser= myteam.cursor()
        curser.execute("SELECT PLAYERS from team WHERE NAMES= '"+teamname+"';")
        hu= curser.fetchall()
        self.listWidget.clear()
        for i in range(len(hu)):
            item= QtWidgets.QListWidgetItem(hu[i][0])
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            item.setFont(font)
            item.setBackground(QtGui.QColor('sea green'))
            self.listWidget.addItem(item)
            
        self.openDialog.close() 
Example #4
Source File: ddt4all.py    From ddt4all with GNU General Public License v3.0 10 votes vote down vote up
def rescan_ports(self):
        ports = elm.get_available_ports()
        if ports == None:
            self.listview.clear()
            self.ports = {}
            self.portcount = 0
            return

        if len(ports) == self.portcount:
            return

        self.listview.clear()
        self.ports = {}
        self.portcount = len(ports)
        for p in ports:
            item = widgets.QListWidgetItem(self.listview)
            itemname = p[0] + "[" + p[1] + "]"
            item.setText(itemname)
            self.ports[itemname] = (p[0], p[1])

        self.timer.start(1000) 
Example #5
Source File: breathing_phrase_list_wt.py    From mindfulness-at-the-computer with GNU General Public License v3.0 10 votes vote down vote up
def update_gui(self, i_event_source=mc.mc_global.EventSource.undefined):
        self.updating_gui_bool = True

        # If the list is now empty, disabling buttons
        # If the list is no longer empty, enable buttons
        self.set_button_states(mc.model.PhrasesM.is_empty())

        # List
        self.list_widget.clear()
        for l_phrase in mc.model.PhrasesM.get_all():
            # self.list_widget.addItem(l_collection.title_str)
            custom_label = CustomQLabel(l_phrase.title, l_phrase.id)
            list_item = QtWidgets.QListWidgetItem()
            list_item.setSizeHint(QtCore.QSize(list_item.sizeHint().width(), mc_global.LIST_ITEM_HEIGHT_INT))
            self.list_widget.addItem(list_item)
            self.list_widget.setItemWidget(list_item, custom_label)

        if i_event_source == mc.mc_global.EventSource.breathing_phrase_deleted:
            self.update_selected(0)
        else:
            self.update_selected()

        self.updating_gui_bool = False 
Example #6
Source File: shellcode_widget.py    From flare-ida with Apache License 2.0 10 votes vote down vote up
def initData(self):
        hashTypes = self.dbstore.getAllHashTypes()
        self.hashDict = dict([ (t.hashName, t) for t in hashTypes])

        for hash in hashTypes:
            if hash.hashName in self.configData:
                raise RuntimeError('Duplicate name not allowed')
            self.configData[hash.hashName] = hash.hashCode
            item = QtWidgets.QListWidgetItem(hash.hashName)
            self.ui.list_hashNames.addItem(item)

        self.ui.list_hashNames.setCurrentRow(0)
        self.ui.cb_dwordArray.setCheckState(QtCore.Qt.Checked)
        self.ui.cb_createStruct.setCheckState(QtCore.Qt.Checked)
        self.ui.cb_instrOps.setCheckState(QtCore.Qt.Checked)
        self.ui.cb_XORSeed.setCheckState(QtCore.Qt.Checked)
        self.ui.cb_useDecompiler.setCheckState(QtCore.Qt.Checked)
        return 
Example #7
Source File: ClearLWT.py    From tdm with GNU General Public License v3.0 10 votes vote down vote up
def __init__(self, env, *args, **kwargs):
        super(ClearLWTDialog, self).__init__(*args, **kwargs)
        self.setWindowTitle("Clear obsolete retained LWTs")
        self.setMinimumSize(QSize(320, 480))

        self.env = env

        vl = VLayout()

        sel_btns = QDialogButtonBox()
        sel_btns.setCenterButtons(True)
        btnSelAll = sel_btns.addButton("Select all", QDialogButtonBox.ActionRole)
        btnSelNone = sel_btns.addButton("Select none", QDialogButtonBox.ActionRole)

        self.lw = QListWidget()

        for lwt in self.env.lwts:
            itm = QListWidgetItem(lwt)
            itm.setCheckState(Qt.Unchecked)
            self.lw.addItem(itm)

        btnSelAll.clicked.connect(lambda: self.select(Qt.Checked))
        btnSelNone.clicked.connect(lambda: self.select(Qt.Unchecked))

        btns = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close)
        btns.accepted.connect(self.accept)
        btns.rejected.connect(self.reject)

        vl.addWidgets([sel_btns, self.lw, btns])
        self.setLayout(vl) 
Example #8
Source File: centralwidget.py    From autokey with GNU General Public License v3.0 10 votes vote down vote up
def emit(self, record):
        try:
            item = QListWidgetItem(self.format(record))
            if record.levelno > logging.INFO:
                item.setIcon(QIcon.fromTheme("dialog-warning"))
                item.setForeground(QBrush(Qt.red))

            else:
                item.setIcon(QIcon.fromTheme("dialog-information"))

            self.app.exec_in_main(self._add_item, item)

        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            self.handleError(record) 
Example #9
Source File: window.py    From visma with GNU General Public License v3.0 10 votes vote down vote up
def equationsLayout(self):
        self.myQListWidget = QtWidgets.QListWidget(self)
        for index, name in self.equations:
            myQCustomQWidget = QCustomQWidget()
            myQCustomQWidget.setTextUp(index)
            myQCustomQWidget.setTextDown(name)
            myQListWidgetItem = QtWidgets.QListWidgetItem(self.myQListWidget)
            myQListWidgetItem.setSizeHint(myQCustomQWidget.sizeHint())
            self.myQListWidget.addItem(myQListWidgetItem)
            self.myQListWidget.setItemWidget(
                myQListWidgetItem, myQCustomQWidget)
        self.myQListWidget.resize(400, 300)
        self.equationListVbox.addWidget(self.myQListWidget)
        self.myQListWidget.itemClicked.connect(self.Clicked)
        self.clearButton = QtWidgets.QPushButton('Clear equations')
        self.clearButton.clicked.connect(self.clearHistory)
        self.clearButton.setStatusTip("Clear history")
        self.equationListVbox.addWidget(self.clearButton)
        return self.equationListVbox 
Example #10
Source File: __main__.py    From pip-gui with GNU General Public License v3.0 9 votes vote down vote up
def __init__(self):
        super(UpdateWindow, self).__init__()
        self.setupUi(self)
        self.setWindowIcon(
            QtGui.QIcon(pkg_resources.resource_filename('pipgui', ASSETS_DIR + 'googledev.png')))
        self.outdatedPackages = json.load(open(
            pkg_resources.resource_filename('pipgui', OUTDATED_DIR + 'outdatedPackage' + FILEVERSION + '.json')))
        self.selectedList = list()
        self.btnBack.clicked.connect(self.backFn)
        self.btnUpdateAll.clicked.connect(self.updateAllFn)
        self.btnUpdate.clicked.connect(self.updateFn)
        if len(self.outdatedPackages):
            for i in self.outdatedPackages:
                self.item = QtWidgets.QListWidgetItem(i)
                self.listWidget.addItem(self.item)
        else:
            self.item = QtWidgets.QListWidgetItem(
                '=== No Outdated Packges ===')
            self.listWidget.addItem(self.item)
            self.btnUpdate.setEnabled(False)
            self.btnUpdateAll.setEnabled(False) 
Example #11
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 #12
Source File: gui.py    From pbtk with GNU General Public License v3.0 9 votes vote down vote up
def load_endpoints(self):
        self.choose_endpoint.endpoints.clear()
        
        for name in listdir(str(BASE_PATH / 'endpoints')):
            if name.endswith('.json'):
                item = QListWidgetItem(name.split('.json')[0], self.choose_endpoint.endpoints)
                item.setFlags(item.flags() & ~Qt.ItemIsEnabled)
                
                pb_msg_to_endpoints = defaultdict(list)
                with open(str(BASE_PATH / 'endpoints' / name)) as fd:
                    for endpoint in load(fd, object_pairs_hook=OrderedDict):
                        pb_msg_to_endpoints[endpoint['request']['proto_msg'].split('.')[-1]].append(endpoint)
                
                for pb_msg, endpoints in pb_msg_to_endpoints.items():
                    item = QListWidgetItem(' ' * 4 + pb_msg, self.choose_endpoint.endpoints)
                    item.setFlags(item.flags() & ~Qt.ItemIsEnabled)
                    
                    for endpoint in endpoints:
                        path_and_qs = '/' + endpoint['request']['url'].split('/', 3).pop()
                        item = QListWidgetItem(' ' * 8 + path_and_qs, self.choose_endpoint.endpoints)
                        item.setData(Qt.UserRole, endpoint)
        
        self.set_view(self.choose_endpoint) 
Example #13
Source File: experimental_list_widget.py    From mindfulness-at-the-computer with GNU General Public License v3.0 7 votes vote down vote up
def update_gui(self):
        self.updating_gui_bool = True

        self.list_widget.clear()
        for rest_action in model.RestActionsM.get_all():
            rest_action_title_cll = CustomQLabel(rest_action.title, rest_action.id)
            list_item = QtWidgets.QListWidgetItem()
            self.list_widget.addItem(list_item)
            self.list_widget.setItemWidget(list_item, rest_action_title_cll)

        for i in range(0, self.list_widget.count()):
            item = self.list_widget.item(i)
            rest_qll = self.list_widget.itemWidget(item)
            logging.debug("custom_qll.question_entry_id = " + str(rest_qll.question_entry_id))
            if rest_qll.question_entry_id == mc_global.active_rest_action_id_it:
                item.setSelected(True)
                return

        self.updating_gui_bool = False 
Example #14
Source File: firmware_flash.py    From ayab-desktop with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent_ui):
        # TODO: add creator that does not depend from super to ease testing.
        super(FirmwareFlash, self).__init__(None)
        self.__logger = logging.getLogger(type(self).__name__)
        self.__parent_ui = parent_ui

        self.ui = Ui_FirmwareFlashFrame()
        self.ui.setupUi(self)

        self.load_ports()
        self.load_json()

        self.ui.hardware_list.itemClicked[QtWidgets.QListWidgetItem].connect(self.hardware_item_activated)
        self.ui.controller_list.itemClicked[QtWidgets.QListWidgetItem].connect(self.controller_item_activated)
        self.ui.firmware_list.itemClicked[QtWidgets.QListWidgetItem].connect(self.firmware_item_activated)
        self.ui.flash_firmware.clicked.connect(self.execute_flash_command) 
Example #15
Source File: Archive.py    From Traffic-Rules-Violation-Detection-System with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super(ArchiveWindow, self).__init__(parent)
        loadUi('UI/Archive.ui', self)

        self.cancel.clicked.connect(self.close)

        self.log_tabwidget.clear()
        self.violation_list = QListWidget(self)
        self.log_tabwidget.addTab(self.violation_list, "Violations")
        self.violation_list.clear()
        rows = Database.getInstance().getViolationsFromCam(None, cleared=True)
        for row in rows:
            listWidget = ViolationItem()
            listWidget.setData(row)
            listWidgetItem = QtWidgets.QListWidgetItem(self.violation_list)
            listWidgetItem.setSizeHint(listWidget.sizeHint())
            self.violation_list.addItem(listWidgetItem)
            self.violation_list.setItemWidget(listWidgetItem, listWidget) 
Example #16
Source File: tabular.py    From asammdf with GNU Lesser General Public License v3.0 6 votes vote down vote up
def add_filter(self, event=None):
        filter_widget = TabularFilter(
            [(self.signals.index.name, self.signals.index.values.dtype.kind, 0, False)]
            + [
                (
                    name,
                    self.signals[name].values.dtype.kind,
                    self.signals_descr[name],
                    as_hex,
                )
                for name, as_hex in zip(self.signals.columns, self.as_hex)
            ]
        )

        item = QtWidgets.QListWidgetItem(self.filters)
        item.setSizeHint(filter_widget.sizeHint())
        self.filters.addItem(item)
        self.filters.setItemWidget(item, filter_widget) 
Example #17
Source File: gui.py    From pbtk with GNU General Public License v3.0 5 votes vote down vote up
def new_endpoint(self, path):
        if not self.proto_fs.isDir(path):
            path = self.proto_fs.filePath(path)
            
            if not getattr(self, 'only_resp_combo', False):
                self.create_endpoint.pbRequestCombo.clear()
            self.create_endpoint.pbRespCombo.clear()
            
            has_msgs = False
            for name, cls in load_proto_msgs(path):
                has_msgs = True
                if not getattr(self, 'only_resp_combo', False):
                    self.create_endpoint.pbRequestCombo.addItem(name, (path, name))
                self.create_endpoint.pbRespCombo.addItem(name, (path, name))
            if not has_msgs:
                QMessageBox.warning(self.view, ' ', 'There is no message defined in this .proto.')
                return
            
            self.create_endpoint.reqDataSubform.hide()

            if not getattr(self, 'only_resp_combo', False):
                self.create_endpoint.endpointUrl.clear()
                self.create_endpoint.transports.clear()
                self.create_endpoint.sampleData.clear()
                self.create_endpoint.pbParamKey.clear()
                self.create_endpoint.parsePbCheckbox.setChecked(False)
                
                for name, meta in transports.items():
                    item = QListWidgetItem(meta['desc'], self.create_endpoint.transports)
                    item.setData(Qt.UserRole, (name, meta.get('ui_data_form')))
            
            elif getattr(self, 'saved_transport_choice'):
                self.create_endpoint.transports.setCurrentItem(self.saved_transport_choice)
                self.pick_transport(self.saved_transport_choice)
                self.saved_transport_choice = None
            
            self.only_resp_combo = False
            self.set_view(self.create_endpoint) 
Example #18
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 #19
Source File: gui.py    From pbtk with GNU General Public License v3.0 5 votes vote down vote up
def load_extractors(self):
        self.choose_extractor.extractors.clear()
        
        for name, meta in extractors.items():
            item = QListWidgetItem(meta['desc'], self.choose_extractor.extractors)
            item.setData(Qt.UserRole, name)
        
        self.set_view(self.choose_extractor) 
Example #20
Source File: hue_ui.py    From hue-plus with GNU General Public License v3.0 5 votes vote down vote up
def fixedAddFunc(self):
        if self.fixedList.count() == 1:
            self.error("Fixed cannot have more than one color")
        else:
            hex_color = pick("Color")
            if hex_color is None:
                return
            color = "#" + hex_color.lower()
            actual, closest = get_colour_name(webcolors.hex_to_rgb(color))
            if not actual:
                actual = closest
            self.fixedList.addItem(QListWidgetItem(actual + "(" + color + ")")) 
Example #21
Source File: demoListWidget2.py    From Qt5-Python-GUI-Programming-Cookbook with MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(729, 412)
        self.listWidgetDiagnosis = QtWidgets.QListWidget(Dialog)
        self.listWidgetDiagnosis.setGeometry(QtCore.QRect(200, 20, 351, 171))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.listWidgetDiagnosis.setFont(font)
        self.listWidgetDiagnosis.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
        self.listWidgetDiagnosis.setObjectName("listWidgetDiagnosis")
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        item = QtWidgets.QListWidgetItem()
        self.listWidgetDiagnosis.addItem(item)
        self.labelTest = QtWidgets.QLabel(Dialog)
        self.labelTest.setGeometry(QtCore.QRect(20, 230, 171, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.labelTest.setFont(font)
        self.labelTest.setObjectName("labelTest")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(30, 10, 151, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.listWidgetSelectedTests = QtWidgets.QListWidget(Dialog)
        self.listWidgetSelectedTests.setGeometry(QtCore.QRect(200, 220, 351, 192))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.listWidgetSelectedTests.setFont(font)
        self.listWidgetSelectedTests.setObjectName("listWidgetSelectedTests")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example #22
Source File: hue_ui.py    From hue-plus with GNU General Public License v3.0 5 votes vote down vote up
def breathingAddFunc(self):
        color = "#" + pick("Color").lower()
        actual, closest = get_colour_name(webcolors.hex_to_rgb(color))
        if not actual:
            actual = closest
        self.breathingList.addItem(QListWidgetItem(actual + "(" + color + ")")) 
Example #23
Source File: hue_ui.py    From hue-plus with GNU General Public License v3.0 5 votes vote down vote up
def fadingAddFunc(self):
        hex_color = pick("Color")
        if hex_color is None:
            return
        color = "#" + hex_color.lower()
        actual, closest = get_colour_name(webcolors.hex_to_rgb(color))
        if not actual:
            actual = closest
        self.fadingList.addItem(QListWidgetItem(actual + "(" + color + ")")) 
Example #24
Source File: hue_ui.py    From hue-plus with GNU General Public License v3.0 5 votes vote down vote up
def marqueeAddFunc(self):
        if self.marqueeList.count() == 1:
            self.error("Marquee cannot have more than one color")
        else:
            hex_color = pick("Color")
            if hex_color is None:
                return
            color = "#" + hex_color.lower()
            actual, closest = get_colour_name(webcolors.hex_to_rgb(color))
            if not actual:
                actual = closest
            self.marqueeList.addItem(QListWidgetItem(actual + "(" + color + ")")) 
Example #25
Source File: hue_ui.py    From hue-plus with GNU General Public License v3.0 5 votes vote down vote up
def coverMarqueeAddFunc(self):
        hex_color = pick("Color")
        if hex_color is None:
            return
        color = "#" + hex_color.lower()
        actual, closest = get_colour_name(webcolors.hex_to_rgb(color))
        if not actual:
            actual = closest
        self.coverMarqueeList.addItem(QListWidgetItem(actual + "(" + color + ")")) 
Example #26
Source File: hue_ui.py    From hue-plus with GNU General Public License v3.0 5 votes vote down vote up
def alternatingAddFunc(self):
        if self.alternatingList.count() == 2:
            self.error("Alternating cannot have more than two colors")
        else:
            hex_color = pick("Color")
            if hex_color is None:
                return
            color = "#" + hex_color.lower()
            actual, closest = get_colour_name(webcolors.hex_to_rgb(color))
            if not actual:
                actual = closest
            self.alternatingList.addItem(QListWidgetItem(actual + "(" + color + ")")) 
Example #27
Source File: cad_viewer.py    From ezdxf with MIT License 5 votes vote down vote up
def _layers_updated(self, _item: qw.QListWidgetItem):
        self._visible_layers = set()
        for i in range(self.layers.count()):
            layer = self.layers.item(i)
            if layer.checkState() == qc.Qt.Checked:
                self._visible_layers.add(layer.text())
        self.draw_layout(self._current_layout) 
Example #28
Source File: hue_ui.py    From hue-plus with GNU General Public License v3.0 5 votes vote down vote up
def candleAddFunc(self):
        if self.candleList.count() == 1:
            self.error("Candle cannot have more than 1 color")
        else:
            hex_color = pick("Color")
            if hex_color is None:
                return
            color = "#" + hex_color.lower()
            actual, closest = get_colour_name(webcolors.hex_to_rgb(color))
            if not actual:
                actual = closest
            self.candleList.addItem(QListWidgetItem(actual + "(" + color + ")")) 
Example #29
Source File: qomui_gui.py    From qomui with GNU General Public License v3.0 5 votes vote down vote up
def pop_bypassAppList(self):
        self.bypassAppList.clear()
        for k,v in self.bypass_dict.items():
            self.Item = widgets.ServerWidget()
            self.ListItem = QtWidgets.QListWidgetItem(self.bypassAppList)
            self.ListItem.setSizeHint(QtCore.QSize(100, 50))
            self.Item.setText(k, "bypass", v[0], None, button="bypass")
            self.ListItem.setData(QtCore.Qt.UserRole, k)
            self.Item.hide_button(0)
            self.bypassAppList.addItem(self.ListItem)
            self.bypassAppList.setItemWidget(self.ListItem, self.Item)
            self.Item.server_chosen.connect(self.bypass_tunnel) 
Example #30
Source File: MainWindow.py    From Traffic-Rules-Violation-Detection-System with GNU General Public License v3.0 5 votes vote down vote up
def updateLog(self):
        self.violation_list.clear()
        rows = self.database.getViolationsFromCam(str(self.cam_selector.currentText()))
        for row in rows:
            listWidget = ViolationItem()
            listWidget.setData(row)
            listWidgetItem = QtWidgets.QListWidgetItem(self.violation_list)
            listWidgetItem.setSizeHint(listWidget.sizeHint())
            self.violation_list.addItem(listWidgetItem)
            self.violation_list.setItemWidget(listWidgetItem, listWidget)