[QGIS Commit] r13477 - trunk/qgis/python/plugins/fTools/tools
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu May 13 18:42:44 EDT 2010
Author: cfarmer
Date: 2010-05-13 18:42:42 -0400 (Thu, 13 May 2010)
New Revision: 13477
Modified:
trunk/qgis/python/plugins/fTools/tools/doVectorSplit.py
Log:
now supports fields containing Cyrillics. Fixes #2566. Patch from alexbruy
Modified: trunk/qgis/python/plugins/fTools/tools/doVectorSplit.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/doVectorSplit.py 2010-05-13 21:01:35 UTC (rev 13476)
+++ trunk/qgis/python/plugins/fTools/tools/doVectorSplit.py 2010-05-13 22:42:42 UTC (rev 13477)
@@ -45,6 +45,7 @@
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
self.setWindowTitle(self.tr("Split vector layer"))
+ self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
# populate layer list
self.progressBar.setValue(0)
mapCanvas = self.iface.mapCanvas()
@@ -59,6 +60,7 @@
self.inField.addItem(unicode(changedField[i].name()))
def accept(self):
+ self.buttonOk.setEnabled( False )
if self.inShape.currentText() == "":
QMessageBox.information(self, self.tr("Vector Split"), self.tr("No input shapefile specified"))
elif self.outShape.text() == "":
@@ -77,70 +79,15 @@
self.progressBar.setValue(100)
self.outShape.clear()
QMessageBox.information(self, self.tr("Vector Split"), self.tr("Created output shapefiles in folder:\n%1").arg( outPath))
- self.progressBar.setValue(0)
+ self.progressBar.setValue(0)
+ self.buttonOk.setEnabled( True )
def outFile(self):
- fileDialog = QFileDialog()
- settings = QSettings()
- dirName = settings.value("/UI/lastShapefileDir").toString()
- fileDialog.setDirectory(dirName)
- encodingBox = QComboBox()
- l = QLabel("Encoding:",fileDialog)
- fileDialog.layout().addWidget(l)
- fileDialog.layout().addWidget(encodingBox)
- encodingBox.addItem("BIG5")
- encodingBox.addItem("BIG5-HKSCS")
- encodingBox.addItem("EUCJP")
- encodingBox.addItem("EUCKR")
- encodingBox.addItem("GB2312")
- encodingBox.addItem("GBK")
- encodingBox.addItem("GB18030")
- encodingBox.addItem("JIS7")
- encodingBox.addItem("SHIFT-JIS")
- encodingBox.addItem("TSCII")
- encodingBox.addItem("UTF-8")
- encodingBox.addItem("UTF-16")
- encodingBox.addItem("KOI8-R")
- encodingBox.addItem("KOI8-U")
- encodingBox.addItem("ISO8859-1")
- encodingBox.addItem("ISO8859-2")
- encodingBox.addItem("ISO8859-3")
- encodingBox.addItem("ISO8859-4")
- encodingBox.addItem("ISO8859-5")
- encodingBox.addItem("ISO8859-6")
- encodingBox.addItem("ISO8859-7")
- encodingBox.addItem("ISO8859-8")
- encodingBox.addItem("ISO8859-8-I")
- encodingBox.addItem("ISO8859-9")
- encodingBox.addItem("ISO8859-10")
- encodingBox.addItem("ISO8859-13")
- encodingBox.addItem("ISO8859-14")
- encodingBox.addItem("ISO8859-15")
- encodingBox.addItem("IBM 850")
- encodingBox.addItem("IBM 866")
- encodingBox.addItem("CP874")
- encodingBox.addItem("CP1250")
- encodingBox.addItem("CP1251")
- encodingBox.addItem("CP1252")
- encodingBox.addItem("CP1253")
- encodingBox.addItem("CP1254")
- encodingBox.addItem("CP1255")
- encodingBox.addItem("CP1256")
- encodingBox.addItem("CP1257")
- encodingBox.addItem("CP1258")
- encodingBox.addItem("Apple Roman")
- encodingBox.addItem("TIS-620")
- encodingBox.setItemText(encodingBox.currentIndex(), QString(QTextCodec.codecForLocale().name()))
- fileDialog.setAcceptMode(QFileDialog.AcceptSave)
- fileDialog.setFileMode(QFileDialog.DirectoryOnly)
- fileDialog.setConfirmOverwrite(False)
- if not fileDialog.exec_() == 1:
- return
- folders = fileDialog.selectedFiles()
- self.folderName = unicode(folders.first())
- self.encoding = unicode(encodingBox.currentText())
self.outShape.clear()
- self.outShape.insert(self.folderName)
+ ( self.shapefileName, self.encoding ) = ftools_utils.saveDialog( self )
+ if self.shapefileName is None or self.encoding is None:
+ return
+ self.outShape.setText( QString( self.shapefileName ) )
def split(self, vlayer, outPath, inField, progressBar):
provider = vlayer.dataProvider()
@@ -148,7 +95,7 @@
index = provider.fieldNameIndex(inField)
#provider.uniqueValues(index, unique)
unique = ftools_utils.getUniqueValues(vlayer.dataProvider(), int(index))
- baseName = outPath + vlayer.name() + "_" + inField + "_"
+ baseName = unicode( outPath + vlayer.name() + "_" + inField + "_" )
allAttrs = provider.attributeIndexes()
provider.select(allAttrs)
fieldList = ftools_utils.getFieldList(vlayer)
More information about the QGIS-commit
mailing list