Skip to content

Commit d0aa1e4

Browse files
committedMay 1, 2013
indentation update
1 parent 334f43e commit d0aa1e4

File tree

60 files changed

+450
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+450
-450
lines changed
 

‎python/console/console.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,22 @@ def __init__(self, parent=None):
109109
self.splitter.addWidget(self.shellOut)
110110
self.splitter.addWidget(self.shell)
111111
#self.splitterEditor.addWidget(self.tabEditorWidget)
112-
112+
113113
self.splitterObj = QSplitter(self.splitterEditor)
114114
self.splitterObj.setHandleWidth(3)
115115
self.splitterObj.setOrientation(Qt.Horizontal)
116116
#self.splitterObj.setSizes([0, 0])
117117
#self.splitterObj.setStretchFactor(0, 1)
118-
118+
119119
self.widgetEditor = QWidget(self.splitterObj)
120-
120+
121121
self.listClassMethod = QTreeWidget(self.splitterObj)
122122
self.listClassMethod.setColumnCount(2)
123123
self.listClassMethod.setHeaderLabels(['Object', 'Line'])
124124
self.listClassMethod.setColumnHidden(1, True)
125125
self.listClassMethod.setAlternatingRowColors(True)
126126

127-
127+
128128
#self.splitterEditor.addWidget(self.widgetEditor)
129129
#self.splitterObj.addWidget(self.listClassMethod)
130130
#self.splitterObj.addWidget(self.widgetEditor)
@@ -528,7 +528,7 @@ def uncommentCode(self):
528528
# if line != "\n":
529529
# listScriptFile.append(line)
530530
# self.shell.insertTextFromFile(listScriptFile)
531-
#
531+
#
532532
# lastDirPath = QFileInfo(scriptFile).path()
533533
# settings.setValue("pythonConsole/lastDirPath", QVariant(scriptFile))
534534
#
@@ -538,7 +538,7 @@ def uncommentCode(self):
538538
# scriptFile.setDefaultSuffix(".py")
539539
# fName = scriptFile.getSaveFileName(
540540
# self, "Save file", QString(), "Script file (*.py)")
541-
#
541+
#
542542
# if fName.isEmpty() == False:
543543
# filename = str(fName)
544544
# if not filename.endswith(".py"):
@@ -616,7 +616,7 @@ def callWidgetMessageBar(self, text):
616616
def callWidgetMessageBarEditor(self, text, level, timed):
617617
self.tabEditorWidget.widgetMessageBar(iface, text, level, timed)
618618

619-
def updateTabListScript(self, script, action=None):
619+
def updateTabListScript(self, script, action=None):
620620
if script != '':
621621
settings = QSettings()
622622
if script == 'empty':

‎python/console/console_editor.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ def get_handler(self, key, modifier):
6464
if modifiers == modifier:
6565
return handler
6666
return None
67-
67+
6868
def eventFilter(self, obj, event):
6969
if event.type() == QEvent.KeyPress and event.key() < 256:
7070
handler = self.get_handler(event.key(), event.modifiers())
7171
if handler:
72-
handler(self.window, self.tab)
72+
handler(self.window, self.tab)
7373
return QObject.eventFilter(self, obj, event)
7474

