def updateSelectedFields (self ): # update selected fields layName = unicode( self.settingsDialog.cmbLayers.currentText() ) vLayer = gettings.getVectorLayerByName( layName ) lstFields = vLayer.pendingFields() #lstIndex = dict([(field.name(), index) for index, field in lstFields.iteritems()]) #lstFields = vLayer.dataProvider().fields() myfields = self.settingsDialog.ltbFields self.settingsDialog.tabSelectedFields.clear() self.settingsDialog.tabSelectedFields.setRowCount(0) for i in range(len(myfields)): #for i in range(len(lstIndex)): if myfields.item(i).isSelected() == True: date=re.findall(r'\d+',lstFields[i].name()) if len(date)!=1: QtGui.QMessageBox.warning(None,'Error','Warning : there is no date information for this attribute !') for u in range(len(date)): layerName=lstFields[i].name() sdate=date[u] self.addRowToOptionsTable(layerName,sdate) self.settingsDialog.tabSelectedFields.sortItems(1,order = Qt.AscendingOrder) n=self.settingsDialog.tabSelectedFields.rowCount() self.dock.timeSlide.setMinimum(0) self.dock.timeSlide.setMaximum(n-1) # Selected fields table headers item1 = QtGui.QTableWidgetItem() item1.setText(QtGui.QApplication.translate("settings", "Fields", None, QtGui.QApplication.UnicodeUTF8)) self.settingsDialog.tabSelectedFields.setHorizontalHeaderItem(0, item1) item2 = QtGui.QTableWidgetItem() item2.setText(QtGui.QApplication.translate("settings", "Date", None, QtGui.QApplication.UnicodeUTF8)) self.settingsDialog.tabSelectedFields.setHorizontalHeaderItem(1, item2)
def showModelist(self): layName = unicode( self.settingsDialog.cmbLayers.currentText() ) vLayer=gettings.getVectorLayerByName(layName) self.settingsDialog.cmbMode.clear() self.settingsDialog.cmbMode.addItem( "Mode" ) if vLayer.isUsingRendererV2(): # new symbology - subclass of QgsFeatureRendererV2 class lstModes = ["EqualInterval", "Quantiles", "Jenks", "StdDev" ,"Pretty"] else: # old symbology - subclass of QgsRenderer class lstModes = ["EqualInterval", "Quantiles", "Empty"] #fill the mode combobox self.settingsDialog.cmbMode.addItems( lstModes )
def showModelist(self): layName = unicode(self.settingsDialog.cmbLayers.currentText()) vLayer = gettings.getVectorLayerByName(layName) self.settingsDialog.cmbMode.clear() self.settingsDialog.cmbMode.addItem("Mode") if vLayer.isUsingRendererV2(): # new symbology - subclass of QgsFeatureRendererV2 class lstModes = [ "EqualInterval", "Quantiles", "Jenks", "StdDev", "Pretty" ] else: # old symbology - subclass of QgsRenderer class lstModes = ["EqualInterval", "Quantiles", "Empty"] #fill the mode combobox self.settingsDialog.cmbMode.addItems(lstModes)
def selectedField(self): layName = unicode(self.settingsDialog.cmbLayers.currentText()) if layName != "Layers": vLayer = gettings.getVectorLayerByName(layName) else: vLayer = self.iface.mapCanvas().currentLayer() u = self.dock.timeSlide.value() fieldName = self.settingsDialog.tabSelectedFields.item(u, 0) date = self.settingsDialog.tabSelectedFields.item(u, 1) if self.settingsDialog.tabSelectedFields.rowCount() != 0: self.dock.labelDate.setText(date.text()) if self.settingsDialog.ccbAbsolu.isChecked(): # absolu discretization self.absolu(vLayer, fieldName.text()) else: #relative discretization self.ApplyClicked(vLayer, fieldName.text()) self.dock.timeSlide.setPageStep(1)
def selectedField(self): layName = unicode( self.settingsDialog.cmbLayers.currentText() ) if layName != "Layers": vLayer = gettings.getVectorLayerByName( layName ) else: vLayer=self.iface.mapCanvas().currentLayer() u=self.dock.timeSlide.value() fieldName=self.settingsDialog.tabSelectedFields.item(u,0) date=self.settingsDialog.tabSelectedFields.item(u,1) if self.settingsDialog.tabSelectedFields.rowCount()!=0: self.dock.labelDate.setText(date.text()) if self.settingsDialog.ccbAbsolu.isChecked(): # absolu discretization self.absolu(vLayer,fieldName.text()) else: #relative discretization self.ApplyClicked(vLayer,fieldName.text()) self.dock.timeSlide.setPageStep(1)
def updateFields( self ): layName = unicode( self.settingsDialog.cmbLayers.currentText() ) self.settingsDialog.ltbFields.clear() if layName != "Layers": self.showModelist() vLayer = gettings.getVectorLayerByName( layName ) # Modif RC ici lstFields = vLayer.pendingFields() #proFields = vLayer.dataProvider().fields() for i in lstFields: self.settingsDialog.ltbFields.addItem( unicode( lstFields[i].name() ) ) #Joined fields control for absolute discretization if len(lstFields.items()) > vLayer.dataProvider().fieldCount(): self.settingsDialog.ccbAbsolu.setVisible(0) self.settingsDialog.ccbAbsolu.setChecked(0) else: self.settingsDialog.ccbAbsolu.setVisible(1) self.settingsDialog.ccbAbsolu.setChecked(0)
def updateFields(self): layName = unicode(self.settingsDialog.cmbLayers.currentText()) self.settingsDialog.ltbFields.clear() if layName != "Layers": self.showModelist() vLayer = gettings.getVectorLayerByName(layName) # Modif RC ici lstFields = vLayer.pendingFields() #proFields = vLayer.dataProvider().fields() for i in lstFields: self.settingsDialog.ltbFields.addItem( unicode(lstFields[i].name())) #Joined fields control for absolute discretization if len(lstFields.items()) > vLayer.dataProvider().fieldCount(): self.settingsDialog.ccbAbsolu.setVisible(0) self.settingsDialog.ccbAbsolu.setChecked(0) else: self.settingsDialog.ccbAbsolu.setVisible(1) self.settingsDialog.ccbAbsolu.setChecked(0)
def updateSelectedFields(self): # update selected fields layName = unicode(self.settingsDialog.cmbLayers.currentText()) vLayer = gettings.getVectorLayerByName(layName) lstFields = vLayer.pendingFields() #lstIndex = dict([(field.name(), index) for index, field in lstFields.iteritems()]) #lstFields = vLayer.dataProvider().fields() myfields = self.settingsDialog.ltbFields self.settingsDialog.tabSelectedFields.clear() self.settingsDialog.tabSelectedFields.setRowCount(0) for i in range(len(myfields)): #for i in range(len(lstIndex)): if myfields.item(i).isSelected() == True: date = re.findall(r'\d+', lstFields[i].name()) if len(date) != 1: QtGui.QMessageBox.warning( None, 'Error', 'Warning : there is no date information for this attribute !' ) for u in range(len(date)): layerName = lstFields[i].name() sdate = date[u] self.addRowToOptionsTable(layerName, sdate) self.settingsDialog.tabSelectedFields.sortItems( 1, order=Qt.AscendingOrder) n = self.settingsDialog.tabSelectedFields.rowCount() self.dock.timeSlide.setMinimum(0) self.dock.timeSlide.setMaximum(n - 1) # Selected fields table headers item1 = QtGui.QTableWidgetItem() item1.setText( QtGui.QApplication.translate("settings", "Fields", None, QtGui.QApplication.UnicodeUTF8)) self.settingsDialog.tabSelectedFields.setHorizontalHeaderItem(0, item1) item2 = QtGui.QTableWidgetItem() item2.setText( QtGui.QApplication.translate("settings", "Date", None, QtGui.QApplication.UnicodeUTF8)) self.settingsDialog.tabSelectedFields.setHorizontalHeaderItem(1, item2)