@@ -64,6 +64,7 @@ def show_console():
64
64
65
65
return _console
66
66
67
+
67
68
_console_output = None
68
69
69
70
# hook for python console so all output will be redirected
@@ -81,7 +82,7 @@ def __init__(self, parent=None):
81
82
QDockWidget .__init__ (self , parent )
82
83
self .setObjectName ("PythonConsole" )
83
84
self .setWindowTitle (QCoreApplication .translate ("PythonConsole" , "Python Console" ))
84
- #self.setAllowedAreas(Qt.BottomDockWidgetArea)
85
+ # self.setAllowedAreas(Qt.BottomDockWidgetArea)
85
86
86
87
self .console = PythonConsoleWidget (self )
87
88
self .setWidget (self .console )
@@ -114,7 +115,7 @@ def __init__(self, parent=None):
114
115
self .shellOut = ShellOutputScintilla (self )
115
116
self .tabEditorWidget = EditorTabWidget (self )
116
117
117
- ## ------------ UI -------------------------------
118
+ # ------------ UI -------------------------------
118
119
119
120
self .splitterEditor = QSplitter (self )
120
121
self .splitterEditor .setOrientation (Qt .Horizontal )
@@ -133,13 +134,13 @@ def __init__(self, parent=None):
133
134
self .splitter .addWidget (self .shellOutWidget )
134
135
self .splitter .addWidget (self .shell )
135
136
136
- #self.splitterEditor.addWidget(self.tabEditorWidget)
137
+ # self.splitterEditor.addWidget(self.tabEditorWidget)
137
138
138
139
self .splitterObj = QSplitter (self .splitterEditor )
139
140
self .splitterObj .setHandleWidth (3 )
140
141
self .splitterObj .setOrientation (Qt .Horizontal )
141
- #self.splitterObj.setSizes([0, 0])
142
- #self.splitterObj.setStretchFactor(0, 1)
142
+ # self.splitterObj.setSizes([0, 0])
143
+ # self.splitterObj.setStretchFactor(0, 1)
143
144
144
145
self .widgetEditor = QWidget (self .splitterObj )
145
146
self .widgetFind = QWidget (self )
@@ -151,9 +152,9 @@ def __init__(self, parent=None):
151
152
self .listClassMethod .setColumnHidden (1 , True )
152
153
self .listClassMethod .setAlternatingRowColors (True )
153
154
154
- #self.splitterEditor.addWidget(self.widgetEditor)
155
- #self.splitterObj.addWidget(self.listClassMethod)
156
- #self.splitterObj.addWidget(self.widgetEditor)
155
+ # self.splitterEditor.addWidget(self.widgetEditor)
156
+ # self.splitterObj.addWidget(self.listClassMethod)
157
+ # self.splitterObj.addWidget(self.widgetEditor)
157
158
158
159
# Hide side editor on start up
159
160
self .splitterObj .hide ()
@@ -164,13 +165,13 @@ def __init__(self, parent=None):
164
165
sizes = self .splitter .sizes ()
165
166
self .splitter .setSizes (sizes )
166
167
167
- ## ----------------Restore Settings------------------------------------
168
+ # ----------------Restore Settings------------------------------------
168
169
169
170
self .restoreSettingsConsole ()
170
171
171
- ## ------------------Toolbar Editor-------------------------------------
172
+ # ------------------Toolbar Editor-------------------------------------
172
173
173
- ## Action for Open File
174
+ # Action for Open File
174
175
openFileBt = QCoreApplication .translate ("PythonConsole" , "Open Script..." )
175
176
self .openFileButton = QAction (self )
176
177
self .openFileButton .setCheckable (False )
@@ -190,7 +191,7 @@ def __init__(self, parent=None):
190
191
self .openInEditorButton .setIconVisibleInMenu (True )
191
192
self .openInEditorButton .setToolTip (openExtEditorBt )
192
193
self .openInEditorButton .setText (openExtEditorBt )
193
- ## Action for Save File
194
+ # Action for Save File
194
195
saveFileBt = QCoreApplication .translate ("PythonConsole" , "Save" )
195
196
self .saveFileButton = QAction (self )
196
197
self .saveFileButton .setCheckable (False )
@@ -200,7 +201,7 @@ def __init__(self, parent=None):
200
201
self .saveFileButton .setIconVisibleInMenu (True )
201
202
self .saveFileButton .setToolTip (saveFileBt )
202
203
self .saveFileButton .setText (saveFileBt )
203
- ## Action for Save File As
204
+ # Action for Save File As
204
205
saveAsFileBt = QCoreApplication .translate ("PythonConsole" , "Save As..." )
205
206
self .saveAsFileButton = QAction (self )
206
207
self .saveAsFileButton .setCheckable (False )
@@ -210,7 +211,7 @@ def __init__(self, parent=None):
210
211
self .saveAsFileButton .setIconVisibleInMenu (True )
211
212
self .saveAsFileButton .setToolTip (saveAsFileBt )
212
213
self .saveAsFileButton .setText (saveAsFileBt )
213
- ## Action Cut
214
+ # Action Cut
214
215
cutEditorBt = QCoreApplication .translate ("PythonConsole" , "Cut" )
215
216
self .cutEditorButton = QAction (self )
216
217
self .cutEditorButton .setCheckable (False )
@@ -220,7 +221,7 @@ def __init__(self, parent=None):
220
221
self .cutEditorButton .setIconVisibleInMenu (True )
221
222
self .cutEditorButton .setToolTip (cutEditorBt )
222
223
self .cutEditorButton .setText (cutEditorBt )
223
- ## Action Copy
224
+ # Action Copy
224
225
copyEditorBt = QCoreApplication .translate ("PythonConsole" , "Copy" )
225
226
self .copyEditorButton = QAction (self )
226
227
self .copyEditorButton .setCheckable (False )
@@ -230,7 +231,7 @@ def __init__(self, parent=None):
230
231
self .copyEditorButton .setIconVisibleInMenu (True )
231
232
self .copyEditorButton .setToolTip (copyEditorBt )
232
233
self .copyEditorButton .setText (copyEditorBt )
233
- ## Action Paste
234
+ # Action Paste
234
235
pasteEditorBt = QCoreApplication .translate ("PythonConsole" , "Paste" )
235
236
self .pasteEditorButton = QAction (self )
236
237
self .pasteEditorButton .setCheckable (False )
@@ -240,7 +241,7 @@ def __init__(self, parent=None):
240
241
self .pasteEditorButton .setIconVisibleInMenu (True )
241
242
self .pasteEditorButton .setToolTip (pasteEditorBt )
242
243
self .pasteEditorButton .setText (pasteEditorBt )
243
- ## Action Run Script (subprocess)
244
+ # Action Run Script (subprocess)
244
245
runScriptEditorBt = QCoreApplication .translate ("PythonConsole" , "Run script" )
245
246
self .runScriptEditorButton = QAction (self )
246
247
self .runScriptEditorButton .setCheckable (False )
@@ -250,7 +251,7 @@ def __init__(self, parent=None):
250
251
self .runScriptEditorButton .setIconVisibleInMenu (True )
251
252
self .runScriptEditorButton .setToolTip (runScriptEditorBt )
252
253
self .runScriptEditorButton .setText (runScriptEditorBt )
253
- ## Action Run Script (subprocess)
254
+ # Action Run Script (subprocess)
254
255
commentEditorBt = QCoreApplication .translate ("PythonConsole" , "Comment" )
255
256
self .commentEditorButton = QAction (self )
256
257
self .commentEditorButton .setCheckable (False )
@@ -260,7 +261,7 @@ def __init__(self, parent=None):
260
261
self .commentEditorButton .setIconVisibleInMenu (True )
261
262
self .commentEditorButton .setToolTip (commentEditorBt )
262
263
self .commentEditorButton .setText (commentEditorBt )
263
- ## Action Run Script (subprocess)
264
+ # Action Run Script (subprocess)
264
265
uncommentEditorBt = QCoreApplication .translate ("PythonConsole" , "Uncomment" )
265
266
self .uncommentEditorButton = QAction (self )
266
267
self .uncommentEditorButton .setCheckable (False )
@@ -270,7 +271,7 @@ def __init__(self, parent=None):
270
271
self .uncommentEditorButton .setIconVisibleInMenu (True )
271
272
self .uncommentEditorButton .setToolTip (uncommentEditorBt )
272
273
self .uncommentEditorButton .setText (uncommentEditorBt )
273
- ## Action for Object browser
274
+ # Action for Object browser
274
275
objList = QCoreApplication .translate ("PythonConsole" , "Object Inspector..." )
275
276
self .objectListButton = QAction (self )
276
277
self .objectListButton .setCheckable (True )
@@ -281,7 +282,7 @@ def __init__(self, parent=None):
281
282
self .objectListButton .setIconVisibleInMenu (True )
282
283
self .objectListButton .setToolTip (objList )
283
284
self .objectListButton .setText (objList )
284
- ## Action for Find text
285
+ # Action for Find text
285
286
findText = QCoreApplication .translate ("PythonConsole" , "Find Text" )
286
287
self .findTextButton = QAction (self )
287
288
self .findTextButton .setCheckable (True )
@@ -292,9 +293,9 @@ def __init__(self, parent=None):
292
293
self .findTextButton .setToolTip (findText )
293
294
self .findTextButton .setText (findText )
294
295
295
- ## ----------------Toolbar Console-------------------------------------
296
+ # ----------------Toolbar Console-------------------------------------
296
297
297
- ## Action Show Editor
298
+ # Action Show Editor
298
299
showEditor = QCoreApplication .translate ("PythonConsole" , "Show Editor" )
299
300
self .showEditorButton = QAction (self )
300
301
self .showEditorButton .setEnabled (True )
@@ -304,7 +305,7 @@ def __init__(self, parent=None):
304
305
self .showEditorButton .setIconVisibleInMenu (True )
305
306
self .showEditorButton .setToolTip (showEditor )
306
307
self .showEditorButton .setText (showEditor )
307
- ## Action for Clear button
308
+ # Action for Clear button
308
309
clearBt = QCoreApplication .translate ("PythonConsole" , "Clear Console" )
309
310
self .clearButton = QAction (self )
310
311
self .clearButton .setCheckable (False )
@@ -314,7 +315,7 @@ def __init__(self, parent=None):
314
315
self .clearButton .setIconVisibleInMenu (True )
315
316
self .clearButton .setToolTip (clearBt )
316
317
self .clearButton .setText (clearBt )
317
- ## Action for settings
318
+ # Action for settings
318
319
optionsBt = QCoreApplication .translate ("PythonConsole" , "Options..." )
319
320
self .optionsButton = QAction (self )
320
321
self .optionsButton .setCheckable (False )
@@ -324,7 +325,7 @@ def __init__(self, parent=None):
324
325
self .optionsButton .setIconVisibleInMenu (True )
325
326
self .optionsButton .setToolTip (optionsBt )
326
327
self .optionsButton .setText (optionsBt )
327
- ## Action menu for class
328
+ # Action menu for class
328
329
actionClassBt = QCoreApplication .translate ("PythonConsole" , "Import Class" )
329
330
self .actionClass = QAction (self )
330
331
self .actionClass .setCheckable (False )
@@ -334,7 +335,7 @@ def __init__(self, parent=None):
334
335
self .actionClass .setIconVisibleInMenu (True )
335
336
self .actionClass .setToolTip (actionClassBt )
336
337
self .actionClass .setText (actionClassBt )
337
- ## Action for Run script
338
+ # Action for Run script
338
339
runBt = QCoreApplication .translate ("PythonConsole" , "Run Command" )
339
340
self .runButton = QAction (self )
340
341
self .runButton .setCheckable (False )
@@ -344,7 +345,7 @@ def __init__(self, parent=None):
344
345
self .runButton .setIconVisibleInMenu (True )
345
346
self .runButton .setToolTip (runBt )
346
347
self .runButton .setText (runBt )
347
- ## Help action
348
+ # Help action
348
349
helpBt = QCoreApplication .translate ("PythonConsole" , "Help..." )
349
350
self .helpButton = QAction (self )
350
351
self .helpButton .setCheckable (False )
@@ -399,7 +400,7 @@ def __init__(self, parent=None):
399
400
self .toolBarEditor .addSeparator ()
400
401
self .toolBarEditor .addAction (self .objectListButton )
401
402
402
- ## Menu Import Class
403
+ # Menu Import Class
403
404
default_command = {
404
405
(QCoreApplication .translate ("PythonConsole" , "Import Processing Class" ),
405
406
QgsApplication .getThemeIcon ("console/iconProcessingConsole.png" )):
@@ -444,7 +445,7 @@ def __init__(self, parent=None):
444
445
self .shellOut .setVerticalScrollBarPolicy (Qt .ScrollBarAsNeeded )
445
446
self .shell .setVerticalScrollBarPolicy (Qt .ScrollBarAsNeeded )
446
447
447
- ## ------------ Layout -------------------------------
448
+ # ------------ Layout -------------------------------
448
449
449
450
self .mainLayout = QGridLayout (self )
450
451
self .mainLayout .setMargin (0 )
@@ -462,7 +463,7 @@ def __init__(self, parent=None):
462
463
self .layoutEditor .addWidget (self .tabEditorWidget , 1 , 1 , 1 , 1 )
463
464
self .layoutEditor .addWidget (self .widgetFind , 2 , 1 , 1 , 1 )
464
465
465
- ## Layout for the find widget
466
+ # Layout for the find widget
466
467
self .layoutFind = QGridLayout (self .widgetFind )
467
468
self .layoutFind .setContentsMargins (0 , 0 , 0 , 0 )
468
469
self .lineEditFind = QgsFilterLineEdit ()
@@ -500,11 +501,11 @@ def __init__(self, parent=None):
500
501
self .layoutFind .addWidget (self .wholeWord , 0 , 5 , 1 , 1 )
501
502
self .layoutFind .addWidget (self .wrapAround , 0 , 6 , 1 , 1 )
502
503
503
- ## ------------ Add first Tab in Editor -------------------------------
504
+ # ------------ Add first Tab in Editor -------------------------------
504
505
505
- #self.tabEditorWidget.newTabEditor(tabName='first', filename=None)
506
+ # self.tabEditorWidget.newTabEditor(tabName='first', filename=None)
506
507
507
- ## ------------ Signal -------------------------------
508
+ # ------------ Signal -------------------------------
508
509
509
510
self .findTextButton .triggered .connect (self ._toggleFind )
510
511
self .objectListButton .toggled .connect (self .toggleObjectListWidget )
@@ -728,6 +729,7 @@ def restoreSettingsConsole(self):
728
729
self .splitterEditor .restoreState (self .settings .value ("pythonConsole/splitterEditor" , QByteArray ()))
729
730
self .splitterObj .restoreState (self .settings .value ("pythonConsole/splitterObj" , QByteArray ()))
730
731
732
+
731
733
if __name__ == '__main__' :
732
734
a = QApplication (sys .argv )
733
735
console = PythonConsoleWidget ()
0 commit comments