7575
class Editor(QsciScintilla):
@@ -127,12 +127,12 @@ def __init__(self, parent=None):
127127
#self.setWrapMode(QsciScintilla.WrapCharacter)
128128
self.setWhitespaceVisibility(QsciScintilla.WsVisibleAfterIndent)
129129
#self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
130-
130+
131131
self.settingsEditor()
132-
132+
133133
# Annotations
134134
#self.setAnnotationDisplay(QsciScintilla.ANNOTATION_BOXED)
135-
135+
136136
# Indentation
137137
self.setAutoIndent(True)
138138
self.setIndentationsUseTabs(False)
@@ -161,7 +161,7 @@ def __init__(self, parent=None):
161161
self.runScriptScut = QShortcut(QKeySequence(Qt.SHIFT + Qt.CTRL + Qt.Key_E), self)
162162
self.runScriptScut.setContext(Qt.WidgetShortcut)
163163
self.runScriptScut.activated.connect(self.runScriptCode)
164-
164+
165165
self.commentScut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_3), self)
166166
self.commentScut.setContext(Qt.WidgetShortcut)
167167
self.commentScut.activated.connect(self.parent.pc.commentCode)
@@ -295,8 +295,8 @@ def contextMenuEvent(self, e):
295295
menu.addSeparator()
296296
commentCodeAction = menu.addAction(iconCommentEditor, "Comment",
297297
self.parent.pc.commentCode, 'Ctrl+3')
298-
uncommentCodeAction = menu.addAction(iconUncommentEditor, "Uncomment",
299-
self.parent.pc.uncommentCode,
298+
uncommentCodeAction = menu.addAction(iconUncommentEditor, "Uncomment",
299+
self.parent.pc.uncommentCode,
300300
'Shift+Ctrl+3')
301301
menu.addSeparator()
302302
codePadAction = menu.addAction(iconCodePad,
@@ -391,7 +391,7 @@ def commentEditorCode(self, commentCheck):
391391
else:
392392
if not self.text(line).trimmed().startsWith('#'):
393393
continue
394-
self.setSelection(line, self.indentation(line),
394+
self.setSelection(line, self.indentation(line),
395395
line, self.indentation(line) + 1)
396396
self.removeSelectedText()
397397
else:
@@ -401,11 +401,11 @@ def commentEditorCode(self, commentCheck):
401401
else:
402402
if not self.text(line).trimmed().startsWith('#'):
403403
return
404-
self.setSelection(line, self.indentation(line),
404+
self.setSelection(line, self.indentation(line),
405405
line, self.indentation(line) + 1)
406406
self.removeSelectedText()
407407
self.endUndoAction()
408-
408+
409409
def createTempFile(self):
410410
import tempfile
411411
fd, path = tempfile.mkstemp()
@@ -423,10 +423,10 @@ def _runSubProcess(self, filename, tmp=False):
423423
try:
424424
## set creationflags for runnning command without shell window
425425
if sys.platform.startswith('win'):
426-
p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE,
426+
p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE,
427427
stderr=subprocess.PIPE, stdout=subprocess.PIPE, creationflags=0x08000000)
428428
else:
429-
p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE,
429+
p = subprocess.Popen(['python', str(filename)], shell=False, stdin=subprocess.PIPE,
430430
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
431431
out, _traceback = p.communicate()
432432

@@ -465,13 +465,14 @@ def _runSubProcess(self, filename, tmp=False):
465465

466466
def runScriptCode(self):
467467
autoSave = self.settings.value("pythonConsole/autoSaveScript").toBool()
468-
468+
469469
tabWidget = self.parent.tw.currentWidget()
470+
470471
filename = tabWidget.path
471-
472-
msgEditorBlank = QCoreApplication.translate('PythonConsole',
472+
473+
msgEditorBlank = QCoreApplication.translate('PythonConsole',
473474
'Hey, type something for running !')
474-
msgEditorUnsaved = QCoreApplication.translate('PythonConsole',
475+
msgEditorUnsaved = QCoreApplication.translate('PythonConsole',
475476
'You have to save the file before running.')
476477
if not autoSave:
477478
if filename is None:
@@ -500,7 +501,7 @@ def getTextFromEditor(self):
500501
text = self.text()
501502
textList = text.split("\n")
502503
return textList
503-
504+
504505
def goToLine(self, objName, linenr):
505506
self.SendScintilla(QsciScintilla.SCI_GOTOLINE, linenr-1)
506507
self.SendScintilla(QsciScintilla.SCI_SETTARGETSTART, self.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS))
@@ -552,7 +553,7 @@ def __init__(self, parent, parentConsole, filename, *args):
552553
self.newEditor = Editor(self)
553554
if filename:
554555
self.path = filename
555-
if os.path.exists(filename):
556+
if os.path.exists(filename)
556557
self.loadFile(filename, False)
557558

558559
# Creates layout for message bar
@@ -589,15 +590,15 @@ def loadFile(self, filename, modified):
589590

590591
def save(self):
591592
if self.path is None:
592-
self.path = str(QFileDialog().getSaveFileName(self,
593+
self.path = str(QFileDialog().getSaveFileName(self,
593594
"Python Console: Save file",
594595
"*.py",
595596
"Script file (*.py)"))
596597
# If the user didn't select a file, abort the save operation
597598
if len(self.path) == 0:
598599
self.path = None
599600
return
600-
msgText = QCoreApplication.translate('PythonConsole',
601+
msgText = QCoreApplication.translate('PythonConsole',
601602
'Script was correctly saved.')
602603
self.pc.callWidgetMessageBarEditor(msgText, 0, True)
603604
# Rename the original file, if it exists
@@ -706,9 +707,9 @@ def __init__(self, parent):
706707

707708
# Menu button list tabs
708709
self.fileTabMenu = QMenu(self)
709-
self.connect(self.fileTabMenu, SIGNAL("aboutToShow()"),
710+
self.connect(self.fileTabMenu, SIGNAL("aboutToShow()"),
710711
self.showFileTabMenu)
711-
self.connect(self.fileTabMenu, SIGNAL("triggered(QAction*)"),
712+
self.connect(self.fileTabMenu, SIGNAL("triggered(QAction*)"),
712713
self.showFileTabMenuTriggered)
713714
self.fileTabButton = QToolButton(self)
714715
self.fileTabButton.setToolTip('List all tabs')
@@ -782,7 +783,7 @@ def _removeTab(self, tab, tab2index=False):
782783
tab = self.indexOf(tab)
783784
if self.widget(tab).newEditor.isModified():
784785
res = QMessageBox.question( self, 'Python Console: Save File',
785-
'The file <b>"%s"</b> has been modified, save changes ?'
786+
'The file <b>"%s"</b> has been modified, save changes ?'
786787
% self.tabText(tab),
787788
QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel )
788789
if res == QMessageBox.Save:
@@ -920,7 +921,7 @@ def listObject(self, tab):
920921
s = traceback.format_exc()
921922
print '## Error: '
922923
sys.stderr.write(s)
923-
924+
924925
def refreshSettingsEditor(self):
925926
countTab = self.count()
926927
for i in range(countTab):

2 commit comments

Comments
 (2)

nyalldawson commented on May 1, 2013

@nyalldawson
Collaborator

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 commented on May 1, 2013

@jef-n
MemberAuthor

prepare-commit also works for python files.

Please sign in to comment.