def __init__(self, rawImageLayer, objectImageLayer, featureTableNames, imagePerObject=True, \ imagePerTime = True, parent=None): QDialog.__init__(self, parent) self.setWindowTitle("Export to Knime") ui_class, widget_class = uic.loadUiType( os.path.split(__file__)[0] + "/exportToKnimeDialog.ui") self.ui = ui_class() self.ui.setupUi(self) itemRaw = QListWidgetItem(rawImageLayer.name) self.ui.rawList.addItem(itemRaw) itemObjects = QListWidgetItem(objectImageLayer.name) self.ui.objectList.addItem(itemObjects) self.imagePerObject = imagePerObject self.imagePerTime = imagePerTime #FIXME: assume for now tht the feature table is a dict try: for plugin, feature_dict in featureTableNames.iteritems(): print plugin for feature_name in feature_dict.keys(): print "adding feature:", feature_name item = QListWidgetItem(feature_name) item.setFlags(item.flags() | Qt.ItemIsUserCheckable) item.setCheckState(Qt.Unchecked) self.ui.featureList.addItem(item) except: print "hahaha, doesn't work!"
def populate_listwidget(self): """ Deals with initial population and slot connection. Re-populate list with previously selected but unsaved esu's. i.e. with same modification """ if self.unsaved: for esu in self.unsaved: self.selected_dict[int(esu)] = QListWidgetItem( str(esu), self.list_widget) self.original_selection = self.unsaved elif self.usrn: self.gn_fnc.zoom_to_record(usrn=self.usrn, select=True) esu_list = self.gn_fnc.query_esu(self.usrn) try: for esu in esu_list: self.selected_dict[int(esu)] = QListWidgetItem( str(esu), self.list_widget) # Create list of original esu's (edit testing comparison) self.original_selection = esu_list except TypeError: # no esu links pass else: # Connect selection changed signal self.connect_selection_change() return # Connect selection changed signal self.connect_selection_change() # Zoom canvas to esu's self.zoom_to_esus()
def CREATE_LISTS(self): # ------------------------------------------------------------------- try: self.ORDERS_LIST_SELL.clear() self.ORDERS_LIST_BUY.clear() for ID in self.ORDERS_FROM_DB: item = "" item += "#{:11} DEL".format(str(ID)) # order_id item += "{:7} DEL".format(self.ORDERS_FROM_DB[ID]["pair"]) # type item += "{:13} DEL".format( str("{:10,.6f}".format( self.ORDERS_FROM_DB[ID]["amount"])).strip()) # Amount item += "{:13} DEL".format( str("{:10,.6f}".format( self.ORDERS_FROM_DB[ID]["at_price"])).strip()) # at_price newItemToolTip = "Order ID: #" + str( ID) + " Created: " + time.ctime( self.ORDERS_FROM_DB[ID]["unix_time"]) if self.ORDERS_FROM_DB[ID]["type"] == "buy": ttl = self.ORDERS_FROM_DB[ID]["amount"] - ( self.ORDERS_FROM_DB[ID]["amount"] / 100 * self.PARENT.FEE) item += "{:13}".format( str("{:10,.6f}".format(ttl)).strip()) # ttl_usd newItem = QListWidgetItem( QIcon("./data/imgs/icon_filled_status_0.png"), item.replace("DEL", self._i_), self.ORDERS_LIST_BUY, 0) newItem.setToolTip(newItemToolTip) elif self.ORDERS_FROM_DB[ID]["type"] == "sell": ttl = self.ORDERS_FROM_DB[ID][ "at_price"] * self.ORDERS_FROM_DB[ID]["amount"] ttl -= (ttl / 100 * self.PARENT.FEE) item += "{:13}".format( str("{:10,.6f}".format(ttl)).strip()) # ttl_usd newItem = QListWidgetItem( QIcon("./data/imgs/icon_filled_status_0.png"), item.replace("DEL", self._i_), self.ORDERS_LIST_SELL, 0) newItem.setToolTip(newItemToolTip) except Exception as _exception: print("FRAME_ORDER.CREATE_LISTS: " + str(_exception))
def browse(self): title = "Load " + str(self.ckey) if not self.nodetype: if self.inputcombo and self.inputcombo.currentIndex() == 0: if isinstance(self.container, QListWidget): sFileName = QFileDialog.getOpenFileNames(self.parent, title, addLocalPathButton.lastPath) if len(sFileName) > 0: self.setLastPath(sFileName[0]) for name in sFileName: item = QListWidgetItem(name, self.container) elif isinstance(self.container, QLineEdit): sFileName = QFileDialog.getOpenFileName(self.parent, title, addLocalPathButton.lastPath) self.setLastPath(sFileName) self.container.clear() self.container.insert(sFileName) elif isinstance(self.container, QComboBox): sFileName = QFileDialog.getOpenFileName(self.parent, title, addLocalPathButton.lastPath) self.setLastPath(sFileName) self.container.insertItem(0, sFileName) self.container.setCurrentIndex(0) else: return -1 else: sFileName = QFileDialog.getExistingDirectory(self.parent, title, addLocalPathButton.lastPath, QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks) self.setLastPath(sFileName) if isinstance(self.container, QListWidget): if sFileName: item = QListWidgetItem(sFileName, self.container) elif isinstance(self.container, QComboBox): self.container.insertItem(0, sFileName) self.container.setCurrentIndex(0) else: self.container.insert(sFileName) self.manager.emit(SIGNAL("managerChanged")) else: BrowseVFSDialog = DialogNodeBrowser(self) if isinstance(self.container, QListWidget) or isinstance(self.container, QComboBox): iReturn = BrowseVFSDialog.exec_() if iReturn : nodes = BrowseVFSDialog.getSelectedNodes() index = 0 if len(nodes): for node in nodes: self.container.insertItem(index, QString.fromUtf8(node.absolute())) index += 1 if isinstance(self.container, QListWidget): self.container.setCurrentItem(self.container.item(0)) else: self.container.setCurrentIndex(0) else: iReturn = BrowseVFSDialog.exec_() if iReturn : node = BrowseVFSDialog.getSelectedNode() print node if node: self.container.clear() self.container.insert(QString.fromUtf8(node.absolute())) BrowseVFSDialog.browser.__del__()
def _addResult(self, layer, features): layername = layer.name() forms = self.forms.get(layername, []) if not forms: item = QListWidgetItem(QIcon(), layername, self.layerList) item.setData(Qt.UserRole, FeatureCursor(layer, features)) return for form in forms: itemtext = "{} \n ({})".format(layername, form.label) icon = QIcon(form.icon) item = QListWidgetItem(icon, itemtext, self.layerList) item.setData(Qt.UserRole, FeatureCursor(layer, features, form))
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setupUi(self) self.loadlastCheckbox.setChecked(globalvalue.globalcfg.loadlasttime) self.openRemoteCheckbox.setChecked(globalvalue.globalcfg.openremote) self.sengine_own = globalvalue.globalcfg.sengine_own self.searchext = globalvalue.globalcfg.searchext if self.sengine_own: self.check_searchengine.setChecked(False) self.pushButton_slct.setEnabled(True) self.pushButton_deslct.setEnabled(True) else: self.check_searchengine.setChecked(True) self.pushButton_slct.setEnabled(False) self.pushButton_deslct.setEnabled(False) self.loadlasttime = globalvalue.globalcfg.loadlasttime self.openremote = globalvalue.globalcfg.openremote s = u'font family: ' if globalvalue.globalcfg.fontfamily: s = s + globalvalue.globalcfg.fontfamily else: s = s + u'default' self.fontfamily = globalvalue.globalcfg.fontfamily s = s + u"\nfont size:" if globalvalue.globalcfg.fontsize: s = s + str(globalvalue.globalcfg.fontsize) else: s = s + u'default' self.fontsize = globalvalue.globalcfg.fontsize self.label.setText(s) self.connect(self.pushButton, QtCore.SIGNAL('clicked()'), self.fontSelect) self.connect(self.loadlastCheckbox, QtCore.SIGNAL('clicked()'), self.onLoadLast) self.connect(self.openRemoteCheckbox, QtCore.SIGNAL('clicked()'), self.onOpenRemote) self.connect(self.check_searchengine, QtCore.SIGNAL('clicked()'), self.onSlctEngine) self.connect(self.pushButton_slct, QtCore.SIGNAL('clicked()'), self.onSlctExt) self.connect(self.pushButton_deslct, QtCore.SIGNAL('clicked()'), self.onUnSlctExt) for a, b in self.searchext.iteritems(): if b: item = QListWidgetItem(self.list_search) item.setText(a) else: item = QListWidgetItem(self.list_unsearch) item.setText(a)
def mostrarMaquinas(self): dicA = {} dicB = {} self.ui.listWidget.clear() item = QListWidgetItem(str("Maquinas apagadas")) self.ui.listWidget.addItem(item) cont = 1 for names in connection.listDefinedDomains(): item = QListWidgetItem(str(names)) self.ui.listWidget.addItem(item) dicA[names] = cont cont = cont + 1 item = QListWidgetItem(str("")) self.ui.listWidget.addItem(item) item = QListWidgetItem(str("")) self.ui.listWidget.addItem(item) item = QListWidgetItem(str("Maquinas encendidas")) self.ui.listWidget.addItem(item) for identificador in connection.listDomainsID(): vm = connection.lookupByID(identificador) info = vm.info() item = QListWidgetItem(str(vm.name())) self.ui.listWidget.addItem(item) dicB[identificador] = vm.name() diccionarioDatos = {} diccionarioDatos['Name'] = vm.name() diccionarioDatos['Estado'] = info[0] item = QListWidgetItem(str("Estado = %d" % info[0])) self.ui.listWidget.addItem(item) item = QListWidgetItem(str("Memory = %d" % info[1])) self.ui.listWidget.addItem(item)
def fileDropped(self, l): for files in l: if self.cmBox_mode.currentText() == 'Tex 2 Exr': if os.path.exists(files) and files.endswith('.tex'): print(files + " : Added") y = QListWidgetItem(files) y.setIcon(QIcon(r"icon.png")) self.list_widget.addItem(y) else: if os.path.exists(files) and files.endswith('.exr'): print(files + " : Added") y = QListWidgetItem(files) y.setIcon(QIcon(r"icon.png")) self.list_widget.addItem(y)
def addBodyMatches(self, poslist): for p in poslist: it = QListWidgetItem(p.h, self.lw) f = it.font() f.setBold(True) it.setFont(f) self.its[id(it)] = (p, None) ms = matchlines(p.b, p.matchiter) for ml, pos in ms: #print "ml",ml,"pos",pos it = QListWidgetItem(ml, self.lw) self.its[id(it)] = (p, pos)
def fillSourceList(self): """ Change dialog controls when an other calculation type selected. """ # get the selected stations stn1 = self.ui.Station1Combo.itemData( self.ui.Station1Combo.currentIndex()) stn2 = self.ui.Station2Combo.itemData( self.ui.Station2Combo.currentIndex()) # clear source and target list self.ui.SourceList.clear() self.ui.TargetList.clear() # get tartget poins according to the stations targets = [] if stn1 is not None and (self.ui.OrientRadio.isChecked() or \ self.ui.ResectionRadio.isChecked() or self.ui.FreeRadio.isChecked()): targets = get_targets(stn1[0], stn1[1], stn1[2], True) elif stn1 is not None and self.ui.RadialRadio.isChecked(): targets = get_targets(stn1[0], stn1[1], stn1[2], False, True) elif stn1 is not None and stn2 is not None and \ self.ui.IntersectRadio.isChecked(): # fill source list for intersection (common points) targets_stn1 = get_targets(stn1[0], stn1[1], stn1[2], False) targets_stn2 = get_targets(stn2[0], stn2[1], stn2[2], False) for t1 in targets_stn1: for t2 in targets_stn2: if t1[0] == t2[0]: if not t1[0] in targets: targets.append([t1, t2]) break # fill source list widget known_list = get_known() if targets is not None: for target in targets: if self.ui.IntersectRadio.isChecked(): item = QListWidgetItem(target[0][0]) item.setData(Qt.UserRole, target) if known_list is not None and target[0][0] in known_list: itemfont = item.font() itemfont.setWeight(QFont.Bold) item.setFont(itemfont) else: item = QListWidgetItem(u"%s (id:%s)" % (target[0], target[2])) item.setData(Qt.UserRole, target) if known_list is not None and target[0] in known_list: itemfont = item.font() itemfont.setWeight(QFont.Bold) item.setFont(itemfont) self.ui.SourceList.addItem(item)
def obtain_model_items(self, proposals): for p in proposals: if p.type == 'function': self.popupView.addItem( QListWidgetItem( self.icons[p.type], '%s(%s)' % (p.name, ', '.join([ n for n in p.pyname.get_object().get_param_names() if n != 'self' ])))) else: self.popupView.addItem( QListWidgetItem( self.icons.get(p.type, self.icons['class']), p.name)) return self.popupView.model()
def setResoursesList(self, resourcelist): self.lockresource = True self.resourceselector.clear() self.lockresource = False item = QListWidgetItem("Script Editor") item.setData(Qt.UserRole, ("scripteditor", None)) self.resourceselector.addItem(item) self.resourceselector.setCurrentItem(item) for resourcetype, value in resourcelist: if resourcetype == "trainerbattle": item = QListWidgetItem("Trainerbattle 0x%X" % value) item.setData(Qt.UserRole, (resourcetype, value)) self.resourceselector.addItem(item)
def show_result(self, results): self.lstSearchResult.clear() if results: for (pt, desc) in results: new_item = QListWidgetItem() new_item.setText(unicode(desc)) new_item.setData(Qt.UserRole, pt) self.lstSearchResult.addItem(new_item) else: new_item = QListWidgetItem() new_item.setText(self.tr('No results!')) new_item.setData(Qt.UserRole, None) self.lstSearchResult.addItem(new_item) self.lstSearchResult.update()
def set_widgets(self): """Set widgets on the Subcategory tab.""" self.clear_further_steps() # Set widgets purpose = self.parent.step_kw_purpose.selected_purpose() self.lstSubcategories.clear() self.lblDescribeSubcategory.setText('') self.lblIconSubcategory.setPixmap(QPixmap()) self.lblSelectSubcategory.setText( get_question_text('%s_question' % purpose['key'])) for i in self.subcategories_for_layer(): item = QListWidgetItem(i['name'], self.lstSubcategories) item.setData(QtCore.Qt.UserRole, i['key']) self.lstSubcategories.addItem(item) # Check if layer keywords are already assigned key = self.parent.step_kw_purpose.selected_purpose()['key'] keyword = self.parent.get_existing_keyword(key) # Overwrite the keyword if it's KW mode embedded in IFCW mode if self.parent.parent_step: keyword = self.parent.get_parent_mode_constraints()[1]['key'] # Set values based on existing keywords or parent mode if keyword: subcategories = [] for index in xrange(self.lstSubcategories.count()): item = self.lstSubcategories.item(index) subcategories.append(item.data(QtCore.Qt.UserRole)) if keyword in subcategories: self.lstSubcategories.setCurrentRow( subcategories.index(keyword)) self.auto_select_one_item(self.lstSubcategories)
def add_list_items(self, proposals): self.completion_list.clear() for p in proposals: self.completion_list.addItem( QListWidgetItem( QIcon(self._icons.get(p[0], resources.IMAGES['attribute'])), p[1], type=ord(p[0])))
def search(self, text): db = self.db c = db.cursor() self.resultsView.clear() self.resultsView.setEnabled(False) if not text: return if self.fuzzyCheck.isChecked(): search = "* ".join(text.split()) + "*" else: search = text query = c.execute( """SELECT layer, featureid, snippet(search, '[',']') as snippet FROM search JOIN featureinfo on search.docid = featureinfo.id WHERE search match '{}' LIMIT 100""".format( search)).fetchall() for layer, featureid, snippet in query: item = QListWidgetItem() text = "{}\n {}".format(layer, snippet.replace('\n', ' ')) item.setText(text) item.setData(Qt.UserRole, (layer, featureid, snippet)) self.resultsView.addItem(item) self.resultsView.setEnabled(True) if self.resultsView.count() == 0: self.resultsView.addItem("No Results") self.resultsView.setEnabled(False) db.close()
def setEditorData(self, editor, index): """Specifies how the given editor should be filled out with the data from the model. """ if not index.isValid(): return # if BaseDNs if index.column() == 5: # List of strings from the model d = index.data().toPyObject() # Empty the editor (clear old list) editor.clear() # Fill it out with new data for tmpBase in d: # The editor is the items parent, so it gets added to # the list QListWidgetItem(tmpBase, editor) # Can also do this #editor.addItem(QListWidgetItem(tmpBase)) return # NOTE: If a QComboBox just set the index it should display # (the strings displayed is in the .ui-file) this means the # strings in the *.ui file HAS TO BE IN THE CORRECT ORDER. # If QComboBoxes has currentIndex just give it the data. if editor.property("currentIndex").isValid(): editor.setProperty("currentIndex", index.data()) return # else (default) QStyledItemDelegate.setEditorData(self, editor, index)
def __init__(self, workspace, documents): super(_UISaveFiles, self).__init__(workspace) self.cancelled = False from PyQt4 import uic # lazy import for better startup performance uic.loadUi(os.path.join(DATA_FILES_PATH, 'ui/SaveFiles.ui'), self) self.buttonBox.clicked.connect(self._onButtonClicked) self._itemToDocument = {} for document in documents: name = document.fileName() if name is None: name = 'untitled' item = QListWidgetItem(name, self.listWidget) if document.filePath() is not None: item.setToolTip(document.filePath()) item.setCheckState(Qt.Checked) self._itemToDocument[item] = document self.buttonBox.button(self.buttonBox.Discard).setText( self.tr('Close &without Saving')) self.buttonBox.button(self.buttonBox.Cancel).setText( self.tr('&Cancel Close')) self.buttonBox.button(self.buttonBox.Save).setText( self.tr('&Save checked')) self.buttonBox.button(QDialogButtonBox.Cancel).setFocus()
def clicked(self): tupla = (self.arg1.text(), self.arg2.text()) valor1 = tupla[0].split(sep=",") valor2 = tupla[1].split(sep=",") tupla = (valor1, valor2) if tupla[0] and tupla[1]: lista = (self.funciones[self.consulta_actual])(tupla) self.respuesta.clear() if isinstance(lista, list): for x in lista: item = QListWidgetItem(str(x)) self.respuesta.addItem(item) else: item = QListWidgetItem(str(lista)) self.respuesta.addItem(item)
def resultitemchanged(self, new_item): self.IDC_textDetails.setText('') self.IDC_listRessources.clear() self.IDC_plainTextLink.clear() if new_item is None: return package = new_item.data(Qt.UserRole) self.cur_package = package if package is None: return self.IDC_textDetails.setText( u'{0}\n\n{1}\n{2}\n\n{3}'.format( package.get('notes', 'no notes'), package.get('author', 'no author'), package.get('author_email', 'no author_email'), package.get('license_id', 'no license_id') ) ) if package.get('num_resources', 0) > 0: for res in package['resources']: item = QListWidgetItem(u'{0}: {1}'.format( res.get('format', 'no format') , res.get('name', 'no name') )) item.setData(Qt.UserRole, res) item.setCheckState(Qt.Unchecked) self.IDC_listRessources.addItem(item)
def refreshAnnotations(self): for annotation in self.getAnnotations(): if annotation not in self.annotations: self.annotations.append(annotation) self.annotationsName.append('Annotation') i = 0 to_del = [] for annotation in self.annotations: if annotation not in self.getAnnotations(): to_del.append(i) i += 1 i = 0 for index in to_del: self.annotations.pop(index) self.annotationsName.pop(index) self.annotationList.clearSelection() self.annotationList.clear() # argh for annotation in self.annotations: item = QListWidgetItem(self.annotationsName[i]) if annotation.isVisible(): item.setCheckState(Qt.Checked) else: item.setCheckState(Qt.Unchecked) item.setFlags(item.flags() | Qt.ItemIsEditable) self.annotationList.addItem(item) i += 1
def __init__(self, opPixelClassification, parent): super(QDialog, self).__init__(parent=parent) self._op = opPixelClassification classifier_listwidget = QListWidget(parent=self) classifier_listwidget.setSelectionMode(QListWidget.SingleSelection) classifer_factories = self._get_available_classifier_factories() for name, classifier_factory in classifer_factories.items(): item = QListWidgetItem(name) item.setData(Qt.UserRole, QVariant(classifier_factory)) classifier_listwidget.addItem(item) buttonbox = QDialogButtonBox(Qt.Horizontal, parent=self) buttonbox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) layout = QVBoxLayout() layout.addWidget(classifier_listwidget) layout.addWidget(buttonbox) self.setLayout(layout) self.setWindowTitle("Select Classifier Type") # Save members self._classifier_listwidget = classifier_listwidget
def set_widgets(self): """Set all widgets on the tab.""" contacts = Contact.get_rows() for contact in contacts: contact_name = contact.name contact_email = ' - ' + contact.email if contact.email else '' contact_phone = ' - ' + contact.phone if contact.phone else '' contact_item = QListWidgetItem(contact_name + contact_email + contact_phone) contact_item.setData(Qt.UserRole, contact) self.project_contact_list.addItem(contact_item) self.project_contact_list.setSelectionMode( QAbstractItemView.ExtendedSelection) icon_path = resources_path('images', 'throbber.gif') movie = QMovie(icon_path) self.throbber_loader.setMovie(movie) movie.start() self.get_available_organisations() self.organisation_box.setFocus() self.project_description_text.setTabChangesFocus(True)
def set_widgets(self): """Set widgets on the Hazard Category tab.""" self.clear_further_steps() # Set widgets self.lstHazardCategories.clear() self.lblDescribeHazardCategory.setText('') self.lblSelectHazardCategory.setText(hazard_category_question) hazard_categories = self.hazard_categories_for_layer() for hazard_category in hazard_categories: if not isinstance(hazard_category, dict): hazard_category = definition(hazard_category) item = QListWidgetItem(hazard_category['name'], self.lstHazardCategories) item.setData(QtCore.Qt.UserRole, hazard_category['key']) self.lstHazardCategories.addItem(item) # Set values based on existing keywords (if already assigned) category_keyword = self.parent.get_existing_keyword('hazard_category') if category_keyword: categories = [] for index in xrange(self.lstHazardCategories.count()): item = self.lstHazardCategories.item(index) categories.append(item.data(QtCore.Qt.UserRole)) if category_keyword in categories: self.lstHazardCategories.setCurrentRow( categories.index(category_keyword)) self.auto_select_one_item(self.lstHazardCategories)
def feel_list(self): self.lstServices.clear() ds_list = DataSourcesList(USER_DS_PATHS) for ds in ds_list.data_sources.itervalues(): item = QListWidgetItem(ds.action.icon(), ds.action.text()) item.setData(Qt.UserRole, ds) self.lstServices.addItem(item)
def __init__(self, workspace, documents): super(_UISaveFiles, self).__init__(workspace) self.cancelled = False uic.loadUi(os.path.join(DATA_FILES_PATH, 'ui/SaveFiles.ui'), self) self.buttonBox.clicked.connect(self._onButtonClicked) self._itemToDocument = {} for document in documents: name = document.fileName() if name is None: name = 'untitled' item = QListWidgetItem( name, self.listWidget ) if document.filePath() is not None: item.setToolTip( document.filePath() ) item.setCheckState( Qt.Checked ) self._itemToDocument[item] = document # Retitle buttons, add first letter shortcuts for them. bb = self.buttonBox self._shortcut = ( self._firstLetterShortcut(bb.Discard, 'close &Without saving'), self._firstLetterShortcut(bb.Cancel, '&Cancel close'), self._firstLetterShortcut(bb.Save, '&Save checked') ) self.buttonBox.button(QDialogButtonBox.Cancel).setFocus()
def set_widgets(self): """Set widgets on the Classification tab.""" self.clear_further_steps() purpose = self.parent.step_kw_purpose.selected_purpose()['name'] subcategory = self.parent.step_kw_subcategory.\ selected_subcategory()['name'] self.lstClassifications.clear() self.lblDescribeClassification.setText('') self.lblSelectClassification.setText(classification_question % (subcategory, purpose)) classifications = self.classifications_for_layer() for classification in classifications: if not isinstance(classification, dict): classification = definition(classification) item = QListWidgetItem(classification['name'], self.lstClassifications) item.setData(QtCore.Qt.UserRole, classification['key']) self.lstClassifications.addItem(item) # Set values based on existing keywords (if already assigned) classification_keyword = self.parent.get_existing_keyword( 'classification') if classification_keyword: classifications = [] for index in xrange(self.lstClassifications.count()): item = self.lstClassifications.item(index) classifications.append(item.data(QtCore.Qt.UserRole)) if classification_keyword in classifications: self.lstClassifications.setCurrentRow( classifications.index(classification_keyword)) self.auto_select_one_item(self.lstClassifications)
def onTestDoucleClicked(self, testItem): """ On tests double clicked """ if testItem.type() != QTreeWidgetItem.UserType+0: return self.okButton.setEnabled(True) currentProject = self.prjCombo.currentText() testName = "%s:%s" % (str(currentProject),testItem.getPath(withFileName = True)) testItem = QListWidgetItem(testName ) if testName.endswith(self.rRepo.EXTENSION_TUX): testItem.setIcon(QIcon(":/tux.png")) if testName.endswith(self.rRepo.EXTENSION_TSX): testItem.setIcon(QIcon(":/tsx.png")) if testName.endswith(self.rRepo.EXTENSION_TPX): testItem.setIcon(QIcon(":/tpx.png")) if testName.endswith(self.rRepo.EXTENSION_TGX): testItem.setIcon(QIcon(":/tgx.png")) if testName.endswith(self.rRepo.EXTENSION_TAX): testItem.setIcon(QIcon(":/tax.png")) self.testsList.addItem( testItem )
def FillSurveys(self): self.AS=AllSurveys(self.ODB) FullName=self.AS.GetCombo() for fn in FullName: item=QListWidgetItem(fn) self.AvailSurveys.addItem(item) self.AvailSurveys.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
def populate_field_list(self, excluded_fields=None): """Helper to add field of the layer to the list. :param excluded_fields: List of field that want to be excluded. :type excluded_fields: list """ # Populate fields list if excluded_fields is None: excluded_fields = [] self.field_list.clear() for field in self.layer.dataProvider().fields(): # Skip if it's excluded if field.name() in excluded_fields: continue # Skip if it's not number (float, int, etc) if field.type() not in qvariant_numbers: continue field_item = QListWidgetItem(self.field_list) field_item.setFlags( Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsDragEnabled) field_item.setData(Qt.UserRole, field.name()) field_item.setText(field.name()) self.field_list.addItem(field_item)