Skip to content
Permalink
Browse files

Move python console toolbar to top. More uniform with rest of UI

  • Loading branch information
NathanW2 committed Aug 8, 2015
1 parent e991b64 commit 9acc4751974b5542c67b79e18536820e7c1fa620
Showing with 19 additions and 21 deletions.
  1. +19 −21 python/console/console.py
@@ -21,6 +21,7 @@

from PyQt4.QtCore import Qt, QTimer, QSettings, QCoreApplication, QSize, QByteArray, QFileInfo, SIGNAL
from PyQt4.QtGui import QDockWidget, QToolBar, QToolButton, QWidget, QSplitter, QTreeWidget, QAction, QFileDialog, QCheckBox, QSizePolicy, QMenu, QGridLayout, QApplication
from PyQt4.QtGui import QVBoxLayout
from PyQt4 import pyqtconfig
from qgis.utils import iface
from console_sci import ShellScintilla
@@ -106,12 +107,19 @@ def __init__(self, parent=None):
self.splitterEditor.setOrientation(Qt.Horizontal)
self.splitterEditor.setHandleWidth(6)
self.splitterEditor.setChildrenCollapsible(True)

self.shellOutWidget = QWidget(self)
self.shellOutWidget.setLayout(QVBoxLayout())
self.shellOutWidget.layout().setContentsMargins(0,0,0,0)
self.shellOutWidget.layout().addWidget(self.shellOut)

self.splitter = QSplitter(self.splitterEditor)
self.splitter.setOrientation(Qt.Vertical)
self.splitter.setHandleWidth(3)
self.splitter.setChildrenCollapsible(False)
self.splitter.addWidget(self.shellOut)
self.splitter.addWidget(self.shellOutWidget)
self.splitter.addWidget(self.shell)

#self.splitterEditor.addWidget(self.tabEditorWidget)

self.splitterObj = QSplitter(self.splitterEditor)
@@ -361,9 +369,8 @@ def __init__(self, parent=None):
self.toolBar.setContextMenuPolicy(Qt.DefaultContextMenu)
self.toolBar.setLayoutDirection(Qt.LeftToRight)
self.toolBar.setIconSize(QSize(16, 16))
self.toolBar.setOrientation(Qt.Vertical)
self.toolBar.setMovable(True)
self.toolBar.setFloatable(True)
self.toolBar.setMovable(False)

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson Aug 8, 2015

Collaborator

@NathanW2 why not leave it draggable? Is there a good a reason to disable this?

This comment has been minimized.

Copy link
@NathanW2

NathanW2 via email Aug 8, 2015

Author Member
self.toolBar.setFloatable(False)
self.toolBar.addAction(self.clearButton)
self.toolBar.addAction(self.actionClass)
self.toolBar.addAction(self.runButton)
@@ -374,16 +381,13 @@ def __init__(self, parent=None):
self.toolBar.addAction(self.helpButton)

self.toolBarEditor = QToolBar()
# self.toolBarEditor.setStyleSheet('QToolBar{background-color: rgb(%s, %s, %s' % tuple(bkgrcolor) + ');\
# border-right: 1px solid rgb(%s, %s, %s' % tuple(bordercl) + ');}')
self.toolBarEditor.setEnabled(False)
self.toolBarEditor.setFocusPolicy(Qt.NoFocus)
self.toolBarEditor.setContextMenuPolicy(Qt.DefaultContextMenu)
self.toolBarEditor.setLayoutDirection(Qt.LeftToRight)
self.toolBarEditor.setIconSize(QSize(16, 16))
self.toolBarEditor.setOrientation(Qt.Vertical)
self.toolBarEditor.setMovable(True)
self.toolBarEditor.setFloatable(True)
self.toolBarEditor.setMovable(False)
self.toolBarEditor.setFloatable(False)
self.toolBarEditor.addAction(self.openFileButton)
self.toolBarEditor.addSeparator()
self.toolBarEditor.addAction(self.saveFileButton)
@@ -442,21 +446,15 @@ def __init__(self, parent=None):
self.mainLayout.addWidget(self.widgetButton, 0, 0, 1, 1)
self.mainLayout.addWidget(self.splitterEditor, 0, 1, 1, 1)

self.shellOutWidget.layout().insertWidget(0, self.toolBar)

self.layoutEditor = QGridLayout(self.widgetEditor)
self.layoutEditor.setMargin(0)
self.layoutEditor.setSpacing(0)
self.layoutEditor.addWidget(self.widgetButtonEditor, 0, 0, 2, 1)
self.layoutEditor.addWidget(self.tabEditorWidget, 0, 1, 1, 1)
self.layoutEditor.addWidget(self.widgetFind, 1, 1, 1, 1)

self.toolBarLayout = QGridLayout(self.widgetButton)
self.toolBarLayout.setMargin(0)
self.toolBarLayout.setSpacing(0)
self.toolBarLayout.addWidget(self.toolBar)
self.toolBarEditorLayout = QGridLayout(self.widgetButtonEditor)
self.toolBarEditorLayout.setMargin(0)
self.toolBarEditorLayout.setSpacing(0)
self.toolBarEditorLayout.addWidget(self.toolBarEditor)
self.layoutEditor.addWidget(self.toolBarEditor, 0, 1, 1, 1)
self.layoutEditor.addWidget(self.widgetButtonEditor, 1, 0, 2, 1)
self.layoutEditor.addWidget(self.tabEditorWidget, 1, 1, 1, 1)
self.layoutEditor.addWidget(self.widgetFind, 2, 1, 1, 1)

## Layout for the find widget
self.layoutFind = QGridLayout(self.widgetFind)

1 comment on commit 9acc475

@slarosa

This comment has been minimized.

Copy link
Member

@slarosa slarosa commented on 9acc475 Aug 8, 2015

@NathanW2 I like it! 👍

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