From d0aa1e47e80725b3d632044c2cbdd16426cb2ee7 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Wed, 1 May 2013 23:45:20 +0200 Subject: [PATCH] indentation update --- python/console/console.py | 14 +- python/console/console_editor.py | 51 +++---- python/console/console_output.py | 4 +- python/console/console_sci.py | 4 +- python/console/console_settings.py | 22 +-- python/plugins/GdalTools/tools/doRasterize.py | 4 +- python/plugins/sextante/SextantePlugin.py | 18 +-- .../plugins/sextante/algs/ftools/Dissolve.py | 10 +- .../algs/mmqgisx/MMQGISXAlgorithms.py | 2 +- .../sextante/commander/CommanderWindow.py | 96 ++++++------- python/plugins/sextante/core/LayerExporter.py | 8 +- python/plugins/sextante/core/Sextante.py | 10 +- .../plugins/sextante/core/SextanteConfig.py | 4 +- python/plugins/sextante/grass/GrassUtils.py | 10 +- .../sextante/gui/AlgorithmExecutionDialog.py | 4 +- .../plugins/sextante/gui/AlgorithmExecutor.py | 2 +- python/plugins/sextante/gui/ConfigDialog.py | 14 +- .../gui/UnthreadedAlgorithmExecutor.py | 2 +- .../sextante/modeler/ModelerArrowItem.py | 38 ++--- .../plugins/sextante/modeler/ModelerDialog.py | 6 +- .../sextante/modeler/ModelerGraphicItem.py | 135 +++++++++--------- .../ModelerParameterDefinitionDialog.py | 6 +- .../plugins/sextante/modeler/ModelerScene.py | 4 +- python/plugins/sextante/otb/OTBUtils.py | 8 +- python/plugins/sextante/saga/SagaUtils.py | 6 +- src/app/qgisappinterface.cpp | 44 +++--- src/app/qgisappinterface.h | 2 +- src/app/qgsmaptoolcapture.cpp | 2 +- src/core/diagram/qgshistogramdiagram.cpp | 2 +- src/core/qgscacheindexfeatureid.cpp | 4 +- src/core/qgscoordinatereferencesystem.cpp | 38 ++--- src/core/qgscoordinatereferencesystem.h | 4 +- src/core/qgsdistancearea.cpp | 12 +- src/core/qgsmaplayerregistry.h | 4 +- src/core/qgsproject.cpp | 2 +- src/core/qgsvectorlayercache.h | 2 +- src/core/qgsvectorlayerfeatureiterator.cpp | 2 +- src/core/raster/qgsrasterfilewriter.h | 2 +- src/gui/attributetable/qgsdualview.cpp | 4 +- src/gui/attributetable/qgsdualview.h | 4 +- src/gui/qgsprojectionselector.cpp | 12 +- src/gui/qgsrubberband.cpp | 8 +- src/mapserver/qgsprojectparser.cpp | 66 ++++----- src/mapserver/qgssldparser.cpp | 12 +- src/mapserver/qgswfsserver.cpp | 8 +- .../qgsdelimitedtextfeatureiterator.cpp | 4 +- .../delimitedtext/qgsdelimitedtextfile.cpp | 2 +- .../qgsdelimitedtextprovider.cpp | 56 ++++---- .../delimitedtext/qgsdelimitedtextprovider.h | 2 +- .../qgsdelimitedtextsourceselect.cpp | 14 +- src/providers/grass/qgsgrassgislib.cpp | 12 +- .../spatialite/qgsspatialiteprovider.cpp | 12 +- .../sqlanywhere/qgssqlanywhereprovider.cpp | 12 +- tests/src/core/testqgsblendmodes.cpp | 20 +-- tests/src/core/testqgsvectorlayercache.cpp | 2 +- tests/src/core/testziplayer.cpp | 6 +- tests/src/gui/testqgsrubberband.cpp | 2 +- tests/src/python/test_qgscomposereffects.py | 8 +- tests/src/python/test_qgscomposermap.py | 4 +- .../python/test_qgsdelimitedtextprovider.py | 28 ++-- 60 files changed, 450 insertions(+), 450 deletions(-) mode change 100755 => 100644 tests/src/core/testziplayer.cpp diff --git a/python/console/console.py b/python/console/console.py index c849b87a3b64..7ee324cf9686 100644 --- a/python/console/console.py +++ b/python/console/console.py @@ -109,22 +109,22 @@ def __init__(self, parent=None): self.splitter.addWidget(self.shellOut) self.splitter.addWidget(self.shell) #self.splitterEditor.addWidget(self.tabEditorWidget) - + self.splitterObj = QSplitter(self.splitterEditor) self.splitterObj.setHandleWidth(3) self.splitterObj.setOrientation(Qt.Horizontal) #self.splitterObj.setSizes([0, 0]) #self.splitterObj.setStretchFactor(0, 1) - + self.widgetEditor = QWidget(self.splitterObj) - + self.listClassMethod = QTreeWidget(self.splitterObj) self.listClassMethod.setColumnCount(2) self.listClassMethod.setHeaderLabels(['Object', 'Line']) self.listClassMethod.setColumnHidden(1, True) self.listClassMethod.setAlternatingRowColors(True) - + #self.splitterEditor.addWidget(self.widgetEditor) #self.splitterObj.addWidget(self.listClassMethod) #self.splitterObj.addWidget(self.widgetEditor) @@ -528,7 +528,7 @@ def uncommentCode(self): # if line != "\n": # listScriptFile.append(line) # self.shell.insertTextFromFile(listScriptFile) -# +# # lastDirPath = QFileInfo(scriptFile).path() # settings.setValue("pythonConsole/lastDirPath", QVariant(scriptFile)) # @@ -538,7 +538,7 @@ def uncommentCode(self): # scriptFile.setDefaultSuffix(".py") # fName = scriptFile.getSaveFileName( # self, "Save file", QString(), "Script file (*.py)") -# +# # if fName.isEmpty() == False: # filename = str(fName) # if not filename.endswith(".py"): @@ -616,7 +616,7 @@ def callWidgetMessageBar(self, text): def callWidgetMessageBarEditor(self, text, level, timed): self.tabEditorWidget.widgetMessageBar(iface, text, level, timed) - def updateTabListScript(self, script, action=None): + def updateTabListScript(self, script, action=None): if script != '': settings = QSettings() if script == 'empty': diff --git a/python/console/console_editor.py b/python/console/console_editor.py index b6647cafc88a..e3ec5ea4e557 100644 --- a/python/console/console_editor.py +++ b/python/console/console_editor.py @@ -64,12 +64,12 @@ def get_handler(self, key, modifier): if modifiers == modifier: return handler return None - + def eventFilter(self, obj, event): if event.type() == QEvent.KeyPress and event.key() < 256: handler = self.get_handler(event.key(), event.modifiers()) if handler: - handler(self.window, self.tab) + handler(self.window, self.tab) return QObject.eventFilter(self, obj, event) class Editor(QsciScintilla): @@ -127,12 +127,12 @@ def __init__(self, parent=None): #self.setWrapMode(QsciScintilla.WrapCharacter) self.setWhitespaceVisibility(QsciScintilla.WsVisibleAfterIndent) #self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0) - + self.settingsEditor() - + # Annotations #self.setAnnotationDisplay(QsciScintilla.ANNOTATION_BOXED) - + # Indentation self.setAutoIndent(True) self.setIndentationsUseTabs(False) @@ -161,7 +161,7 @@ def __init__(self, parent=None): self.runScriptScut = QShortcut(QKeySequence(Qt.SHIFT + Qt.CTRL + Qt.Key_E), self) self.runScriptScut.setContext(Qt.WidgetShortcut) self.runScriptScut.activated.connect(self.runScriptCode) - + self.commentScut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_3), self) self.commentScut.setContext(Qt.WidgetShortcut) self.commentScut.activated.connect(self.parent.pc.commentCode) @@ -295,8 +295,8 @@ def contextMenuEvent(self, e): menu.addSeparator() commentCodeAction = menu.addAction(iconCommentEditor, "Comment", self.parent.pc.commentCode, 'Ctrl+3') - uncommentCodeAction = menu.addAction(iconUncommentEditor, "Uncomment", - self.parent.pc.uncommentCode, + uncommentCodeAction = menu.addAction(iconUncommentEditor, "Uncomment", + self.parent.pc.uncommentCode, 'Shift+Ctrl+3') menu.addSeparator() codePadAction = menu.addAction(iconCodePad, @@ -391,7 +391,7 @@ def commentEditorCode(self, commentCheck): else: if not self.text(line).trimmed().startsWith('#'): continue - self.setSelection(line, self.indentation(line), + self.setSelection(line, self.indentation(line), line, self.indentation(line) + 1) self.removeSelectedText() else: @@ -401,11 +401,11 @@ def commentEditorCode(self, commentCheck): else: if not self.text(line).trimmed().startsWith('#'): return - self.setSelection(line, self.indentation(line), + self.setSelection(line, self.indentation(line), line, self.indentation(line) + 1) self.removeSelectedText() self.endUndoAction() - + def createTempFile(self): import tempfile fd, path = tempfile.mkstemp() @@ -423,10 +423,10 @@ def _runSubProcess(self, filename, tmp=False): try: ## set creationflags for runnning command without shell window if sys.platform.startswith('win'): - p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE, + p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, creationflags=0x08000000) else: - p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE, + p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE) out, _traceback = p.communicate() @@ -465,13 +465,14 @@ def _runSubProcess(self, filename, tmp=False): def runScriptCode(self): autoSave = self.settings.value("pythonConsole/autoSaveScript").toBool() - + tabWidget = self.parent.tw.currentWidget() + filename = tabWidget.path - - msgEditorBlank = QCoreApplication.translate('PythonConsole', + + msgEditorBlank = QCoreApplication.translate('PythonConsole', 'Hey, type something for running !') - msgEditorUnsaved = QCoreApplication.translate('PythonConsole', + msgEditorUnsaved = QCoreApplication.translate('PythonConsole', 'You have to save the file before running.') if not autoSave: if filename is None: @@ -500,7 +501,7 @@ def getTextFromEditor(self): text = self.text() textList = text.split("\n") return textList - + def goToLine(self, objName, linenr): self.SendScintilla(QsciScintilla.SCI_GOTOLINE, linenr-1) self.SendScintilla(QsciScintilla.SCI_SETTARGETSTART, self.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)) @@ -552,7 +553,7 @@ def __init__(self, parent, parentConsole, filename, *args): self.newEditor = Editor(self) if filename: self.path = filename - if os.path.exists(filename): + if os.path.exists(filename) self.loadFile(filename, False) # Creates layout for message bar @@ -589,7 +590,7 @@ def loadFile(self, filename, modified): def save(self): if self.path is None: - self.path = str(QFileDialog().getSaveFileName(self, + self.path = str(QFileDialog().getSaveFileName(self, "Python Console: Save file", "*.py", "Script file (*.py)")) @@ -597,7 +598,7 @@ def save(self): if len(self.path) == 0: self.path = None return - msgText = QCoreApplication.translate('PythonConsole', + msgText = QCoreApplication.translate('PythonConsole', 'Script was correctly saved.') self.pc.callWidgetMessageBarEditor(msgText, 0, True) # Rename the original file, if it exists @@ -706,9 +707,9 @@ def __init__(self, parent): # Menu button list tabs self.fileTabMenu = QMenu(self) - self.connect(self.fileTabMenu, SIGNAL("aboutToShow()"), + self.connect(self.fileTabMenu, SIGNAL("aboutToShow()"), self.showFileTabMenu) - self.connect(self.fileTabMenu, SIGNAL("triggered(QAction*)"), + self.connect(self.fileTabMenu, SIGNAL("triggered(QAction*)"), self.showFileTabMenuTriggered) self.fileTabButton = QToolButton(self) self.fileTabButton.setToolTip('List all tabs') @@ -782,7 +783,7 @@ def _removeTab(self, tab, tab2index=False): tab = self.indexOf(tab) if self.widget(tab).newEditor.isModified(): res = QMessageBox.question( self, 'Python Console: Save File', - 'The file "%s" has been modified, save changes ?' + 'The file "%s" has been modified, save changes ?' % self.tabText(tab), QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel ) if res == QMessageBox.Save: @@ -920,7 +921,7 @@ def listObject(self, tab): s = traceback.format_exc() print '## Error: ' sys.stderr.write(s) - + def refreshSettingsEditor(self): countTab = self.count() for i in range(countTab): diff --git a/python/console/console_output.py b/python/console/console_output.py index aaba5996d703..be9d9c2ac722 100644 --- a/python/console/console_output.py +++ b/python/console/console_output.py @@ -128,7 +128,7 @@ def __init__(self, parent=None): self.selectAllShortcut.activated.connect(self.selectAll) def insertInitText(self): - txtInit = QCoreApplication.translate("PythonConsole", + txtInit = QCoreApplication.translate("PythonConsole", "Python %1 on %2\n" "## Type help(iface) for more info and list of methods.\n").arg(sys.version, socket.gethostname()) initText = self.setText(txtInit) @@ -215,7 +215,7 @@ def hideToolBar(self): def showEditor(self): Ed = self.parent.splitterObj - if not Ed.isVisible(): + if not Ed.isVisible(): Ed.show() self.parent.showEditorButton.setChecked(True) self.shell.setFocus() diff --git a/python/console/console_sci.py b/python/console/console_sci.py index 367279f4753e..c090d643eba0 100644 --- a/python/console/console_sci.py +++ b/python/console/console_sci.py @@ -160,7 +160,7 @@ def commandConsole(self, command): def setLexers(self): self.lexer = QsciLexerPython() - + loadFont = self.settings.value("pythonConsole/fontfamilytext", "Monospace").toString() fontSize = self.settings.value("pythonConsole/fontsize", 10).toInt()[0] @@ -514,7 +514,7 @@ def runCommand(self, cmd): more = self.runsource(src, "") if not more: self.buffer = [] - ## prevents to commands with more lines to break the console + ## prevents to commands with more lines to break the console ## in the case they have a eol different from '\n' self.setText('') self.move_cursor_to_end() diff --git a/python/console/console_settings.py b/python/console/console_settings.py index b6621fc0fb46..c3d083aba65a 100644 --- a/python/console/console_settings.py +++ b/python/console/console_settings.py @@ -64,7 +64,7 @@ def enableDisable(self, value): self.tableWidget.setEnabled(value) self.addAPIpath.setEnabled(value) self.removeAPIpath.setEnabled(value) - + def autoCompletionOptions(self): if self.autoCompleteEnabled.isChecked(): self.enableDisableAutoCompleteOptions(True) @@ -144,32 +144,32 @@ def saveSettings(self): settings.setValue("pythonConsole/fontfamilyindex", QVariant(fontFamilyIndex)) fontFamilyText = self.fontComboBox.currentText() settings.setValue("pythonConsole/fontfamilytext", QVariant(fontFamilyText)) - + fontFamilyIndexEditor = self.fontComboBoxEditor.currentIndex() settings.setValue("pythonConsole/fontfamilyindexEditor", QVariant(fontFamilyIndexEditor)) fontFamilyTextEditor = self.fontComboBoxEditor.currentText() settings.setValue("pythonConsole/fontfamilytextEditor", QVariant(fontFamilyTextEditor)) - + fontSize = self.spinBox.value() fontSizeEditor = self.spinBoxEditor.value() - + for i in range(0, self.tableWidget.rowCount()): text = self.tableWidget.item(i, 1).text() self.listPath.append(text) settings.setValue("pythonConsole/fontsize", QVariant(fontSize)) settings.setValue("pythonConsole/fontsizeEditor", QVariant(fontSizeEditor)) settings.setValue("pythonConsole/userAPI", QVariant(self.listPath)) - + settings.setValue("pythonConsole/autoCompThreshold", QVariant(self.autoCompThreshold.value())) settings.setValue("pythonConsole/autoCompThresholdEditor", QVariant(self.autoCompThresholdEditor.value())) - + if self.autoCompFromAPIEditor.isChecked(): settings.setValue("pythonConsole/autoCompleteSourceEditor", QVariant('fromAPI')) elif self.autoCompFromDocEditor.isChecked(): settings.setValue("pythonConsole/autoCompleteSourceEditor", QVariant('fromDoc')) elif self.autoCompFromDocAPIEditor.isChecked(): settings.setValue("pythonConsole/autoCompleteSourceEditor", QVariant('fromDocAPI')) - + if self.autoCompFromAPI.isChecked(): settings.setValue("pythonConsole/autoCompleteSource", QVariant('fromAPI')) elif self.autoCompFromDoc.isChecked(): @@ -198,20 +198,20 @@ def restoreSettings(self): self.tableWidget.horizontalHeader().show() self.tableWidget.horizontalHeader().setResizeMode(1, QHeaderView.Stretch) self.autoSaveScript.setChecked(settings.value("pythonConsole/autoSaveScript", False).toBool()) - + self.autoCompThreshold.setValue(settings.value("pythonConsole/autoCompThreshold", 2).toInt()[0]) self.autoCompThresholdEditor.setValue(settings.value("pythonConsole/autoCompThresholdEditor", 2).toInt()[0]) - + self.autoCompleteEnabledEditor.setChecked(settings.value("pythonConsole/autoCompleteEnabledEditor", True).toBool()) self.autoCompleteEnabled.setChecked(settings.value("pythonConsole/autoCompleteEnabled", True).toBool()) - + if settings.value("pythonConsole/autoCompleteSource") == 'fromDoc': self.autoCompFromDoc.setChecked(True) elif settings.value("pythonConsole/autoCompleteSource") == 'fromAPI': self.autoCompFromAPI.setChecked(True) elif settings.value("pythonConsole/autoCompleteSource") == 'fromDocAPI': self.autoCompFromDocAPI.setChecked(True) - + if settings.value("pythonConsole/autoCompleteSourceEditor") == 'fromDoc': self.autoCompFromDocEditor.setChecked(True) elif settings.value("pythonConsole/autoCompleteSourceEditor") == 'fromAPI': diff --git a/python/plugins/GdalTools/tools/doRasterize.py b/python/plugins/GdalTools/tools/doRasterize.py index 84952b565f89..ba46ac98ef8f 100644 --- a/python/plugins/GdalTools/tools/doRasterize.py +++ b/python/plugins/GdalTools/tools/doRasterize.py @@ -106,7 +106,7 @@ def fillOutputFileEdit(self): self.outSelector.setFilename(outputFile) - # required either -ts or -tr to create the output file + # required either -ts or -tr to create the output file if gdalVersion >= "1.8.0": if not QFileInfo(outputFile).exists(): QMessageBox.information( self, self.tr( "Output size or resolution required" ), self.tr( "The output file doesn't exist. You must set up the output size or resolution to create it." ) ) @@ -127,7 +127,7 @@ def getArguments(self): arguments << str( self.vertresSpin.value() ) inputFn = self.getInputFileName() if not inputFn.isEmpty(): - arguments << "-l" + arguments << "-l" arguments << QFileInfo( inputFn ).baseName() arguments << inputFn arguments << self.getOutputFileName() diff --git a/python/plugins/sextante/SextantePlugin.py b/python/plugins/sextante/SextantePlugin.py index da1f300a02a9..a7838d0b059f 100644 --- a/python/plugins/sextante/SextantePlugin.py +++ b/python/plugins/sextante/SextantePlugin.py @@ -54,13 +54,13 @@ def __init__(self, iface): Sextante.setInterface(iface) Sextante.setPlugin(self) - def initGui(self): + def initGui(self): self.commander = None self.toolbox = SextanteToolbox(self.iface) self.iface.addDockWidget(Qt.RightDockWidgetArea, self.toolbox) self.toolbox.hide() Sextante.addAlgListListener(self.toolbox) - + self.menu = QMenu(self.iface.mainWindow()) self.menu.setTitle(QCoreApplication.translate("SEXTANTE", "Analysis")) @@ -101,7 +101,7 @@ def initGui(self): self.iface.mainWindow()) self.commanderAction.triggered.connect(self.openCommander) self.menu.addAction(self.commanderAction) - self.iface.registerMainWindowAction(self.commanderAction, "Ctrl+Alt+M") + self.iface.registerMainWindowAction(self.commanderAction, "Ctrl+Alt+M") def unload(self): self.toolbox.setVisible(False) @@ -110,18 +110,18 @@ def unload(self): folder = SextanteUtils.tempFolder() if QDir(folder).exists(): shutil.rmtree(folder, True) - + self.iface.unregisterMainWindowAction(self.commanderAction) - - def openCommander(self): + + def openCommander(self): if self.commander is None: self.commander = CommanderWindow(self.iface.mainWindow(), self.iface.mapCanvas()) Sextante.addAlgListListener(self.commander) self.commander.prepareGui() - self.commander.show() + self.commander.show() #dlg.exec_() - - + + def openToolbox(self): if self.toolbox.isVisible(): self.toolbox.hide() diff --git a/python/plugins/sextante/algs/ftools/Dissolve.py b/python/plugins/sextante/algs/ftools/Dissolve.py index 7a0492204a59..feca3850acdb 100644 --- a/python/plugins/sextante/algs/ftools/Dissolve.py +++ b/python/plugins/sextante/algs/ftools/Dissolve.py @@ -77,7 +77,7 @@ def processAlgorithm(self, progress): tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) ) outFeat.setGeometry( tmpOutGeom ) except: - raise GeoAlgorithmExecutionException("Geometry exception while dissolving") + raise GeoAlgorithmExecutionException("Geometry exception while dissolving") outFeat.setAttributes( attrs ) writer.addFeature( outFeat ) else: @@ -99,14 +99,14 @@ def processAlgorithm(self, progress): outFeat.setGeometry( tmpInGeom ) first = False attrs = inFeat.attributes() - else: + else: tmpInGeom = QgsGeometry( inFeat.geometry() ) - tmpOutGeom = QgsGeometry( outFeat.geometry() ) - try: + tmpOutGeom = QgsGeometry( outFeat.geometry() ) + try: tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) ) outFeat.setGeometry( tmpOutGeom ) except: - raise GeoAlgorithmExecutionException("Geometry exception while dissolving") + raise GeoAlgorithmExecutionException("Geometry exception while dissolving") if add: outFeat.setAttributes( attrs ) writer.addFeature( outFeat ) diff --git a/python/plugins/sextante/algs/mmqgisx/MMQGISXAlgorithms.py b/python/plugins/sextante/algs/mmqgisx/MMQGISXAlgorithms.py index f83e4bf6701b..a128011e3af4 100644 --- a/python/plugins/sextante/algs/mmqgisx/MMQGISXAlgorithms.py +++ b/python/plugins/sextante/algs/mmqgisx/MMQGISXAlgorithms.py @@ -908,7 +908,7 @@ def processAlgorithm(self, progress): spokey = spokepoint.geometry().boundingBox().center().y() spokeid = unicode(spokepoint.attributes()[spokeindex].toString()) progress.setPercentage(float(i) / len(spokepoints) * 100) - # Scan hub points to find first matching hub + # Scan hub points to find first matching hub hubpoints = QGisLayers.features(hublayer) for hubpoint in hubpoints: hubid = unicode(hubpoint.attributes()[hubindex].toString()) diff --git a/python/plugins/sextante/commander/CommanderWindow.py b/python/plugins/sextante/commander/CommanderWindow.py index 83b4740a079e..bcbb2b4559f8 100644 --- a/python/plugins/sextante/commander/CommanderWindow.py +++ b/python/plugins/sextante/commander/CommanderWindow.py @@ -35,22 +35,22 @@ import imp ITEMHEIGHT = 30 -OFFSET = 20 +OFFSET = 20 HEIGHT = 60 class CommanderWindow(QtGui.QDialog): - def __init__(self, parent, canvas): + def __init__(self, parent, canvas): self.canvas = canvas - QtGui.QDialog.__init__(self, parent, Qt.FramelessWindowHint) + QtGui.QDialog.__init__(self, parent, Qt.FramelessWindowHint) #self.setModal(True) - self.commands = imp.load_source("commands", self.commandsFile()) - self.initGui() - - def commandsFolder(self): + self.commands = imp.load_source("commands", self.commandsFile()) + self.initGui() + + def commandsFolder(self): folder = unicode(os.path.join(SextanteUtils.userFolder(), "commander")) mkdir(folder) return os.path.abspath(folder) - + def commandsFile(self): f = os.path.join(self.commandsFolder(), "commands.py") if not os.path.exists(f): @@ -60,18 +60,18 @@ def commandsFile(self): out.write("def removeall():\n") out.write("\tmapreg = QgsMapLayerRegistry.instance()\n") out.write("\tmapreg.removeAllMapLayers()\n\n") - out.write("def load(*args):\n") + out.write("def load(*args):\n") out.write("\tsextante.load(args[0])\n") out.close() - return f - + return f + def algsListHasChanged(self): self.fillCombo() - - def initGui(self): - self.combo= ExtendedComboBox() - self.fillCombo() - + + def initGui(self): + self.combo= ExtendedComboBox() + self.fillCombo() + self.combo.setEditable(True) self.label = QtGui.QLabel("Enter command:") self.errorLabel = QtGui.QLabel("Enter command:") @@ -90,19 +90,19 @@ def initGui(self): self.setLayout(self.vlayout) self.combo.lineEdit().returnPressed.connect(self.run) self.prepareGui() - + def fillCombo(self): self.combo.clear() #add algorithms for providerName in Sextante.algs.keys(): - provider = Sextante.algs[providerName] - algs = provider.values() + provider = Sextante.algs[providerName] + algs = provider.values() for alg in algs: - self.combo.addItem("SEXTANTE algorithm: " + alg.name) + self.combo.addItem("SEXTANTE algorithm: " + alg.name) #add functions for command in dir(self.commands): if isinstance(self.commands.__dict__.get(command), types.FunctionType): - self.combo.addItem("Command: " + command); + self.combo.addItem("Command: " + command); #add menu entries menuActions = [] actions = Sextante.getInterface().mainWindow().menuBar().actions() @@ -110,22 +110,22 @@ def fillCombo(self): menuActions.extend(self.getActions(action)) for action in menuActions: self.combo.addItem("Menu action: " + unicode(action.text())) - - + + def prepareGui(self): self.combo.setEditText("") self.combo.setMaximumSize(QtCore.QSize(self.canvas.rect().width() - 2 * OFFSET, ITEMHEIGHT)) - self.combo.view().setStyleSheet("min-height: 150px") - self.combo.setFocus(Qt.OtherFocusReason) + self.combo.view().setStyleSheet("min-height: 150px") + self.combo.setFocus(Qt.OtherFocusReason) self.label.setMaximumSize(self.combo.maximumSize()) - self.label.setVisible(False) - self.adjustSize() + self.label.setVisible(False) + self.adjustSize() pt = self.canvas.rect().topLeft() absolutePt = self.canvas.mapToGlobal(pt) self.move(absolutePt) self.resize(self.canvas.rect().width(), HEIGHT) self.setStyleSheet("CommanderWindow { background-color: #e7f5fe; border: 1px solid #b9cfe4; }") - + def getActions(self, action): menuActions = [] @@ -133,16 +133,16 @@ def getActions(self, action): if menu is None: menuActions.append(action) return menuActions - else: + else: actions = menu.actions() for subaction in actions: if subaction.menu() is not None: menuActions.extend(self.getActions(subaction)) elif not subaction.isSeparator(): menuActions.append(subaction) - + return menuActions - + def run(self): s = unicode(self.combo.currentText()) if s.startswith("SEXTANTE algorithm: "): @@ -150,16 +150,16 @@ def run(self): alg = Sextante.getAlgorithmFromFullName(algName) if alg is not None: self.close() - self.runAlgorithm(alg) + self.runAlgorithm(alg) elif s.startswith("Command: "): - command = s[len("Command: "):] + command = s[len("Command: "):] try: self.runCommand(command) self.close() except Exception, e: - self.label.setVisible(True) - self.label.setText("Error:" + unicode(e) ) - + self.label.setVisible(True) + self.label.setText("Error:" + unicode(e) ) + elif s.startswith("Menu action: "): actionName = s[len("Menu action: "):] menuActions = [] @@ -169,39 +169,39 @@ def run(self): for action in menuActions: if action.text() == actionName: self.close() - action.trigger() - return + action.trigger() + return else: try: self.runCommand(s) self.close() except Exception, e: - self.label.setVisible(True) + self.label.setVisible(True) self.label.setText("Error:" + unicode(e) ) - + def runCommand(self, command): tokens = command.split(" ") if len(tokens) == 1: method = self.commands.__dict__.get(command) if method is not None: - method() + method() else: raise Exception("Wrong command") else: method = self.commands.__dict__.get(tokens[0]) if method is not None: - method(*tokens[1:]) + method(*tokens[1:]) else: raise Exception("Wrong command") - - - - def runAlgorithm(self, alg): + + + + def runAlgorithm(self, alg): alg = alg.getCopy() message = alg.checkBeforeOpeningParametersDialog() if message: dlg = MissingDependencyDialog(message) - dlg.exec_() + dlg.exec_() return dlg = alg.getCustomParametersDialog() if not dlg: @@ -217,7 +217,7 @@ def runAlgorithm(self, alg): pass canvas.setMapTool(prevMapTool) - + class ExtendedComboBox(QComboBox): def __init__(self, parent=None): super(ExtendedComboBox, self).__init__(parent) diff --git a/python/plugins/sextante/core/LayerExporter.py b/python/plugins/sextante/core/LayerExporter.py index 06c779e56d4b..d3511892f878 100644 --- a/python/plugins/sextante/core/LayerExporter.py +++ b/python/plugins/sextante/core/LayerExporter.py @@ -49,18 +49,18 @@ def exportVectorLayer(layer): It also export to a new file if the original one contains non-ascii characters''' settings = QSettings() systemEncoding = settings.value( "/UI/encoding", "System" ).toString() - + filename = os.path.basename(unicode(layer.source())) idx = filename.rfind(".") if idx != -1: filename = filename[:idx] - + filename = str(layer.name()) validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:" filename = ''.join(c for c in filename if c in validChars) if len(filename) == 0: - filename = "layer" - output = SextanteUtils.getTempFilenameInTempFolder(filename + ".shp") + filename = "layer" + output = SextanteUtils.getTempFilenameInTempFolder(filename + ".shp") provider = layer.dataProvider() useSelection = SextanteConfig.getSetting(SextanteConfig.USE_SELECTED) if useSelection and layer.selectedFeatureCount() != 0: diff --git a/python/plugins/sextante/core/Sextante.py b/python/plugins/sextante/core/Sextante.py index 7a4dde4bf776..9819bc26ec2b 100644 --- a/python/plugins/sextante/core/Sextante.py +++ b/python/plugins/sextante/core/Sextante.py @@ -107,14 +107,14 @@ def getInterface(): @staticmethod def setInterface(iface): Sextante.iface = iface - + @staticmethod def setPlugin(iface): - Sextante.plugin = iface - + Sextante.plugin = iface + @staticmethod def getPlugin(): - return Sextante.plugin + return Sextante.plugin @staticmethod def initialize(): @@ -239,7 +239,7 @@ def getAlgorithm(name): if name in provider: return provider[name] return None - + @staticmethod def getAlgorithmFromFullName(name): for provider in Sextante.algs.values(): diff --git a/python/plugins/sextante/core/SextanteConfig.py b/python/plugins/sextante/core/SextanteConfig.py index 7502cc4b2f9f..cab4e58b62ee 100644 --- a/python/plugins/sextante/core/SextanteConfig.py +++ b/python/plugins/sextante/core/SextanteConfig.py @@ -28,7 +28,7 @@ from PyQt4 import QtGui class SextanteConfig(): - + TABLE_LIKE_PARAM_PANEL = "TABLE_LIKE_PARAM_PANEL" OUTPUT_FOLDER = "OUTPUT_FOLDER" RASTER_STYLE = "RASTER_STYLE" @@ -60,7 +60,7 @@ def initialize(): SextanteConfig.addSetting(Setting("General", SextanteConfig.USE_SELECTED, "Use only selected features", True)) SextanteConfig.addSetting(Setting("General", SextanteConfig.TABLE_LIKE_PARAM_PANEL, "Show table-like parameter panels", False)) SextanteConfig.addSetting(Setting("General", SextanteConfig.USE_FILENAME_AS_LAYER_NAME, "Use filename as layer name", True)) - SextanteConfig.addSetting(Setting("General", SextanteConfig.SHOW_RECENT_ALGORITHMS, "Show recently executed algorithms", True)) + SextanteConfig.addSetting(Setting("General", SextanteConfig.SHOW_RECENT_ALGORITHMS, "Show recently executed algorithms", True)) SextanteConfig.addSetting(Setting("General", SextanteConfig.OUTPUT_FOLDER, "Output folder", SextanteUtils.tempFolder())) SextanteConfig.addSetting(Setting("General", SextanteConfig.SHOW_CRS_DEF, "Show layer CRS definition in selection boxes", True)) SextanteConfig.addSetting(Setting("General", SextanteConfig.WARN_UNMATCHING_CRS, "Warn before executing if layer CRS's do not match", True)) diff --git a/python/plugins/sextante/grass/GrassUtils.py b/python/plugins/sextante/grass/GrassUtils.py index 0cbd7301d4a2..6fcce8d7065c 100644 --- a/python/plugins/sextante/grass/GrassUtils.py +++ b/python/plugins/sextante/grass/GrassUtils.py @@ -75,10 +75,10 @@ def grassPath(): folder = SextanteConfig.getSetting(GrassUtils.GRASS_FOLDER) if folder == None: - if SextanteUtils.isWindows(): - testfolder = os.path.dirname(str(QgsApplication.prefixPath())) + if SextanteUtils.isWindows(): + testfolder = os.path.dirname(str(QgsApplication.prefixPath())) testfolder = os.path.join(testfolder, "grass") - if os.path.isdir(testfolder): + if os.path.isdir(testfolder): for subfolder in os.listdir(testfolder): if subfolder.startswith("grass"): folder = os.path.join(testfolder, subfolder) @@ -94,8 +94,8 @@ def grassPath(): def grassWinShell(): folder = SextanteConfig.getSetting(GrassUtils.GRASS_WIN_SHELL) if folder == None: - folder = os.path.dirname(str(QgsApplication.prefixPath())) - folder = os.path.join(folder, "msys") + folder = os.path.dirname(str(QgsApplication.prefixPath())) + folder = os.path.join(folder, "msys") return folder @staticmethod diff --git a/python/plugins/sextante/gui/AlgorithmExecutionDialog.py b/python/plugins/sextante/gui/AlgorithmExecutionDialog.py index 3818ee8825cb..7c6dbdacf1e7 100644 --- a/python/plugins/sextante/gui/AlgorithmExecutionDialog.py +++ b/python/plugins/sextante/gui/AlgorithmExecutionDialog.py @@ -229,7 +229,7 @@ def accept(self): self.progress.setMaximum(0) self.progressLabel.setText("Processing algorithm...") QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) - if useThread and not self.iterateParam: #iterative execution on separate thread is still not working fine... + if useThread and not self.iterateParam: #iterative execution on separate thread is still not working fine... command = self.alg.getAsCommand() if command: SextanteLog.addToLog(SextanteLog.LOG_ALGORITHM, command) @@ -298,7 +298,7 @@ def finish(self): self.setInfo("HTML output has been generated by this algorithm.\nOpen the SEXTANTE results dialog to check it.") @pyqtSlot(str) - def error(self, msg): + def error(self, msg): QApplication.restoreOverrideCursor() keepOpen = SextanteConfig.getSetting(SextanteConfig.KEEP_DIALOG_OPEN) self.setInfo(msg, True) diff --git a/python/plugins/sextante/gui/AlgorithmExecutor.py b/python/plugins/sextante/gui/AlgorithmExecutor.py index 95a3f7ebaef8..a4ef14069926 100644 --- a/python/plugins/sextante/gui/AlgorithmExecutor.py +++ b/python/plugins/sextante/gui/AlgorithmExecutor.py @@ -128,7 +128,7 @@ def runalgIterating(self): SextantePostprocessing.handleAlgorithmResults(self.algorithm, self.progress, False) self.iterated.emit(i) i += 1 - self.algExecuted.emit() + self.algExecuted.emit() except BaseException, e: self.error.emit(str(e)) print "Error iterating " + str(e) diff --git a/python/plugins/sextante/gui/ConfigDialog.py b/python/plugins/sextante/gui/ConfigDialog.py index cf4526f9113c..a95af546d260 100644 --- a/python/plugins/sextante/gui/ConfigDialog.py +++ b/python/plugins/sextante/gui/ConfigDialog.py @@ -50,8 +50,8 @@ def __init__(self, toolbox): self.fillTree() self.tree.itemClicked.connect(self.edit) self.tree.itemDoubleClicked.connect(self.edit) - - def edit(self, item, column): + + def edit(self, item, column): if column > 0: self.tree.editItem(item, column) @@ -76,10 +76,10 @@ def fillTree(self): self.tree.addTopLevelItem(groupItem) if text != "": groupItem.setExpanded(True) - + providersItem = QTreeWidgetItem() providersItem.setText(0, "Providers") - icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/alg.png") + icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/alg.png") providersItem.setIcon(0, icon) for group in settings.keys(): if group in priorityKeys: @@ -94,11 +94,11 @@ def fillTree(self): if text =="" or text.lower() in setting.description.lower(): settingItem = TreeSettingItem(setting, icon) self.items[setting]=settingItem - groupItem.addChild(settingItem) + groupItem.addChild(settingItem) if text != "": groupItem.setExpanded(True) providersItem.addChild(groupItem) - self.tree.addTopLevelItem(providersItem) + self.tree.addTopLevelItem(providersItem) self.tree.sortItems(0, Qt.AscendingOrder) self.tree.setColumnWidth(0, 400) @@ -131,7 +131,7 @@ class TreeSettingItem(QTreeWidgetItem): def __init__(self, setting, icon): QTreeWidgetItem.__init__(self) self.setting = setting - self.setText(0, setting.description) + self.setText(0, setting.description) if isinstance(setting.value,bool): if setting.value: self.setCheckState(1, Qt.Checked) diff --git a/python/plugins/sextante/gui/UnthreadedAlgorithmExecutor.py b/python/plugins/sextante/gui/UnthreadedAlgorithmExecutor.py index 2e01a20309ac..8d89007096c1 100644 --- a/python/plugins/sextante/gui/UnthreadedAlgorithmExecutor.py +++ b/python/plugins/sextante/gui/UnthreadedAlgorithmExecutor.py @@ -56,7 +56,7 @@ def runalgIterating(alg,paramToIter,progress): settings = QSettings() systemEncoding = settings.value( "/UI/encoding", "System" ).toString() layerfile = alg.getParameterValue(paramToIter) - layer = QGisLayers.getObjectFromUri(layerfile, False) + layer = QGisLayers.getObjectFromUri(layerfile, False) feat = QgsFeature() filelist = [] outputs = {} diff --git a/python/plugins/sextante/modeler/ModelerArrowItem.py b/python/plugins/sextante/modeler/ModelerArrowItem.py index 8715fc26fed3..4129a97323f3 100644 --- a/python/plugins/sextante/modeler/ModelerArrowItem.py +++ b/python/plugins/sextante/modeler/ModelerArrowItem.py @@ -70,7 +70,7 @@ def endItem(self): def boundingRect(self): #this is a quick fix to avoid arrows not being drawn return QtCore.QRectF(0, 0, 4000,4000) - + def shape(self): path = super(ModelerArrowItem, self).shape() path.addPolygon(self.arrowHead) @@ -80,27 +80,27 @@ def updatePosition(self): line = QtCore.QLineF(self.mapFromItem(self.myStartItem, 0, 0), self.mapFromItem(self.myEndItem, 0, 0)) self.setLine(line) - def paint(self, painter, option, widget=None): + def paint(self, painter, option, widget=None): myStartItem = self.myStartItem myEndItem = self.myEndItem myPen = self.pen() myPen.setColor(self.myColor) arrowSize = 6.0 painter.setPen(myPen) - painter.setBrush(self.myColor) + painter.setBrush(self.myColor) if isinstance(self.startItem().element, GeoAlgorithm): if self.startItem().element.outputs: endPt = self.endItem().getLinkPointForParameter(self.paramIndex) - startPt = self.startItem().getLinkPointForOutput(self.outputIndex) - arrowLine = QtCore.QLineF(myEndItem.pos() + endPt - QtCore.QPointF(endPt.x() + ModelerGraphicItem.BOX_WIDTH /2, 0), myEndItem.pos() + endPt) + startPt = self.startItem().getLinkPointForOutput(self.outputIndex) + arrowLine = QtCore.QLineF(myEndItem.pos() + endPt - QtCore.QPointF(endPt.x() + ModelerGraphicItem.BOX_WIDTH /2, 0), myEndItem.pos() + endPt) painter.drawLine(arrowLine) tailLine = QtCore.QLineF(myStartItem.pos() + startPt + QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2 - startPt.x(),0), myStartItem.pos() + startPt) painter.drawLine(tailLine) pt = QtCore.QPointF(myStartItem.pos() + startPt + QtCore.QPointF(- 2, -2)) - rect = QtCore.QRectF(pt.x(), pt.y(), 4, 4) + rect = QtCore.QRectF(pt.x(), pt.y(), 4, 4) painter.fillRect(rect, QtCore.Qt.gray) - line = QtCore.QLineF(myStartItem.pos() + startPt + QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2 - startPt.x(),0), + line = QtCore.QLineF(myStartItem.pos() + startPt + QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH /2 - startPt.x(),0), myEndItem.pos() + endPt - QtCore.QPointF(endPt.x() + ModelerGraphicItem.BOX_WIDTH /2, 0)) else: # case where there is a dependency on an algorithm not on an output endPolygon = myEndItem.polygon() @@ -114,35 +114,35 @@ def paint(self, painter, option, widget=None): if intersectType == QtCore.QLineF.BoundedIntersection: break p1 = p2 - + self.setLine(QtCore.QLineF(intersectPoint, myStartItem.pos())) - line = self.line() + line = self.line() if line.length() == 0: #division by zero might occur if arrow has no length return angle = math.acos(line.dx() / line.length()) if line.dy() >= 0: angle = (math.pi * 2.0) - angle - + arrowP1 = line.p1() + QtCore.QPointF(math.sin(angle + math.pi / 3.0) * arrowSize, math.cos(angle + math.pi / 3) * arrowSize) arrowP2 = line.p1() + QtCore.QPointF(math.sin(angle + math.pi - math.pi / 3.0) * arrowSize, math.cos(angle + math.pi - math.pi / 3.0) * arrowSize) - + self.arrowHead.clear() for point in [line.p1(), arrowP1, arrowP2]: self.arrowHead.append(point) - + painter.drawLine(line) - painter.drawPolygon(self.arrowHead) - return; + painter.drawPolygon(self.arrowHead) + return; else: - endPt = self.endItem().getLinkPointForParameter(self.paramIndex) - arrowLine = QtCore.QLineF(myEndItem.pos() + endPt - QtCore.QPointF(endPt.x() + ModelerGraphicItem.BOX_WIDTH /2, 0), myEndItem.pos() + endPt) + endPt = self.endItem().getLinkPointForParameter(self.paramIndex) + arrowLine = QtCore.QLineF(myEndItem.pos() + endPt - QtCore.QPointF(endPt.x() + ModelerGraphicItem.BOX_WIDTH /2, 0), myEndItem.pos() + endPt) painter.drawLine(arrowLine) - line = QtCore.QLineF(myStartItem.pos(), + line = QtCore.QLineF(myStartItem.pos(), myEndItem.pos() + endPt - QtCore.QPointF(endPt.x() + ModelerGraphicItem.BOX_WIDTH /2, 0)) - - self.setLine(line); + + self.setLine(line); if line.length() == 0: #division by zero might occur if arrow has no length return diff --git a/python/plugins/sextante/modeler/ModelerDialog.py b/python/plugins/sextante/modeler/ModelerDialog.py index 905039af137b..5f8e38a6c21a 100644 --- a/python/plugins/sextante/modeler/ModelerDialog.py +++ b/python/plugins/sextante/modeler/ModelerDialog.py @@ -47,9 +47,9 @@ from sextante.ui.ui_DlgModeler import Ui_DlgModeler class ModelerDialog(QDialog, Ui_DlgModeler): - + USE_CATEGORIES = "/SextanteQGIS/UseCategories" - + def __init__(self, alg=None): QDialog.__init__(self) @@ -272,7 +272,7 @@ def addAlgorithm(self): def fillAlgorithmTree(self): settings = QSettings() - useCategories = settings.value(self.USE_CATEGORIES).toBool() + useCategories = settings.value(self.USE_CATEGORIES).toBool() if useCategories: self.fillAlgorithmTreeUsingCategories() else: diff --git a/python/plugins/sextante/modeler/ModelerGraphicItem.py b/python/plugins/sextante/modeler/ModelerGraphicItem.py index 2b4b0a5d95bd..7c488ef5c87a 100644 --- a/python/plugins/sextante/modeler/ModelerGraphicItem.py +++ b/python/plugins/sextante/modeler/ModelerGraphicItem.py @@ -56,56 +56,56 @@ def __init__(self, element, elementIndex, model): self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True) self.setFlag(QtGui.QGraphicsItem.ItemIsSelectable, True) self.setZValue(1000) - + icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/edit.png") - pt = QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH / 2 - FlatButtonGraphicItem.WIDTH / 2, ModelerGraphicItem.BOX_HEIGHT / 2 - FlatButtonGraphicItem.HEIGHT / 2 + 1) + pt = QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH / 2 - FlatButtonGraphicItem.WIDTH / 2, ModelerGraphicItem.BOX_HEIGHT / 2 - FlatButtonGraphicItem.HEIGHT / 2 + 1) self.editButton = FlatButtonGraphicItem(icon, pt, self.editElement) self.editButton.setParentItem(self) icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/delete.png") - pt = QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH / 2 - FlatButtonGraphicItem.WIDTH / 2, -ModelerGraphicItem.BOX_HEIGHT / 2 + FlatButtonGraphicItem.HEIGHT / 2 + 1) + pt = QtCore.QPointF(ModelerGraphicItem.BOX_WIDTH / 2 - FlatButtonGraphicItem.WIDTH / 2, -ModelerGraphicItem.BOX_HEIGHT / 2 + FlatButtonGraphicItem.HEIGHT / 2 + 1) self.deleteButton = FlatButtonGraphicItem(icon, pt, self.removeElement) self.deleteButton.setParentItem(self) - - if isinstance(element, GeoAlgorithm): - if element.parameters: + + if isinstance(element, GeoAlgorithm): + if element.parameters: pt = self.getLinkPointForParameter(-1) - x = self.getXPositionForFoldButton() + x = self.getXPositionForFoldButton() pt = QtCore.QPointF(x, pt.y() + 3) self.inButton = FoldButtonGraphicItem(pt, self.foldInput) self.inButton.setParentItem(self) if element.outputs: pt = self.getLinkPointForOutput(-1) - x = self.getXPositionForFoldButton() - pt = QtCore.QPointF(x, pt.y() + 3) + x = self.getXPositionForFoldButton() + pt = QtCore.QPointF(x, pt.y() + 3) self.outButton = FoldButtonGraphicItem(pt, self.foldOutput) self.outButton.setParentItem(self) - + def foldInput(self, folded): self.inputFolded = folded - self.prepareGeometryChange() - if self.element.outputs: + self.prepareGeometryChange() + if self.element.outputs: pt = self.getLinkPointForOutput(-1) - x = self.getXPositionForFoldButton() + x = self.getXPositionForFoldButton() pt = QtCore.QPointF(x, pt.y()) self.outButton.position = pt self.update() - + def foldOutput(self, folded): - self.outputFolded = folded - self.prepareGeometryChange() - self.update() - + self.outputFolded = folded + self.prepareGeometryChange() + self.update() + def addArrow(self, arrow): self.arrows.append(arrow) def boundingRect(self): font = QtGui.QFont("Verdana", 8) - fm = QtGui.QFontMetricsF(font) + fm = QtGui.QFontMetricsF(font) numParams = 0 if self.inputFolded else len(self.element.parameters) - numOutputs = 0 if self.outputFolded else len(self.element.outputs) - numElements = numParams + numOutputs + 3 - h = (fm.height() * 1.2) * numElements + numOutputs = 0 if self.outputFolded else len(self.element.outputs) + numElements = numParams + numOutputs + 3 + h = (fm.height() * 1.2) * numElements rect = QtCore.QRectF(-(ModelerGraphicItem.BOX_WIDTH + 2)/2, -(ModelerGraphicItem.BOX_HEIGHT + 2)/2, ModelerGraphicItem.BOX_WIDTH + 2, ModelerGraphicItem.BOX_HEIGHT + h) return rect @@ -196,37 +196,37 @@ def paint(self, painter, option, widget=None): painter.setPen(QtGui.QPen(QtCore.Qt.blue)) if isinstance(self.element, GeoAlgorithm): if self.elementIndex in self.model.deactivated: - painter.setPen(QtGui.QPen(QtCore.Qt.lightGray)) + painter.setPen(QtGui.QPen(QtCore.Qt.lightGray)) fm = QtGui.QFontMetricsF(font) text = self.getAdjustedText(self.text) h = fm.height() pt = QtCore.QPointF(-(ModelerGraphicItem.BOX_WIDTH)/2 + 25, h/2.0) painter.drawText(pt, text) painter.setPen(QtGui.QPen(QtCore.Qt.black)) - if isinstance(self.element, GeoAlgorithm): + if isinstance(self.element, GeoAlgorithm): h = (fm.height() * 1.2) - h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 + h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 pt = QtCore.QPointF(-(ModelerGraphicItem.BOX_WIDTH)/2 + 25, h) painter.drawText(pt, "In") i = 1 if not self.inputFolded: for param in self.element.parameters: - text = self.getAdjustedText(param.description) + text = self.getAdjustedText(param.description) h = (fm.height() * 1.2) * (i + 1) - h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 + h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 pt = QtCore.QPointF(-(ModelerGraphicItem.BOX_WIDTH)/2 + 33, h) painter.drawText(pt, text) - i += 1 + i += 1 h = (fm.height() * 1.2) * (i + 1) - h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 + h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 pt = QtCore.QPointF(-(ModelerGraphicItem.BOX_WIDTH)/2 + 25, h) painter.drawText(pt, "Out") i += 1 if not self.outputFolded: for out in self.element.outputs: - text = self.getAdjustedText(out.description) + text = self.getAdjustedText(out.description) h = (fm.height() * 1.2) * (i + 1) - h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 + h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 pt = QtCore.QPointF(-(ModelerGraphicItem.BOX_WIDTH)/2 + 33, h) painter.drawText(pt, text) i += 1 @@ -238,25 +238,25 @@ def getLinkPointForParameter(self, paramIndex): paramIndex = -1 offsetX = 22 font = QtGui.QFont("Verdana", 8) - fm = QtGui.QFontMetricsF(font) + fm = QtGui.QFontMetricsF(font) h = (fm.height() * 1.2) * (paramIndex + 2) - fm.height() / 2.0 - h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 + h = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 return QtCore.QPointF(-(ModelerGraphicItem.BOX_WIDTH)/2 + offsetX, h) - - + + def getXPositionForFoldButton(self): return 0 - - def getLinkPointForOutput(self, outputIndex): - if isinstance(self.element, GeoAlgorithm): + + def getLinkPointForOutput(self, outputIndex): + if isinstance(self.element, GeoAlgorithm): numParams = 0 if self.inputFolded else len(self.element.parameters) - outputIndex = outputIndex if not self.outputFolded else -1 - text = self.getAdjustedText(self.element.outputs[outputIndex].description) + outputIndex = outputIndex if not self.outputFolded else -1 + text = self.getAdjustedText(self.element.outputs[outputIndex].description) font = QtGui.QFont("Verdana", 8) - fm = QtGui.QFontMetricsF(font) + fm = QtGui.QFontMetricsF(font) w = fm.width(QtCore.QString(text)) h = (fm.height() * 1.2) * (outputIndex + 3 + numParams) - fm.height() / 2.0 - y = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 + y = h + ModelerGraphicItem.BOX_HEIGHT / 2.0 x = -(ModelerGraphicItem.BOX_WIDTH)/2 + 33 + w + 5 if not self.outputFolded else 10 return QtCore.QPointF(x, y) else: @@ -271,9 +271,9 @@ def itemChange(self, change, value): def polygon(self): font = QtGui.QFont("Verdana", 8) - fm = QtGui.QFontMetricsF(font) - numElements = len(self.element.parameters) + len(self.element.outputs) + 3 - h = (fm.height() * 1.2) * numElements + fm = QtGui.QFontMetricsF(font) + numElements = len(self.element.parameters) + len(self.element.outputs) + 3 + h = (fm.height() * 1.2) * numElements pol = QtGui.QPolygonF([ QtCore.QPointF(-(ModelerGraphicItem.BOX_WIDTH + 2)/2, -(ModelerGraphicItem.BOX_HEIGHT + 2)/2), QtCore.QPointF(-(ModelerGraphicItem.BOX_WIDTH + 2)/2, (ModelerGraphicItem.BOX_HEIGHT + 2)/2 + h), @@ -283,62 +283,61 @@ def polygon(self): return pol class FlatButtonGraphicItem(QtGui.QGraphicsItem): - + WIDTH = 16 - HEIGHT = 16 - + HEIGHT = 16 + def __init__(self, icon, position, action): super(FlatButtonGraphicItem, self).__init__(None, None) - self.setAcceptHoverEvents(True) + self.setAcceptHoverEvents(True) self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, False) self.pixmap = icon.pixmap(self.WIDTH, self.HEIGHT, state=QtGui.QIcon.On) self.position = position - self.isIn = False - self.action = action + self.isIn = False + self.action = action def mousePressEvent(self, event): self.action() - + def paint(self, painter, option, widget=None): pt = QtCore.QPointF(-self.WIDTH / 2, -self.HEIGHT / 2) + self.position - rect = QtCore.QRectF(pt.x(), pt.y(), self.WIDTH, self.HEIGHT) + rect = QtCore.QRectF(pt.x(), pt.y(), self.WIDTH, self.HEIGHT) if self.isIn: painter.setPen(QtGui.QPen(QtCore.Qt.transparent, 1)) - painter.setBrush(QtGui.QBrush(QtCore.Qt.lightGray, QtCore.Qt.SolidPattern)) + painter.setBrush(QtGui.QBrush(QtCore.Qt.lightGray, QtCore.Qt.SolidPattern)) else: - painter.setPen(QtGui.QPen(QtCore.Qt.transparent, 1)) + painter.setPen(QtGui.QPen(QtCore.Qt.transparent, 1)) painter.setBrush(QtGui.QBrush(QtCore.Qt.white, QtCore.Qt.SolidPattern)) - painter.drawRect(rect) + painter.drawRect(rect) painter.drawPixmap(pt.x(), pt.y(), self.pixmap) - + def boundingRect(self): rect = QtCore.QRectF(self.position.x() - self.WIDTH / 2, self.position.y() - self.HEIGHT / 2, self.WIDTH, self.HEIGHT) - return rect - + return rect + def hoverEnterEvent(self, event): - self.isIn = True + self.isIn = True self.update() - + def hoverLeaveEvent(self, event): - self.isIn = False + self.isIn = False self.update() - + class FoldButtonGraphicItem(FlatButtonGraphicItem): WIDTH = 11 HEIGHT = 11 - - icons = { True : QtGui.QIcon(os.path.dirname(__file__) + "/../images/plus.png"), + + icons = { True : QtGui.QIcon(os.path.dirname(__file__) + "/../images/plus.png"), False : QtGui.QIcon(os.path.dirname(__file__) + "/../images/minus.png")} - + def __init__(self, position, action): self.folded = True icon = self.icons[True] - super(FoldButtonGraphicItem, self).__init__(icon, position, action) + super(FoldButtonGraphicItem, self).__init__(icon, position, action) def mousePressEvent(self, event): self.folded = not self.folded icon = self.icons[self.folded] self.pixmap = icon.pixmap(self.WIDTH, self.HEIGHT, state=QtGui.QIcon.On) self.action(self.folded) - \ No newline at end of file diff --git a/python/plugins/sextante/modeler/ModelerParameterDefinitionDialog.py b/python/plugins/sextante/modeler/ModelerParameterDefinitionDialog.py index 487c6b5634de..317869a02dba 100644 --- a/python/plugins/sextante/modeler/ModelerParameterDefinitionDialog.py +++ b/python/plugins/sextante/modeler/ModelerParameterDefinitionDialog.py @@ -206,7 +206,7 @@ def setupUi(self): self.fileFolderCombo.addItem("Folder") self.horizontalLayout2.addWidget(self.fileFolderCombo) if self.param is not None: - self.fileFolderCombo.setCurrentIndex(1 if self.param.isFolder else 0) + self.fileFolderCombo.setCurrentIndex(1 if self.param.isFolder else 0) self.buttonBox = QtGui.QDialogButtonBox(self) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) @@ -214,9 +214,9 @@ def setupUi(self): self.buttonBox.setObjectName("buttonBox") QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.okPressed) QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.cancelPressed) - + self.verticalLayout.addWidget(self.buttonBox) - + self.setLayout(self.verticalLayout) diff --git a/python/plugins/sextante/modeler/ModelerScene.py b/python/plugins/sextante/modeler/ModelerScene.py index dbfa264e4459..151140a4a481 100644 --- a/python/plugins/sextante/modeler/ModelerScene.py +++ b/python/plugins/sextante/modeler/ModelerScene.py @@ -86,7 +86,7 @@ def getItemsFromAAP(self, aap, isMultiple): if output.name == aap.param: items.append((self.algItems[start], idx)) break - idx += 1 + idx += 1 return items @@ -116,7 +116,7 @@ def paintModel(self, model): for alg in model.algs: params = model.algParameters[iAlg] idx = 0 - for parameter in alg.parameters: + for parameter in alg.parameters: param = params[parameter.name] if param: sourceItems = self.getItemsFromAAP(param, isinstance(alg.getParameterFromName(parameter.name), ParameterMultipleInput)) diff --git a/python/plugins/sextante/otb/OTBUtils.py b/python/plugins/sextante/otb/OTBUtils.py index d2ff49bec02a..be5c4fa5c4ea 100644 --- a/python/plugins/sextante/otb/OTBUtils.py +++ b/python/plugins/sextante/otb/OTBUtils.py @@ -77,17 +77,17 @@ def otbLibPath(): else: testfolder = "/usr/local/lib/otb/applications" if os.path.exists(testfolder): - folder = testfolder + folder = testfolder elif SextanteUtils.isWindows(): - testfolder = os.path.dirname(str(QgsApplication.prefixPath())) + testfolder = os.path.dirname(str(QgsApplication.prefixPath())) testfolder = os.path.join(testfolder, "orfeotoolbox") - testfolder = os.path.join(testfolder, "applications") + testfolder = os.path.join(testfolder, "applications") if os.path.exists(testfolder): folder = testfolder else: testfolder = "/usr/lib/otb/applications" if os.path.exists(testfolder): - folder = testfolder + folder = testfolder return folder @staticmethod diff --git a/python/plugins/sextante/saga/SagaUtils.py b/python/plugins/sextante/saga/SagaUtils.py index f693a99240b6..cdf6c28a12e6 100644 --- a/python/plugins/sextante/saga/SagaUtils.py +++ b/python/plugins/sextante/saga/SagaUtils.py @@ -72,9 +72,9 @@ def sagaPath(): testfolder = "/usr/local/bin" if os.path.exists(os.path.join(testfolder, "saga_cmd")): folder = testfolder - elif SextanteUtils.isWindows(): - testfolder = os.path.dirname(str(QgsApplication.prefixPath())) - testfolder = os.path.join(testfolder, "saga") + elif SextanteUtils.isWindows(): + testfolder = os.path.dirname(str(QgsApplication.prefixPath())) + testfolder = os.path.join(testfolder, "saga") if os.path.exists(os.path.join(testfolder, "saga_cmd.exe")): folder = testfolder return folder diff --git a/src/app/qgisappinterface.cpp b/src/app/qgisappinterface.cpp index a807f21509ae..b08a0593e5f1 100644 --- a/src/app/qgisappinterface.cpp +++ b/src/app/qgisappinterface.cpp @@ -203,7 +203,7 @@ int QgisAppInterface::addToolBarIcon( QAction * qAction ) return qgis->addPluginToolBarIcon( qAction ); } -QAction*QgisAppInterface::addToolBarWidget( QWidget* widget ) +QAction *QgisAppInterface::addToolBarWidget( QWidget* widget ) { return qgis->addPluginToolBarWidget( widget ); } @@ -218,7 +218,7 @@ int QgisAppInterface::addRasterToolBarIcon( QAction * qAction ) return qgis->addRasterToolBarIcon( qAction ); } -QAction*QgisAppInterface::addRasterToolBarWidget( QWidget* widget ) +QAction *QgisAppInterface::addRasterToolBarWidget( QWidget* widget ) { return qgis->addRasterToolBarWidget( widget ); } @@ -233,7 +233,7 @@ int QgisAppInterface::addVectorToolBarIcon( QAction * qAction ) return qgis->addVectorToolBarIcon( qAction ); } -QAction*QgisAppInterface::addVectorToolBarWidget(QWidget* widget) +QAction *QgisAppInterface::addVectorToolBarWidget( QWidget* widget ) { return qgis->addVectorToolBarWidget( widget ); } @@ -248,7 +248,7 @@ int QgisAppInterface::addDatabaseToolBarIcon( QAction * qAction ) return qgis->addDatabaseToolBarIcon( qAction ); } -QAction*QgisAppInterface::addDatabaseToolBarWidget(QWidget* widget) +QAction *QgisAppInterface::addDatabaseToolBarWidget( QWidget* widget ) { return qgis->addDatabaseToolBarWidget( widget ); } @@ -263,7 +263,7 @@ int QgisAppInterface::addWebToolBarIcon( QAction * qAction ) return qgis->addWebToolBarIcon( qAction ); } -QAction*QgisAppInterface::addWebToolBarWidget(QWidget* widget) +QAction *QgisAppInterface::addWebToolBarWidget( QWidget* widget ) { return qgis->addWebToolBarWidget( widget ); } @@ -571,32 +571,32 @@ bool QgisAppInterface::openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f, b void QgisAppInterface::preloadForm( QString uifile ) { - QSignalMapper* signalMapper = new QSignalMapper ( this ); - mTimer = new QTimer(this); + QSignalMapper* signalMapper = new QSignalMapper( this ); + mTimer = new QTimer( this ); - connect( mTimer ,SIGNAL( timeout() ), signalMapper,SLOT( map() ) ); - connect( signalMapper, SIGNAL( mapped(QString) ), mTimer, SLOT( stop() ) ); - connect( signalMapper, SIGNAL( mapped(QString) ), this, SLOT( cacheloadForm( QString ) ) ); + connect( mTimer , SIGNAL( timeout() ), signalMapper, SLOT( map() ) ); + connect( signalMapper, SIGNAL( mapped( QString ) ), mTimer, SLOT( stop() ) ); + connect( signalMapper, SIGNAL( mapped( QString ) ), this, SLOT( cacheloadForm( QString ) ) ); - signalMapper->setMapping( mTimer, uifile ); + signalMapper->setMapping( mTimer, uifile ); - mTimer->start(0); + mTimer->start( 0 ); } void QgisAppInterface::cacheloadForm( QString uifile ) { - QFile file( uifile ); + QFile file( uifile ); - if ( file.open( QFile::ReadOnly ) ) - { - QUiLoader loader; + if ( file.open( QFile::ReadOnly ) ) + { + QUiLoader loader; - QFileInfo fi( uifile ); - loader.setWorkingDirectory( fi.dir() ); - QWidget *myWidget = loader.load( &file ); - file.close(); - delete myWidget; - } + QFileInfo fi( uifile ); + loader.setWorkingDirectory( fi.dir() ); + QWidget *myWidget = loader.load( &file ); + file.close(); + delete myWidget; + } } QDialog* QgisAppInterface::getFeatureForm( QgsVectorLayer *l, QgsFeature &f ) diff --git a/src/app/qgisappinterface.h b/src/app/qgisappinterface.h index 368573de9ef6..c73005abce7f 100644 --- a/src/app/qgisappinterface.h +++ b/src/app/qgisappinterface.h @@ -438,7 +438,7 @@ class QgisAppInterface : public QgisInterface * * More information here: http://qt-project.org/forums/viewthread/27098/ */ - virtual void preloadForm(QString uifile); + virtual void preloadForm( QString uifile ); /** Return vector layers in edit mode * @param modified whether to return only layers that have been modified diff --git a/src/app/qgsmaptoolcapture.cpp b/src/app/qgsmaptoolcapture.cpp index 7391c58f02c2..bb6a15104ec1 100644 --- a/src/app/qgsmaptoolcapture.cpp +++ b/src/app/qgsmaptoolcapture.cpp @@ -227,7 +227,7 @@ void QgsMapToolCapture::undo() return; } - mRubberBand->removePoint(-2); // remove the one before the last one + mRubberBand->removePoint( -2 ); // remove the one before the last one mCaptureList.removeLast(); validateGeometry(); diff --git a/src/core/diagram/qgshistogramdiagram.cpp b/src/core/diagram/qgshistogramdiagram.cpp index 5e8ca1489d3c..e82006de5456 100644 --- a/src/core/diagram/qgshistogramdiagram.cpp +++ b/src/core/diagram/qgshistogramdiagram.cpp @@ -55,7 +55,7 @@ QSizeF QgsHistogramDiagram::diagramSize( const QgsAttributes& attributes, const { case QgsDiagramSettings::Up: case QgsDiagramSettings::Down: - mScaleFactor = ( ( is.upperSize.width() - is.lowerSize.height() ) / ( is.upperValue - is.lowerValue ) ); + mScaleFactor = (( is.upperSize.width() - is.lowerSize.height() ) / ( is.upperValue - is.lowerValue ) ); size.scale( s.barWidth * attributes.size(), maxValue * mScaleFactor, Qt::IgnoreAspectRatio ); break; diff --git a/src/core/qgscacheindexfeatureid.cpp b/src/core/qgscacheindexfeatureid.cpp index d368bb161a91..1e009c92acc0 100644 --- a/src/core/qgscacheindexfeatureid.cpp +++ b/src/core/qgscacheindexfeatureid.cpp @@ -25,7 +25,7 @@ QgsCacheIndexFeatureId::QgsCacheIndexFeatureId( QgsVectorLayerCache* cachedVecto } -void QgsCacheIndexFeatureId::flushFeature(const QgsFeatureId fid) +void QgsCacheIndexFeatureId::flushFeature( const QgsFeatureId fid ) { Q_UNUSED( fid ) } @@ -42,7 +42,7 @@ void QgsCacheIndexFeatureId::requestCompleted( QgsFeatureRequest featureRequest, bool QgsCacheIndexFeatureId::getCacheIterator( QgsFeatureIterator &featureIterator, const QgsFeatureRequest &featureRequest ) { - if( featureRequest.filterType() == QgsFeatureRequest::FilterFid ) + if ( featureRequest.filterType() == QgsFeatureRequest::FilterFid ) { if ( C->isFidCached( featureRequest.filterFid() ) ) { diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index 4f57a967546e..e7863908379c 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -134,16 +134,16 @@ bool QgsCoordinateReferenceSystem::createFromString( const QString theDefinition if ( reCrsStr.cap( 1 ).toLower() == "proj4" ) { result = createFromProj4( reCrsStr.cap( 2 ) ); - //TODO: createFromProj4 used to save to the user database any new CRS + //TODO: createFromProj4 used to save to the user database any new CRS // this behavior was changed in order to separate creation and saving. - // Not sure if it necessary to save it here, should be checked by someone + // Not sure if it necessary to save it here, should be checked by someone // familiar with the code (should also give a more descriptive name to the generated CRS) - if( srsid() == 0 ) + if ( srsid() == 0 ) { QString myName = QString( " * %1 (%2)" ) - .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) - .arg( toProj4() ); - saveAsUserCRS(myName); + .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) + .arg( toProj4() ); + saveAsUserCRS( myName ); } } else @@ -471,16 +471,16 @@ bool QgsCoordinateReferenceSystem::createFromWkt( QString theWkt ) createFromProj4( proj4src ); } - //TODO: createFromProj4 used to save to the user database any new CRS + //TODO: createFromProj4 used to save to the user database any new CRS // this behavior was changed in order to separate creation and saving. - // Not sure if it necessary to save it here, should be checked by someone + // Not sure if it necessary to save it here, should be checked by someone // familiar with the code (should also give a more descriptive name to the generated CRS) - if( mSrsId == 0 ) + if ( mSrsId == 0 ) { QString myName = QString( " * %1 (%2)" ) - .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) - .arg( toProj4() ); - saveAsUserCRS(myName); + .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) + .arg( toProj4() ); + saveAsUserCRS( myName ); } CPLFree( proj4src ); @@ -1212,16 +1212,16 @@ bool QgsCoordinateReferenceSystem::readXML( QDomNode & theNode ) //@TODO this srs needs to be validated!!! mIsValidFlag = true; //shamelessly hard coded for now } - //TODO: createFromProj4 used to save to the user database any new CRS + //TODO: createFromProj4 used to save to the user database any new CRS // this behavior was changed in order to separate creation and saving. - // Not sure if it necessary to save it here, should be checked by someone + // Not sure if it necessary to save it here, should be checked by someone // familiar with the code (should also give a more descriptive name to the generated CRS) - if( mSrsId == 0 ) + if ( mSrsId == 0 ) { QString myName = QString( " * %1 (%2)" ) - .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) - .arg( toProj4() ); - saveAsUserCRS(myName); + .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) + .arg( toProj4() ); + saveAsUserCRS( myName ); } } @@ -1420,7 +1420,7 @@ QString QgsCoordinateReferenceSystem::validationHint() /// Copied from QgsCustomProjectionDialog /// /// Please refactor into SQL handler !!! /// -bool QgsCoordinateReferenceSystem::saveAsUserCRS(QString name) +bool QgsCoordinateReferenceSystem::saveAsUserCRS( QString name ) { if ( ! mIsValidFlag ) { diff --git a/src/core/qgscoordinatereferencesystem.h b/src/core/qgscoordinatereferencesystem.h index 17bcec89c89d..dc367fde2646 100644 --- a/src/core/qgscoordinatereferencesystem.h +++ b/src/core/qgscoordinatereferencesystem.h @@ -347,8 +347,8 @@ class CORE_EXPORT QgsCoordinateReferenceSystem * @note added in 1.8 */ static int syncDb(); - - + + /*! Save the proj4-string as a custom CRS * @returns bool true if success else false */ diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp index 4eadfd4b4024..bc0010cb2f3d 100644 --- a/src/core/qgsdistancearea.cpp +++ b/src/core/qgsdistancearea.cpp @@ -212,16 +212,16 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid ) QString proj4 = "+proj=longlat +ellps=" + ellipsoid + " +no_defs"; QgsCoordinateReferenceSystem destCRS; destCRS.createFromProj4( proj4 ); - //TODO: createFromProj4 used to save to the user database any new CRS + //TODO: createFromProj4 used to save to the user database any new CRS // this behavior was changed in order to separate creation and saving. - // Not sure if it necessary to save it here, should be checked by someone + // Not sure if it necessary to save it here, should be checked by someone // familiar with the code (should also give a more descriptive name to the generated CRS) - if( destCRS.srsid() == 0 ) + if ( destCRS.srsid() == 0 ) { QString myName = QString( " * %1 (%2)" ) - .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) - .arg( destCRS.toProj4() ); - destCRS.saveAsUserCRS(myName); + .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) + .arg( destCRS.toProj4() ); + destCRS.saveAsUserCRS( myName ); } // diff --git a/src/core/qgsmaplayerregistry.h b/src/core/qgsmaplayerregistry.h index ef8bd9bc9896..034f970aa10b 100644 --- a/src/core/qgsmaplayerregistry.h +++ b/src/core/qgsmaplayerregistry.h @@ -70,7 +70,7 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject * @note As a side-effect QgsProject is made dirty. * @note Added in QGIS 1.8 */ - QList addMapLayers(QList theMapLayers, + QList addMapLayers( QList theMapLayers, bool addToLegend = true ); /** @@ -109,7 +109,7 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject * * @note As a side-effect QgsProject is made dirty. */ - void removeMapLayers(QStringList theLayerIds ); + void removeMapLayers( QStringList theLayerIds ); /** * @brief diff --git a/src/core/qgsproject.cpp b/src/core/qgsproject.cpp index d2f3d08054ec..b1a97838be61 100644 --- a/src/core/qgsproject.cpp +++ b/src/core/qgsproject.cpp @@ -686,7 +686,7 @@ QPair< bool, QList > QgsProject::_getMapLayers( QDomDocument const &do QDomElement element = node.toElement(); QString name = node.namedItem( "layername" ).toElement().text(); - if( !name.isNull() ) + if ( !name.isNull() ) emit loadingLayer( tr( "Loading layer %1" ).arg( name ) ); if ( element.attribute( "embedded" ) == "1" ) diff --git a/src/core/qgsvectorlayercache.h b/src/core/qgsvectorlayercache.h index f52409794daf..917cc014adc0 100644 --- a/src/core/qgsvectorlayercache.h +++ b/src/core/qgsvectorlayercache.h @@ -157,7 +157,7 @@ class CORE_EXPORT QgsVectorLayerCache : public QObject * @param fid The feature id to look for * @return True if this id is in the cache */ - bool isFidCached(const QgsFeatureId fid ); + bool isFidCached( const QgsFeatureId fid ); /** * Gets the feature at the given feature id. Considers the changed, added, deleted and permanent features diff --git a/src/core/qgsvectorlayerfeatureiterator.cpp b/src/core/qgsvectorlayerfeatureiterator.cpp index 3af9a6697184..1be47e27ceef 100644 --- a/src/core/qgsvectorlayerfeatureiterator.cpp +++ b/src/core/qgsvectorlayerfeatureiterator.cpp @@ -43,7 +43,7 @@ QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayer* la for ( int i = 0; i < subset.count(); ++i ) { int attrIndex = subset[i]; - if( attrIndex < 0 || attrIndex >= nPendingFields ) continue; + if ( attrIndex < 0 || attrIndex >= nPendingFields ) continue; if ( L->pendingFields().fieldOrigin( attrIndex ) == QgsFields::OriginProvider ) providerSubset << L->pendingFields().fieldOriginIndex( attrIndex ); } diff --git a/src/core/raster/qgsrasterfilewriter.h b/src/core/raster/qgsrasterfilewriter.h index 43d96f3b8731..c8758c0256a2 100644 --- a/src/core/raster/qgsrasterfilewriter.h +++ b/src/core/raster/qgsrasterfilewriter.h @@ -131,7 +131,7 @@ class CORE_EXPORT QgsRasterFileWriter const QString& outputUrl, int fileIndex, int nBands, QGis::DataType type, const QgsCoordinateReferenceSystem& crs ); - /** \brie Init VRT (for tiled mode) or create global output provider (single-file mode) + /** \brief Init VRT (for tiled mode) or create global output provider (single-file mode) * @param destHasNoDataValueList true if destination has no data value, indexed from 0 * @param destNoDataValueList no data value, indexed from 0 */ diff --git a/src/gui/attributetable/qgsdualview.cpp b/src/gui/attributetable/qgsdualview.cpp index b130e122ff2d..78bf6eb81750 100644 --- a/src/gui/attributetable/qgsdualview.cpp +++ b/src/gui/attributetable/qgsdualview.cpp @@ -47,7 +47,7 @@ QgsDualView::QgsDualView( QWidget* parent ) connect( mActionExpressionPreview, SIGNAL( triggered() ), SLOT( previewExpressionBuilder() ) ); connect( mPreviewActionMapper, SIGNAL( mapped( QObject* ) ), SLOT( previewColumnChanged( QObject* ) ) ); connect( mFeatureList, SIGNAL( displayExpressionChanged( QString ) ), this, SLOT( previewExpressionChanged( QString ) ) ); - connect( this, SIGNAL( currentChanged(int) ), this, SLOT( saveEditChanges() ) ); + connect( this, SIGNAL( currentChanged( int ) ), this, SLOT( saveEditChanges() ) ); } QgsDualView::~QgsDualView() @@ -62,7 +62,7 @@ void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QgsDista connect( mTableView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) ); connect( layer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) ); - connect( layer, SIGNAL( beforeCommitChanges() ), this, SLOT( editingToggled() ) ); + connect( layer, SIGNAL( beforeCommitChanges() ), this, SLOT( editingToggled() ) ); initLayerCache( layer ); initModels( mapCanvas ); diff --git a/src/gui/attributetable/qgsdualview.h b/src/gui/attributetable/qgsdualview.h index c1cafa0efedd..97eabf4ce106 100644 --- a/src/gui/attributetable/qgsdualview.h +++ b/src/gui/attributetable/qgsdualview.h @@ -136,8 +136,8 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas */ void columnBoxInit(); - virtual void hideEvent(QHideEvent *); - virtual void focusOutEvent(QFocusEvent *); + virtual void hideEvent( QHideEvent * ); + virtual void focusOutEvent( QFocusEvent * ); public slots: /** diff --git a/src/gui/qgsprojectionselector.cpp b/src/gui/qgsprojectionselector.cpp index c8f6104883e3..f1d010e6db56 100644 --- a/src/gui/qgsprojectionselector.cpp +++ b/src/gui/qgsprojectionselector.cpp @@ -83,16 +83,16 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name, } else { - //TODO: createFromProj4 used to save to the user database any new CRS + //TODO: createFromProj4 used to save to the user database any new CRS // this behavior was changed in order to separate creation and saving. - // Not sure if it necessary to save it here, should be checked by someone + // Not sure if it necessary to save it here, should be checked by someone // familiar with the code (should also give a more descriptive name to the generated CRS) - if( crs.srsid() == 0 ) + if ( crs.srsid() == 0 ) { QString myName = QString( " * %1 (%2)" ) - .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) - .arg( crs.toProj4() ); - crs.saveAsUserCRS(myName); + .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) + .arg( crs.toProj4() ); + crs.saveAsUserCRS( myName ); } } } diff --git a/src/gui/qgsrubberband.cpp b/src/gui/qgsrubberband.cpp index cef1a98c5575..08c418b34dd8 100644 --- a/src/gui/qgsrubberband.cpp +++ b/src/gui/qgsrubberband.cpp @@ -163,7 +163,7 @@ void QgsRubberBand::removePoint( int index, bool doUpdate/* = true*/, int geomet { index = mPoints[geometryIndex].size() + index; } - mPoints[geometryIndex].removeAt(index); + mPoints[geometryIndex].removeAt( index ); } if ( doUpdate ) @@ -175,7 +175,7 @@ void QgsRubberBand::removePoint( int index, bool doUpdate/* = true*/, int geomet void QgsRubberBand::removeLastPoint( int geometryIndex ) { - removePoint(-1, true, geometryIndex); + removePoint( -1, true, geometryIndex ); } /*! @@ -487,8 +487,8 @@ void QgsRubberBand::updateRect() qreal s = ( mIconSize - 1 ) / 2; qreal p = mWidth; - QgsRectangle r ( it->x() + mTranslationOffsetX - s - p, it->y() + mTranslationOffsetY - s - p, - it->x() + mTranslationOffsetX + s + p, it->y() + mTranslationOffsetY + s + p ); + QgsRectangle r( it->x() + mTranslationOffsetX - s - p, it->y() + mTranslationOffsetY - s - p, + it->x() + mTranslationOffsetX + s + p, it->y() + mTranslationOffsetY + s + p ); for ( int i = 0; i < mPoints.size(); ++i ) { diff --git a/src/mapserver/qgsprojectparser.cpp b/src/mapserver/qgsprojectparser.cpp index b03fe630bbb4..6a350c9a181d 100644 --- a/src/mapserver/qgsprojectparser.cpp +++ b/src/mapserver/qgsprojectparser.cpp @@ -316,39 +316,39 @@ void QgsProjectParser::describeFeatureType( const QString& aTypeName, QDomElemen QGis::WkbType wkbType = layer->wkbType(); if ( wkbType != QGis::WKBNoGeometry ) { - switch ( wkbType ) - { - case QGis::WKBPoint25D: - case QGis::WKBPoint: - geomElem.setAttribute( "type", "gml:PointPropertyType" ); - break; - case QGis::WKBLineString25D: - case QGis::WKBLineString: - geomElem.setAttribute( "type", "gml:LineStringPropertyType" ); - break; - case QGis::WKBPolygon25D: - case QGis::WKBPolygon: - geomElem.setAttribute( "type", "gml:PolygonPropertyType" ); - break; - case QGis::WKBMultiPoint25D: - case QGis::WKBMultiPoint: - geomElem.setAttribute( "type", "gml:MultiPointPropertyType" ); - break; - case QGis::WKBMultiLineString25D: - case QGis::WKBMultiLineString: - geomElem.setAttribute( "type", "gml:MultiLineStringPropertyType" ); - break; - case QGis::WKBMultiPolygon25D: - case QGis::WKBMultiPolygon: - geomElem.setAttribute( "type", "gml:MultiPolygonPropertyType" ); - break; - default: - geomElem.setAttribute( "type", "gml:GeometryPropertyType" ); - break; - } - geomElem.setAttribute( "minOccurs", "0" ); - geomElem.setAttribute( "maxOccurs", "1" ); - sequenceElem.appendChild( geomElem ); + switch ( wkbType ) + { + case QGis::WKBPoint25D: + case QGis::WKBPoint: + geomElem.setAttribute( "type", "gml:PointPropertyType" ); + break; + case QGis::WKBLineString25D: + case QGis::WKBLineString: + geomElem.setAttribute( "type", "gml:LineStringPropertyType" ); + break; + case QGis::WKBPolygon25D: + case QGis::WKBPolygon: + geomElem.setAttribute( "type", "gml:PolygonPropertyType" ); + break; + case QGis::WKBMultiPoint25D: + case QGis::WKBMultiPoint: + geomElem.setAttribute( "type", "gml:MultiPointPropertyType" ); + break; + case QGis::WKBMultiLineString25D: + case QGis::WKBMultiLineString: + geomElem.setAttribute( "type", "gml:MultiLineStringPropertyType" ); + break; + case QGis::WKBMultiPolygon25D: + case QGis::WKBMultiPolygon: + geomElem.setAttribute( "type", "gml:MultiPolygonPropertyType" ); + break; + default: + geomElem.setAttribute( "type", "gml:GeometryPropertyType" ); + break; + } + geomElem.setAttribute( "minOccurs", "0" ); + geomElem.setAttribute( "maxOccurs", "1" ); + sequenceElem.appendChild( geomElem ); } const QgsFields& fields = provider->fields(); diff --git a/src/mapserver/qgssldparser.cpp b/src/mapserver/qgssldparser.cpp index 58699deaa38c..96a654d56c85 100644 --- a/src/mapserver/qgssldparser.cpp +++ b/src/mapserver/qgssldparser.cpp @@ -1524,16 +1524,16 @@ void QgsSLDParser::setCrsForLayer( const QDomElement& layerElem, QgsMapLayer* ml { QgsCoordinateReferenceSystem srs; srs.createFromProj4( projString ); - //TODO: createFromProj4 used to save to the user database any new CRS + //TODO: createFromProj4 used to save to the user database any new CRS // this behavior was changed in order to separate creation and saving. - // Not sure if it necessary to save it here, should be checked by someone + // Not sure if it necessary to save it here, should be checked by someone // familiar with the code (should also give a more descriptive name to the generated CRS) - if( srs.srsid() == 0 ) + if ( srs.srsid() == 0 ) { QString myName = QString( " * %1 (%2)" ) - .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) - .arg( srs.toProj4() ); - srs.saveAsUserCRS(myName); + .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) + .arg( srs.toProj4() ); + srs.saveAsUserCRS( myName ); } ml->setCrs( srs ); diff --git a/src/mapserver/qgswfsserver.cpp b/src/mapserver/qgswfsserver.cpp index 713349dbac2e..823336a2ea9c 100644 --- a/src/mapserver/qgswfsserver.cpp +++ b/src/mapserver/qgswfsserver.cpp @@ -820,13 +820,13 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format if ( layer->wkbType() != QGis::WKBNoGeometry ) { req.setFilterRect( searchRect ) - .setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) ); + .setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) ); } QgsFeatureIterator fit = layer->getFeatures( req ); QgsExpression *mFilter = new QgsExpression( expFilter ); if ( mFilter->hasParserError() ) { - throw QgsMapServiceException( "RequestNotWellFormed",QString( "Expression filter error message: %1." ).arg( mFilter->parserErrorString() ) ); + throw QgsMapServiceException( "RequestNotWellFormed", QString( "Expression filter error message: %1." ).arg( mFilter->parserErrorString() ) ); } if ( mFilter ) { @@ -934,7 +934,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format if ( layer->wkbType() != QGis::WKBNoGeometry ) { req.setFilterRect( searchRect ) - .setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) ); + .setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) ); } QgsFeatureIterator fit = layer->getFeatures( req ); while ( fit.nextFeature( feature ) && featureCounter < maxFeat ) @@ -965,7 +965,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format if ( layer->wkbType() != QGis::WKBNoGeometry ) { req.setFilterRect( searchRect ) - .setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) ); + .setFlags( QgsFeatureRequest::ExactIntersect | ( mWithGeom ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) ); } QgsFeatureIterator fit = layer->getFeatures( req ); while ( fit.nextFeature( feature ) && featureCounter < maxFeat ) diff --git a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp index 8b24687145d8..7d660ed9d39e 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp @@ -49,8 +49,8 @@ bool QgsDelimitedTextFeatureIterator::nextFeature( QgsFeature& feature ) if ( mClosed ) return false; - bool gotFeature = P->nextFeature(feature,P->mFile,mRequest); - if( ! gotFeature ) close(); + bool gotFeature = P->nextFeature( feature, P->mFile, mRequest ); + if ( ! gotFeature ) close(); return gotFeature; } diff --git a/src/providers/delimitedtext/qgsdelimitedtextfile.cpp b/src/providers/delimitedtext/qgsdelimitedtextfile.cpp index dd8d4d1bc891..c021ec8f97f8 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextfile.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextfile.cpp @@ -378,7 +378,7 @@ void QgsDelimitedTextFile::setFieldNames( const QStringList &names ) bool nameOk = true; int fieldNo = mFieldNames.size() + 1; name = name.trimmed(); - if( name.length() > mMaxNameLength ) name=name.mid(0,mMaxNameLength ); + if ( name.length() > mMaxNameLength ) name = name.mid( 0, mMaxNameLength ); // If the name is invalid then reset it to default name if ( InvalidFieldRegexp.exactMatch( name ) ) diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp index ef96f4bd9d2f..14861ba22641 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp @@ -61,7 +61,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri ) , mWktHasZM( false ) , mWktHasPrefix( false ) , mXyDms( false ) - , mSubsetString("") + , mSubsetString( "" ) , mSubsetExpression( 0 ) , mMaxInvalidLines( 50 ) , mShowInvalidLines( true ) @@ -125,9 +125,9 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri ) QgsDebugMsg( "xField is: " + xField ); QgsDebugMsg( "yField is: " + yField ); - if( url.hasQueryItem( "subset" )) + if ( url.hasQueryItem( "subset" ) ) { - subset = url.queryItemValue("subset"); + subset = url.queryItemValue( "subset" ); QgsDebugMsg( "subset is: " + subset ); } @@ -401,7 +401,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri ) reportErrors( warnings ); mValid = mGeometryType != QGis::UnknownGeometry; - if( ! subset.isEmpty()) + if ( ! subset.isEmpty() ) { setSubsetString( subset ); } @@ -511,7 +511,7 @@ QgsDelimitedTextProvider::~QgsDelimitedTextProvider() mFile = 0; } - if( mSubsetExpression ) + if ( mSubsetExpression ) { delete mSubsetExpression; mSubsetExpression = 0; @@ -616,52 +616,52 @@ bool QgsDelimitedTextProvider::setSubsetString( QString subset, bool updateFeatu // If there is a new subset string then encode it.. QgsExpression *expression = 0; - if( ! subset.isEmpty() ) + if ( ! subset.isEmpty() ) { expression = new QgsExpression( subset ); QString error; - if( expression->hasParserError()) + if ( expression->hasParserError() ) { error = expression->parserErrorString(); } else { expression->prepare( fields() ); - if( expression->hasEvalError() ) + if ( expression->hasEvalError() ) { error = expression->evalErrorString(); } } - if( ! error.isEmpty() ) + if ( ! error.isEmpty() ) { valid = false; delete expression; expression = 0; QString tag( "DelimitedText" ); - QgsMessageLog::logMessage( tr( "Invalid subset string %1 for %2" ).arg(subset).arg( mFile->fileName() ), tag ); + QgsMessageLog::logMessage( tr( "Invalid subset string %1 for %2" ).arg( subset ).arg( mFile->fileName() ), tag ); } } // if the expression is valid, then reset the subset string and data source Uri - if( valid ) + if ( valid ) { - if( mSubsetExpression ) delete mSubsetExpression; + if ( mSubsetExpression ) delete mSubsetExpression; mSubsetString = subset; mSubsetExpression = expression; // Encode the subset string into the data source URI. QUrl url = QUrl::fromEncoded( dataSourceUri().toAscii() ); - if( url.hasQueryItem("subset")) url.removeAllQueryItems("subset"); - if( ! subset.isEmpty()) url.addQueryItem("subset",subset); + if ( url.hasQueryItem( "subset" ) ) url.removeAllQueryItems( "subset" ); + if ( ! subset.isEmpty() ) url.addQueryItem( "subset", subset ); setDataSourceUri( QString::fromAscii( url.toEncoded() ) ); // Update the feature count and extents if requested - if( updateFeatureCount ) + if ( updateFeatureCount ) { resetDataSummary(); } @@ -672,22 +672,22 @@ bool QgsDelimitedTextProvider::setSubsetString( QString subset, bool updateFeatu void QgsDelimitedTextProvider::resetDataSummary() { - QgsFeatureIterator fi = getFeatures(QgsFeatureRequest()); + QgsFeatureIterator fi = getFeatures( QgsFeatureRequest() ); mNumberFeatures = 0; mExtent = QgsRectangle(); QgsFeature f; - while( fi.nextFeature(f)) + while ( fi.nextFeature( f ) ) { - if( mGeometryType != QGis::NoGeometry ) + if ( mGeometryType != QGis::NoGeometry ) { - if( mNumberFeatures == 0 ) + if ( mNumberFeatures == 0 ) { mExtent = f.geometry()->boundingBox(); } else { - QgsRectangle bbox( f.geometry()->boundingBox()); - mExtent.combineExtentWith( &bbox); + QgsRectangle bbox( f.geometry()->boundingBox() ); + mExtent.combineExtentWith( &bbox ); } } mNumberFeatures++; @@ -708,7 +708,7 @@ bool QgsDelimitedTextProvider::nextFeature( QgsFeature& feature, QgsDelimitedTex if ( status != QgsDelimitedTextFile::RecordOk ) continue; int fid = file->recordLineNumber(); - if( request.filterType() == QgsFeatureRequest::FilterFid && fid != request.filterFid()) continue; + if ( request.filterType() == QgsFeatureRequest::FilterFid && fid != request.filterFid() ) continue; if ( recordIsEmpty( tokens ) ) continue; while ( tokens.size() < mFieldCount ) @@ -725,7 +725,7 @@ bool QgsDelimitedTextProvider::nextFeature( QgsFeature& feature, QgsDelimitedTex } else if ( mXFieldIndex >= 0 && mYFieldIndex >= 0 ) { - geom = loadGeometryXY( tokens,request ); + geom = loadGeometryXY( tokens, request ); } if ( !geom && mWkbType != QGis::WKBNoGeometry ) @@ -767,11 +767,11 @@ bool QgsDelimitedTextProvider::nextFeature( QgsFeature& feature, QgsDelimitedTex // Are we using a subset expression, if so try and evaluate // and accept result if passes. - if( mSubsetExpression ) + if ( mSubsetExpression ) { QVariant isOk = mSubsetExpression->evaluate( &feature ); - if( mSubsetExpression->hasEvalError() ) continue; - if( ! isOk.toBool() ) continue; + if ( mSubsetExpression->hasEvalError() ) continue; + if ( ! isOk.toBool() ) continue; } // We have a good line, so return @@ -848,9 +848,9 @@ bool QgsDelimitedTextProvider::boundsCheck( QgsGeometry *geom, const QgsFeatureR void QgsDelimitedTextProvider::fetchAttribute( QgsFeature& feature, int fieldIdx, const QStringList& tokens ) { - if( fieldIdx < 0 || fieldIdx >= attributeColumns.count()) return; + if ( fieldIdx < 0 || fieldIdx >= attributeColumns.count() ) return; int column = attributeColumns[fieldIdx]; - if( column < 0 || column >= tokens.count()) return; + if ( column < 0 || column >= tokens.count() ) return; const QString &value = tokens[column]; QVariant val; switch ( attributeFields[fieldIdx].type() ) diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.h b/src/providers/delimitedtext/qgsdelimitedtextprovider.h index bdccba70a30a..ecf5a500a69b 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.h +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.h @@ -197,7 +197,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider void resetStream(); bool recordIsEmpty( QStringList &record ); bool nextFeature( QgsFeature& feature, QgsDelimitedTextFile *file, const QgsFeatureRequest& request ); - QgsGeometry* loadGeometryWkt( const QStringList& tokens, const QgsFeatureRequest& request); + QgsGeometry* loadGeometryWkt( const QStringList& tokens, const QgsFeatureRequest& request ); QgsGeometry* loadGeometryXY( const QStringList& tokens, const QgsFeatureRequest& request ); bool boundsCheck( const QgsPoint &pt, const QgsFeatureRequest& request ); bool boundsCheck( QgsGeometry *geom, const QgsFeatureRequest& request ); diff --git a/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp b/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp index 0fe8c56d4bad..e0e572f15b4f 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp @@ -30,7 +30,7 @@ #include #include -const int MAX_SAMPLE_LENGTH=200; +const int MAX_SAMPLE_LENGTH = 200; QgsDelimitedTextSourceSelect::QgsDelimitedTextSourceSelect( QWidget * parent, Qt::WFlags fl, bool embedded ): QDialog( parent, fl ), @@ -53,7 +53,7 @@ QgsDelimitedTextSourceSelect::QgsDelimitedTextSourceSelect( QWidget * parent, Qt } cmbEncoding->clear(); - cmbEncoding->addItems( QgsVectorDataProvider::availableEncodings()); + cmbEncoding->addItems( QgsVectorDataProvider::availableEncodings() ); cmbEncoding->setCurrentIndex( cmbEncoding->findText( "UTF-8" ) ); loadSettings(); @@ -420,7 +420,7 @@ void QgsDelimitedTextSourceSelect::updateFieldLists() for ( int i = 0; i < tblSample->columnCount(); i++ ) { QString value = i < nv ? values[i] : ""; - if( value.length() > MAX_SAMPLE_LENGTH ) value = value.mid(0,MAX_SAMPLE_LENGTH)+"..."; + if ( value.length() > MAX_SAMPLE_LENGTH ) value = value.mid( 0, MAX_SAMPLE_LENGTH ) + "..."; QTableWidgetItem *item = new QTableWidgetItem( value ); tblSample->setItem( counter - 1, i, item ); if ( ! value.isEmpty() ) @@ -685,9 +685,9 @@ bool QgsDelimitedTextSourceSelect::validate() else if ( tblSample->rowCount() == 0 ) { message = tr( "No data found in file" ); - if( mBadRowCount > 0 ) + if ( mBadRowCount > 0 ) { - message = message + " (" + tr("%1 badly formatted records discarded").arg(mBadRowCount)+")"; + message = message + " (" + tr( "%1 badly formatted records discarded" ).arg( mBadRowCount ) + ")"; } } else if ( geomTypeXY->isChecked() && ( cmbXField->currentText().isEmpty() || cmbYField->currentText().isEmpty() ) ) @@ -705,9 +705,9 @@ bool QgsDelimitedTextSourceSelect::validate() else { enabled = true; - if( mBadRowCount > 0 ) + if ( mBadRowCount > 0 ) { - message = tr("%1 badly formatted records discarded from sample data").arg(mBadRowCount); + message = tr( "%1 badly formatted records discarded from sample data" ).arg( mBadRowCount ); } } diff --git a/src/providers/grass/qgsgrassgislib.cpp b/src/providers/grass/qgsgrassgislib.cpp index ccab1407f3a3..2ecf131389f8 100644 --- a/src/providers/grass/qgsgrassgislib.cpp +++ b/src/providers/grass/qgsgrassgislib.cpp @@ -221,16 +221,16 @@ int GRASS_LIB_EXPORT QgsGrassGisLib::G__gisinit( const char * version, const cha { fatal( "Cannot create CRS from QGIS_GRASS_CRS: " + crsStr ); } - //TODO: createFromProj4 used to save to the user database any new CRS + //TODO: createFromProj4 used to save to the user database any new CRS // this behavior was changed in order to separate creation and saving. - // Not sure if it necessary to save it here, should be checked by someone + // Not sure if it necessary to save it here, should be checked by someone // familiar with the code (should also give a more descriptive name to the generated CRS) - if( mCrs.srsid() == 0 ) + if ( mCrs.srsid() == 0 ) { QString myName = QString( " * %1 (%2)" ) - .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) - .arg( mCrs.toProj4() ); - mCrs.saveAsUserCRS(myName); + .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) + .arg( mCrs.toProj4() ); + mCrs.saveAsUserCRS( myName ); } } mDistanceArea.setSourceCrs( mCrs.srsid() ); diff --git a/src/providers/spatialite/qgsspatialiteprovider.cpp b/src/providers/spatialite/qgsspatialiteprovider.cpp index 4f1c07daae3f..b59c309923e0 100644 --- a/src/providers/spatialite/qgsspatialiteprovider.cpp +++ b/src/providers/spatialite/qgsspatialiteprovider.cpp @@ -3200,16 +3200,16 @@ QgsCoordinateReferenceSystem QgsSpatiaLiteProvider::crs() if ( !srs.isValid() ) { srs.createFromProj4( mProj4text ); - //TODO: createFromProj4 used to save to the user database any new CRS + //TODO: createFromProj4 used to save to the user database any new CRS // this behavior was changed in order to separate creation and saving. - // Not sure if it necessary to save it here, should be checked by someone + // Not sure if it necessary to save it here, should be checked by someone // familiar with the code (should also give a more descriptive name to the generated CRS) - if( srs.srsid() == 0 ) + if ( srs.srsid() == 0 ) { QString myName = QString( " * %1 (%2)" ) - .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) - .arg( srs.toProj4() ); - srs.saveAsUserCRS(myName); + .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) + .arg( srs.toProj4() ); + srs.saveAsUserCRS( myName ); } } diff --git a/src/providers/sqlanywhere/qgssqlanywhereprovider.cpp b/src/providers/sqlanywhere/qgssqlanywhereprovider.cpp index 02d31a70f2f0..dac37fd3de6b 100644 --- a/src/providers/sqlanywhere/qgssqlanywhereprovider.cpp +++ b/src/providers/sqlanywhere/qgssqlanywhereprovider.cpp @@ -1886,16 +1886,16 @@ QgsSqlAnywhereProvider::checkSrs() SaDebugMsg( "Failed to create CRS from Proj4 description. Trying WKT." ); mCrs.createFromWkt( srsWkt ); } - //TODO: createFromProj4 used to save to the user database any new CRS + //TODO: createFromProj4 used to save to the user database any new CRS // this behavior was changed in order to separate creation and saving. - // Not sure if it necessary to save it here, should be checked by someone + // Not sure if it necessary to save it here, should be checked by someone // familiar with the code (should also give a more descriptive name to the generated CRS) - if( mCrs.srsid() == 0 ) + if ( mCrs.srsid() == 0 ) { QString myName = QString( " * %1 (%2)" ) - .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) - .arg( mCrs.toProj4() ); - mCrs.saveAsUserCRS(myName); + .arg( QObject::tr( "Generated CRS", "A CRS automatically generated from layer info get this prefix for description" ) ) + .arg( mCrs.toProj4() ); + mCrs.saveAsUserCRS( myName ); } return true; diff --git a/tests/src/core/testqgsblendmodes.cpp b/tests/src/core/testqgsblendmodes.cpp index a2ccbb90375a..2d3d16ea0622 100644 --- a/tests/src/core/testqgsblendmodes.cpp +++ b/tests/src/core/testqgsblendmodes.cpp @@ -51,8 +51,8 @@ class TestQgsBlendModes: public QObject QgsMapRenderer * mpMapRenderer; QgsMapLayer * mpPointsLayer; QgsMapLayer * mpPolysLayer; - QgsRasterLayer* mRasterLayer1; - QgsRasterLayer* mRasterLayer2; + QgsRasterLayer* mRasterLayer1; + QgsRasterLayer* mRasterLayer2; QString mTestDataDir; }; @@ -84,20 +84,20 @@ void TestQgsBlendModes::initTestCase() myPolyFileInfo.completeBaseName(), "ogr" ); QgsMapLayerRegistry::instance()->addMapLayers( QList() << mpPolysLayer ); - + //create two raster layers QFileInfo rasterFileInfo( mTestDataDir + "landsat.tif" ); mRasterLayer1 = new QgsRasterLayer( rasterFileInfo.filePath(), - rasterFileInfo.completeBaseName() ); + rasterFileInfo.completeBaseName() ); mRasterLayer2 = new QgsRasterLayer( rasterFileInfo.filePath(), - rasterFileInfo.completeBaseName() ); + rasterFileInfo.completeBaseName() ); QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer1->dataProvider(), 2, 3, 4 ); mRasterLayer1->setRenderer( rasterRenderer ); - mRasterLayer2->setRenderer( rasterRenderer ); + mRasterLayer2->setRenderer( rasterRenderer ); QgsMapLayerRegistry::instance()->addMapLayers( QList() << mRasterLayer1 ); QgsMapLayerRegistry::instance()->addMapLayers( - QList() << mRasterLayer2); + QList() << mRasterLayer2 ); mpMapRenderer = new QgsMapRenderer(); } @@ -113,7 +113,7 @@ void TestQgsBlendModes::vectorBlending() myLayers << mpPointsLayer->id(); myLayers << mpPolysLayer->id(); mpMapRenderer->setLayerSet( myLayers ); - + //Set blending modes for both layers mpPointsLayer->setBlendMode( QPainter::CompositionMode_Overlay ); mpPolysLayer->setBlendMode( QPainter::CompositionMode_Multiply ); @@ -126,10 +126,10 @@ void TestQgsBlendModes::rasterBlending() //Add two raster layers to map renderer QStringList myLayers; myLayers << mRasterLayer1->id(); - myLayers << mRasterLayer2->id(); + myLayers << mRasterLayer2->id(); mpMapRenderer->setLayerSet( myLayers ); mpMapRenderer->setExtent( mRasterLayer1->extent() ); - + // set blending mode for top layer mRasterLayer1->setBlendMode( QPainter::CompositionMode_Plus ); QVERIFY( imageCheck( "raster_blendmodes" ) ); diff --git a/tests/src/core/testqgsvectorlayercache.cpp b/tests/src/core/testqgsvectorlayercache.cpp index f6e2db7f753c..e02e3ce4bfa4 100644 --- a/tests/src/core/testqgsvectorlayercache.cpp +++ b/tests/src/core/testqgsvectorlayercache.cpp @@ -219,7 +219,7 @@ void TestVectorLayerCache::testSubsetRequest() mVectorLayerCache->featureAtId( 16, f ); QVariant a = f.attribute( 3 ); - QgsFeatureIterator itSubset = mVectorLayerCache->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( requiredFields, fields) ); + QgsFeatureIterator itSubset = mVectorLayerCache->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( requiredFields, fields ) ); while ( itSubset.nextFeature( f ) ) {} itSubset.close(); diff --git a/tests/src/core/testziplayer.cpp b/tests/src/core/testziplayer.cpp old mode 100755 new mode 100644 index d7abfaa696ba..301d27dfb715 --- a/tests/src/core/testziplayer.cpp +++ b/tests/src/core/testziplayer.cpp @@ -78,12 +78,12 @@ class TestZipLayer: public QObject void testZipItemAll(); void testTarItemAll(); // test that styles are loaded from .qml files outside zip files - #if 0 +#if 0 // TODO - find a simple way to test vector style loading void testZipItemVectorTransparency(); void testTarItemVectorTransparency(); void testGzipItemVectorTransparency(); - #endif +#endif void testZipItemRasterTransparency(); void testTarItemRasterTransparency(); void testGzipItemRasterTransparency(); @@ -235,7 +235,7 @@ int TestZipLayer::getLayerTransparency( QString myFileName, QString myProviderKe QgsRasterLayer* layer = dynamic_cast( myLayer ); if ( layer && layer->renderer() ) { - myTransparency = ceil(layer->renderer()->opacity() * 255); + myTransparency = ceil( layer->renderer()->opacity() * 255 ); } } } diff --git a/tests/src/gui/testqgsrubberband.cpp b/tests/src/gui/testqgsrubberband.cpp index c3815d02ee0b..0599008e8246 100644 --- a/tests/src/gui/testqgsrubberband.cpp +++ b/tests/src/gui/testqgsrubberband.cpp @@ -61,7 +61,7 @@ void TestQgsRubberband::initTestCase() QString myPolygonFileName = mTestDataDir + "polys.shp"; QFileInfo myPolygonFileInfo( myPolygonFileName ); mPolygonLayer = new QgsVectorLayer( myPolygonFileInfo.filePath(), - myPolygonFileInfo.completeBaseName(), "ogr" ); + myPolygonFileInfo.completeBaseName(), "ogr" ); mCanvas = new QgsMapCanvas(); mRubberband = 0; diff --git a/tests/src/python/test_qgscomposereffects.py b/tests/src/python/test_qgscomposereffects.py index 505dd9069b56..465035417f15 100644 --- a/tests/src/python/test_qgscomposereffects.py +++ b/tests/src/python/test_qgscomposereffects.py @@ -45,7 +45,7 @@ def __init__(self, methodName): self.mMapRenderer = QgsMapRenderer() self.mComposition = QgsComposition(self.mMapRenderer) self.mComposition.setPaperSize(297, 210) - + self.mComposerRect1 = QgsComposerShape(20, 20, 150, 100, self.mComposition) self.mComposerRect1.setShapeType(QgsComposerShape.Rectangle) self.mComposerRect1.setBackgroundColor(QColor.fromRgb(255, 150, 0)) @@ -54,11 +54,11 @@ def __init__(self, methodName): self.mComposerRect2 = QgsComposerShape(50, 50, 150, 100, self.mComposition) self.mComposerRect2.setShapeType(QgsComposerShape.Rectangle) self.mComposerRect2.setBackgroundColor(QColor.fromRgb(0, 100, 150)) - self.mComposition.addComposerShape(self.mComposerRect2) + self.mComposition.addComposerShape(self.mComposerRect2) def testBlendModes(self): """Test that blend modes work for composer items.""" - + self.mComposerRect2.setBlendMode(QPainter.CompositionMode_Multiply) checker = QgsCompositionChecker() @@ -74,7 +74,7 @@ def testBlendModes(self): def testTransparency(self): """Test that transparency works for composer items.""" - + self.mComposerRect2.setTransparency( 50 ) checker = QgsCompositionChecker() diff --git a/tests/src/python/test_qgscomposermap.py b/tests/src/python/test_qgscomposermap.py index 1c8a4383d11d..e940325b9da1 100644 --- a/tests/src/python/test_qgscomposermap.py +++ b/tests/src/python/test_qgscomposermap.py @@ -151,7 +151,7 @@ def testOverviewMapBlend(self): myPngPath) self.mComposition.removeComposerItem(overviewMap) assert myTestResult == True, myMessage - + def testOverviewMapInvert(self): overviewMap = QgsComposerMap(self.mComposition, 20, 130, 70, 70) overviewMap.setFrameEnabled(True) @@ -176,7 +176,7 @@ def testOverviewMapInvert(self): myPngPath) self.mComposition.removeComposerItem(overviewMap) assert myTestResult == True, myMessage - + # Fails because addItemsFromXML has been commented out in sip @expectedFailure def testuniqueId(self): diff --git a/tests/src/python/test_qgsdelimitedtextprovider.py b/tests/src/python/test_qgsdelimitedtextprovider.py index 782d72f5dea2..ea831fce95d1 100644 --- a/tests/src/python/test_qgsdelimitedtextprovider.py +++ b/tests/src/python/test_qgsdelimitedtextprovider.py @@ -274,7 +274,7 @@ def runTest( name, wanted, file, requests, **params ): msg='Missing log message: '+l print ' '+msg failures.append(msg) - + for l in log: msg='Extra log message: '+l print ' '+msg @@ -1397,8 +1397,8 @@ def test_030_filter_rect_xy(self): filename='testextpt.txt' params={'yField': 'y', 'delimiter': '|', 'type': 'csv', 'xField': 'x'} requests=[ - {'extents': [10, 30, 30, 50]}, - {'extents': [10, 30, 30, 50], 'exact': 1}, + {'extents': [10, 30, 30, 50]}, + {'extents': [10, 30, 30, 50], 'exact': 1}, {'extents': [110, 130, 130, 150]}] if rebuildTests: createTest(description,filename,requests,**params) @@ -1449,8 +1449,8 @@ def test_031_filter_rect_wkt(self): filename='testextw.txt' params={'delimiter': '|', 'type': 'csv', 'wktField': 'wkt'} requests=[ - {'extents': [10, 30, 30, 50]}, - {'extents': [10, 30, 30, 50], 'exact': 1}, + {'extents': [10, 30, 30, 50]}, + {'extents': [10, 30, 30, 50], 'exact': 1}, {'extents': [110, 130, 130, 150]}] if rebuildTests: createTest(description,filename,requests,**params) @@ -1517,10 +1517,10 @@ def test_032_filter_fid(self): filename='test.csv' params={'geomType': 'none', 'type': 'csv'} requests=[ - {'fid': 3}, - {'fid': 9}, - {'fid': 5}, - {'fid': 7}, + {'fid': 3}, + {'fid': 9}, + {'fid': 5}, + {'fid': 7}, {'fid': 3}] if rebuildTests: createTest(description,filename,requests,**params) @@ -1576,11 +1576,11 @@ def test_033_filter_attributes(self): filename='test.csv' params={'geomType': 'none', 'type': 'csv'} requests=[ - {'attributes': [1, 3]}, - {'fid': 9}, - {'attributes': [1, 3], 'fid': 9}, - {'attributes': [3, 1], 'fid': 9}, - {'attributes': [1, 3, 7], 'fid': 9}, + {'attributes': [1, 3]}, + {'fid': 9}, + {'attributes': [1, 3], 'fid': 9}, + {'attributes': [3, 1], 'fid': 9}, + {'attributes': [1, 3, 7], 'fid': 9}, {'attributes': [], 'fid': 9}] if rebuildTests: createTest(description,filename,requests,**params)