Python PyQt5.QtWidgets.QListWidgetItem() Examples

The following are 30 code examples for showing how to use PyQt5.QtWidgets.QListWidgetItem(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: Python-GUI   Author: arpitj07   File: Project.py    License: MIT License 6 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 2
Project: mindfulness-at-the-computer   Author: mindfulness-at-the-computer   File: experimental_list_widget.py    License: GNU General Public License v3.0 6 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 3
Project: mindfulness-at-the-computer   Author: mindfulness-at-the-computer   File: breathing_phrase_list_wt.py    License: GNU General Public License v3.0 6 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 4
Project: Traffic-Rules-Violation-Detection   Author: rahatzamancse   File: Archive.py    License: 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.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 5
Project: visma   Author: aerospaceresearch   File: window.py    License: GNU General Public License v3.0 6 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 6
Project: ddt4all   Author: cedricp   File: ddt4all.py    License: GNU General Public License v3.0 6 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 7
Project: ddt4all   Author: cedricp   File: ddt4all.py    License: GNU General Public License v3.0 6 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 8
Project: pip-gui   Author: GDGVIT   File: __main__.py    License: GNU General Public License v3.0 6 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 9
Project: pbtk   Author: marin-m   File: gui.py    License: GNU General Public License v3.0 6 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 10
Project: autokey   Author: autokey   File: centralwidget.py    License: GNU General Public License v3.0 6 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 11
Project: CASC   Author: Cisco-Talos   File: casc_plugin.py    License: GNU General Public License v2.0 6 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
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 13
Project: flare-ida   Author: fireeye   File: shellcode_widget.py    License: Apache License 2.0 6 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 14
Project: asammdf   Author: danielhrisca   File: tabular.py    License: 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 15
Project: ayab-desktop   Author: AllYarnsAreBeautiful   File: firmware_flash.py    License: 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 16
Project: pkmeter   Author: pkkid   File: pkconfig.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _init_window(self):
        # Load core stylesheet
        stylepath = os.path.join(SHAREDIR, 'pkmeter.css')
        with open(stylepath) as handle:
            self.setStyleSheet(handle.read())
        # Init self properties
        self.setWindowTitle('PKMeter Preferences')
        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowIcon(QtGui.QIcon(QtGui.QPixmap('img:logo.png')))
        self.layout().setContentsMargins(10,10,10,10)
        # Init window elements
        self.manifest.tabbar.setExpanding(False)
        self.manifest.tabbar.addTab('Settings')
        self.manifest.tabbar.addTab('Data')
        self.manifest.contents.setSizePolicy(QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding))
        self.manifest.tabbar.currentChanged.connect(self.load_tab)
        # Init the ListWidget
        listwidget = self.manifest.list
        for module in sorted(self.pkmeter.modules.values(), key=self._sortKey):
            if getattr(module, 'Plugin', None) or getattr(module, 'Config', None):
                item = QtWidgets.QListWidgetItem(utils.name(module), parent=listwidget, type=0)
                item.setData(NAMESPACE_ROLE, utils.namespace(module))
                listwidget.addItem(item)
        self.manifest.list.itemSelectionChanged.connect(self.load_tab) 
Example 17
Project: Python-GUI   Author: arpitj07   File: Project.py    License: MIT License 5 votes vote down vote up
def combo2(self):
        myteam=sqlite3.connect("TEAM.db")
        cu= myteam.cursor()
        
        team = self.eval_screen.SelectTeam.currentText()
        cu.execute("SELECT PlAYERS from team WHERE NAMES='"+team+"';")
        player= cu.fetchall()
        self.eval_screen.PlayerList.clear()
        for i in range(len(player)):
            item= QtWidgets.QListWidgetItem(player[i][0])
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            item.setFont(font)
            item.setBackground(QtGui.QColor('#ffff99'))
            self.eval_screen.PlayerList.addItem(item)
        
        cu.execute("SELECT SCORES from team WHERE NAMES='"+team+"';")
        score=cu.fetchall()
        self.teamscore=[]
        for i in range(len(score)):
            self.teamscore.append(score[i][0])
    
        self.eval_screen.ScoreList.clear()
        for i in range(len(score)):
            items= QtWidgets.QListWidgetItem(str(score[i][0]))
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            items.setFont(font)
            items.setBackground(QtGui.QColor('#fdc086'))
            self.eval_screen.ScoreList.addItem(items) 
