Skip to content
Permalink
Browse files

indentation update

  • Loading branch information
jef-n committed May 1, 2013
1 parent 334f43e commit d0aa1e47e80725b3d632044c2cbdd16426cb2ee7
Showing with 450 additions and 450 deletions.
  1. +7 −7 python/console/console.py
  2. +26 −25 python/console/console_editor.py
  3. +2 −2 python/console/console_output.py
  4. +2 −2 python/console/console_sci.py
  5. +11 −11 python/console/console_settings.py
  6. +2 −2 python/plugins/GdalTools/tools/doRasterize.py
  7. +9 −9 python/plugins/sextante/SextantePlugin.py
  8. +5 −5 python/plugins/sextante/algs/ftools/Dissolve.py
  9. +1 −1 python/plugins/sextante/algs/mmqgisx/MMQGISXAlgorithms.py
  10. +48 −48 python/plugins/sextante/commander/CommanderWindow.py
  11. +4 −4 python/plugins/sextante/core/LayerExporter.py
  12. +5 −5 python/plugins/sextante/core/Sextante.py
  13. +2 −2 python/plugins/sextante/core/SextanteConfig.py
  14. +5 −5 python/plugins/sextante/grass/GrassUtils.py
  15. +2 −2 python/plugins/sextante/gui/AlgorithmExecutionDialog.py
  16. +1 −1 python/plugins/sextante/gui/AlgorithmExecutor.py
  17. +7 −7 python/plugins/sextante/gui/ConfigDialog.py
  18. +1 −1 python/plugins/sextante/gui/UnthreadedAlgorithmExecutor.py
  19. +19 −19 python/plugins/sextante/modeler/ModelerArrowItem.py
  20. +3 −3 python/plugins/sextante/modeler/ModelerDialog.py
  21. +67 −68 python/plugins/sextante/modeler/ModelerGraphicItem.py
  22. +3 −3 python/plugins/sextante/modeler/ModelerParameterDefinitionDialog.py
  23. +2 −2 python/plugins/sextante/modeler/ModelerScene.py
  24. +4 −4 python/plugins/sextante/otb/OTBUtils.py
  25. +3 −3 python/plugins/sextante/saga/SagaUtils.py
  26. +22 −22 src/app/qgisappinterface.cpp
  27. +1 −1 src/app/qgisappinterface.h
  28. +1 −1 src/app/qgsmaptoolcapture.cpp
  29. +1 −1 src/core/diagram/qgshistogramdiagram.cpp
  30. +2 −2 src/core/qgscacheindexfeatureid.cpp
  31. +19 −19 src/core/qgscoordinatereferencesystem.cpp
  32. +2 −2 src/core/qgscoordinatereferencesystem.h
  33. +6 −6 src/core/qgsdistancearea.cpp
  34. +2 −2 src/core/qgsmaplayerregistry.h
  35. +1 −1 src/core/qgsproject.cpp
  36. +1 −1 src/core/qgsvectorlayercache.h
  37. +1 −1 src/core/qgsvectorlayerfeatureiterator.cpp
  38. +1 −1 src/core/raster/qgsrasterfilewriter.h
  39. +2 −2 src/gui/attributetable/qgsdualview.cpp
  40. +2 −2 src/gui/attributetable/qgsdualview.h
  41. +6 −6 src/gui/qgsprojectionselector.cpp
  42. +4 −4 src/gui/qgsrubberband.cpp
  43. +33 −33 src/mapserver/qgsprojectparser.cpp
  44. +6 −6 src/mapserver/qgssldparser.cpp
  45. +4 −4 src/mapserver/qgswfsserver.cpp
  46. +2 −2 src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp
  47. +1 −1 src/providers/delimitedtext/qgsdelimitedtextfile.cpp
  48. +28 −28 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  49. +1 −1 src/providers/delimitedtext/qgsdelimitedtextprovider.h
  50. +7 −7 src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
  51. +6 −6 src/providers/grass/qgsgrassgislib.cpp
  52. +6 −6 src/providers/spatialite/qgsspatialiteprovider.cpp
  53. +6 −6 src/providers/sqlanywhere/qgssqlanywhereprovider.cpp
  54. +10 −10 tests/src/core/testqgsblendmodes.cpp
  55. +1 −1 tests/src/core/testqgsvectorlayercache.cpp
  56. +3 −3 tests/src/core/testziplayer.cpp
  57. +1 −1 tests/src/gui/testqgsrubberband.cpp
  58. +4 −4 tests/src/python/test_qgscomposereffects.py
  59. +2 −2 tests/src/python/test_qgscomposermap.py
  60. +14 −14 tests/src/python/test_qgsdelimitedtextprovider.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':
@@ -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,15 +590,15 @@ 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)"))
# If the user didn't select a file, abort the save operation
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 <b>"%s"</b> has been modified, save changes ?'
'The file <b>"%s"</b> 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):
@@ -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()
@@ -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, "<input>")
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()
@@ -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':
@@ -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()

2 comments on commit d0aa1e4

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied May 1, 2013

Is there an automated command you used to clean all these files? I know about the prepare-commit script, but wasn't aware if there was a similar command for qgis python scripts.

@jef-n

This comment has been minimized.

Copy link
Member Author

@jef-n jef-n replied May 1, 2013

prepare-commit also works for python files.

Please sign in to comment.
You can’t perform that action at this time.