Skip to content

Commit 5bc0a8a

Browse files
committed
Merge pull request #328 from slarosa/master
Add action: Hide/Show toolbar for PyQGIS Console
2 parents 5053818 + 1237546 commit 5bc0a8a

File tree

6 files changed

+15
-3
lines changed

6 files changed

+15
-3
lines changed
291 Bytes
Loading

images/console/imgHelpMenu.png

1.18 KB
Loading

images/images.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@
491491
<file>console/iconCodepadConsole.png</file>
492492
<file>console/imgHelpConsole.png</file>
493493
<file>console/imgHelpMenu.png</file>
494+
<file>console/iconHideToolConsole.png</file>
494495
<file>flags/sr_Cyrl.png</file>
495496
<file>flags/sr_Latn.png</file>
496497
<file>flags/sw.png</file>

python/console/console.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def saveScriptFile(self):
355355
sF.close()
356356

357357
def openHelp(self):
358-
dlg = HelpDialog(self)
358+
dlg = HelpDialog()
359359
dlg.exec_()
360360

361361
def openSettings(self):

python/console/console_help.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
import os
3131

3232
class HelpDialog(QDialog, Ui_Help):
33-
def __init__(self, parent):
33+
def __init__(self, parent=None):
3434
QDialog.__init__(self, parent)
3535
self.setupUi(self)
36-
36+
37+
self.setWindowModality(Qt.WindowModal)
3738
self.setWindowTitle(QCoreApplication.translate("PythonConsole","Help Python Console"))
3839
self.setMaximumSize(530, 300)
3940

python/console/console_output.py

+10
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ def contextMenuEvent(self, e):
165165
iconRun = QIcon(":/images/console/iconRunConsole.png")
166166
iconPastebin = QIcon(":/images/console/iconCodepadConsole.png")
167167
iconClear = QIcon(":/images/console/iconClearConsole.png")
168+
iconHideTool = QIcon(":/images/console/iconHideToolConsole.png")
169+
hideToolBar = menu.addAction(iconHideTool,
170+
"Hide/Show Toolbar",
171+
self.hideToolBar)
172+
menu.addSeparator()
168173
runAction = menu.addAction(iconRun,
169174
"Enter Selected",
170175
self.enteredSelected,
@@ -196,6 +201,11 @@ def contextMenuEvent(self, e):
196201
selectAllAction.setEnabled(True)
197202
clearAction.setEnabled(True)
198203
action = menu.exec_(self.mapToGlobal(e.pos()))
204+
205+
def hideToolBar(self):
206+
tB = self.parent.toolBar
207+
tB.hide() if tB.isVisible() else tB.show()
208+
self.edit.setFocus()
199209

200210
def copy(self):
201211
"""Copy text to clipboard... or keyboard interrupt"""

0 commit comments

Comments
 (0)