Example 18
Project: mindfulness-at-the-computer   Author: mindfulness-at-the-computer   File: rest_action_list_wt.py    License: GNU General Public License v3.0 5 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 = RestQLabel(rest_action.title, rest_action.id)
            list_item = QtWidgets.QListWidgetItem()
            list_item.setSizeHint(QtCore.QSize(list_item.sizeHint().width(), mc.mc_global.LIST_ITEM_HEIGHT_INT))
            self.list_widget.addItem(list_item)
            self.list_widget.setItemWidget(list_item, rest_action_title_cll)

        # self.update_gui_details()

        self.updating_gui_bool = False 
Example 19
Project: Traffic-Rules-Violation-Detection   Author: rahatzamancse   File: MainWindow.py    License: GNU General Public License v3.0 5 votes vote down vote up
def updateLog(self):
        self.violation_list.clear()
        rows = self.database.get_violations_from_cam(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) 
Example 20
Project: Traffic-Rules-Violation-Detection   Author: rahatzamancse   File: SearchWindow.py    License: GNU General Public License v3.0 5 votes vote down vote up
def search(self):
        cam = None if self.camera.currentText() == "None" else self.camera.currentText()
        color = None if self.color.currentText() == "None" else self.color.currentText()
        license = None if self.substring.text() == "" else self.substring.text()
        time = None if self.use_time.isChecked() is False else (self.from_time.dateTime().toMSecsSinceEpoch(), self.to_time.dateTime().toMSecsSinceEpoch())
        rows = Database.get_instance().search(cam=cam, color=color, license=license, time=time)
        for row in rows:
            print(row)
            listWidget = ViolationItem()
            listWidget.setData(row)
            listWidgetItem = QtWidgets.QListWidgetItem(self.search_result)
            listWidgetItem.setSizeHint(listWidget.sizeHint())
            self.search_result.addItem(listWidgetItem)
            self.search_result.setItemWidget(listWidgetItem, listWidget)
        self.destroy() 
Example 21
Project: qhangups   Author: xmikos   File: conversationslist.py    License: GNU General Public License v3.0 5 votes vote down vote up
def set_status(self, status_text):
        """Display static status text instead of list of conversations"""
        self.conversationsListWidget.clear()
        item = QtWidgets.QListWidgetItem(status_text)
        item.setTextAlignment(QtCore.Qt.AlignHCenter)
        self.conversationsListWidget.addItem(item) 
Example 22
Project: qhangups   Author: xmikos   File: conversationslist.py    License: GNU General Public License v3.0 5 votes vote down vote up
def update_conversations(self):
        """Update list of conversations"""
        self.conversationsListWidget.clear()
        for conv in sorted(self.conv_list.get_all(), reverse=True, key=lambda c: c.last_modified):
            item = QtWidgets.QListWidgetItem(get_conv_name(conv, truncate=True))
            item.setToolTip(get_conv_name(conv))
            item.setData(QtCore.Qt.UserRole, conv.id_)
            self.conversationsListWidget.addItem(item) 
Example 23
Project: dunya-desktop   Author: MTG   File: listwidget.py    License: GNU General Public License v3.0 5 votes vote down vote up
def add_collections(self, colls):
        for coll in colls:
            item = QListWidgetItem(coll)
            self.addItem(item) 
