def populateEditor(self): self.blockSignals(True) self.clear() if self.profile is None: return for row, key in enumerate(sorted(self.editorData.keys())): item = FeatureTreeWidgetItem([key, self.profile[self.editorData[key]]], PrmItemTypes.ProfileItemType) item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable) item.setFeatureId(0, self.profile.id()) self.addTopLevelItem(item) self.blockSignals(False)
def populateEditor(self): self.blockSignals(True) self.clear() for river in self.model.river_layer().iter_features(): river_item = FeatureTreeWidgetItem([river.name, '%.1f - %.1f' % river.station_range], PrmItemTypes.RiverItemType) river_item.setFeatureId(0, river.id()) font = river_item.font(0) font.setBold(True) river_item.setFont(0, font) for profile in river: profile_item = FeatureTreeWidgetItem([profile.name, profile.river_station], PrmItemTypes.ProfileItemType) profile_item.setFeatureId(0, profile.id()) profile_item.setBackgroundColor(0, self.PROFILE_COLOR[profile.profile_type]) river_item.addChild(profile_item) self.addTopLevelItem(river_item) self.blockSignals(False)