Example 24
Project: dunya-desktop   Author: MTG   File: listwidget.py    License: GNU General Public License v3.0 5 votes vote down vote up
def add_items(self, coll):
        # first cleans all the items on the list
        self.clear()
        for item in coll:
            path = os.path.join(DOCS_PATH, item,
                                'audioanalysis--metadata.json')
            metadata = json.load(open(path))
            item = QListWidgetItem(metadata['title'])
            self.addItem(item) 
Example 25
Project: visma   Author: aerospaceresearch   File: window.py    License: GNU General Public License v3.0 5 votes vote down vote up
def clearHistory(self):

        for i in reversed(range(self.equationListVbox.count())):
            self.equationListVbox.itemAt(i).widget().setParent(None)

        self.equations = [('No equations stored', '')]

        file = open('local/eqn-list.vis', 'r+')
        file.truncate()
        self.myQListWidget = QtWidgets.QListWidget(self)
        i = 0
        for index, name in self.equations:
            if i != 0:
                file.write("\n")
            file.write(name)
            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)
            i += 1
        file.close()
        self.myQListWidget.resize(400, 300)
        self.myQListWidget.itemClicked.connect(self.Clicked)
        self.equationListVbox.addWidget(self.myQListWidget)
        self.clearButton = QtWidgets.QPushButton('Clear equations')
        self.clearButton.clicked.connect(self.clearHistory)
        self.equationListVbox.addWidget(self.clearButton)
        return self.equationListVbox 
Example 26
Project: IDAngr   Author: andreafioraldi   File: main_gui.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def add_find(self, addr):
        item = QtWidgets.QListWidgetItem("0x%x" % addr)
        self.ui.findView.addItem(item) 
Example 27
Project: IDAngr   Author: andreafioraldi   File: main_gui.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def add_avoid(self, addr):
        item = QtWidgets.QListWidgetItem("0x%x" % addr)
        self.ui.avoidView.addItem(item) 
Example 28
Project: ddt4all   Author: cedricp   File: ddt4all.py    License: GNU General Public License v3.0 5 votes vote down vote up
def newEcu(self):
        filename_tuple = widgets.QFileDialog.getSaveFileName(self, _("Save ECU (keep '.json' extension)"), "./json/myecu.json",
                                                   "*.json")
        if qt5:
            filename = str(filename_tuple[0])
        else:
            filename = str(filename_tuple)

        if filename == '':
            return

        basename = os.path.basename(utf8(filename))
        filename = os.path.join("./json", basename)
        ecufile = ecu.Ecu_file(None)
        layout = open(filename + ".layout", "w")
        layout.write('{"screens": {}, "categories":{"Category":[]} }')
        layout.close()

        targets = open(filename + ".targets", "w")
        targets.write('[]')
        targets.close()

        layout = open(filename, "w")
        layout.write(ecufile.dumpJson())
        layout.close()

        item = widgets.QListWidgetItem(basename)
        self.treeview_ecu.addItem(item) 
Example 29
Project: ddt4all   Author: cedricp   File: ddt4all.py    License: GNU General Public License v3.0 5 votes vote down vote up
def loadEcu(self, name):
        vehicle_file = "vehicles/" + name + ".ecu"
        jsonfile = open(vehicle_file, "r")
        eculist = json.loads(jsonfile.read())
        jsonfile.close()

        self.treeview_ecu.clear()
        self.treeview_params.clear()
        if self.paramview:
            self.paramview.init(None)

        for ecu in eculist:
            item = widgets.QListWidgetItem(ecu[0])
            self.ecunamemap[ecu[0]] = ecu[1]
            self.treeview_ecu.addItem(item) 
Example 30
Project: reaper   Author: ScriptSmith   File: nodes.py    License: GNU General Public License v3.0 5 votes vote down vote up
def add_elements(self, elements):
        if elements:
            for element in elements:
                listItem = QtWidgets.QListWidgetItem(element.text, self)
                self.addItem(listItem)

        emptyItem = QtWidgets.QListWidgetItem("", self)
        emptyItem.setFlags(emptyItem.flags() | QtCore.Qt.ItemIsEditable)
        self.addItem(emptyItem)