Skip to content
Permalink
Browse files

[pyqgis-console] converts all newlines to "\n" in order to fix the "E…

…nter selected command" from the editor

- fixes background color for toolbar editor on Windows
- minor fixes
  • Loading branch information
slarosa committed Apr 21, 2013
1 parent 956e18d commit 269a419b25cfae6d3e2fc659169bffa73d414bd9
Showing with 21 additions and 14 deletions.
  1. +20 −12 python/console/console.py
  2. +1 −2 python/console/console_editor.py
@@ -354,9 +354,16 @@ def __init__(self, parent=None):
self.toolBar.addAction(self.optionsButton)
self.toolBar.addAction(self.helpButton)

if sys.platform.startswith('win'):
bkgrcolor = ['170', '170', '170']
bordercl = ['125', '125', '125']
else:
bkgrcolor = ['200', '200', '200']
bordercl = ['155', '155', '155']

self.toolBarEditor = QToolBar()
self.toolBarEditor.setStyleSheet('QToolBar{background-color: rgb(200, 200, 200);\
border-right: 1px solid rgb(155, 155, 155);}')
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)
@@ -604,16 +611,17 @@ def callWidgetMessageBarEditor(self, text):
self.tabEditorWidget.widgetMessageBar(iface, text)

def updateTabListScript(self, script, action=None):
settings = QSettings()
if script == 'empty':
self.tabListScript = []
if script is not None and not action and script != 'empty':
self.tabListScript.remove(script)
if action:
if script not in self.tabListScript:
self.tabListScript.append(script)
settings.setValue("pythonConsole/tabScripts",
QVariant(self.tabListScript))
if script != '':
settings = QSettings()
if script == 'empty':
self.tabListScript = []
if script is not None and not action and script != 'empty':
self.tabListScript.remove(script)
if action:
if script not in self.tabListScript:
self.tabListScript.append(script)
settings.setValue("pythonConsole/tabScripts",
QVariant(self.tabListScript))

def saveSettingsConsole(self):
settings = QSettings()
@@ -477,7 +477,7 @@ def __init__(self, parent, parentConsole, filename, *args):
self.newEditor.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.newEditor.modificationChanged.connect(self.modified)
if filename:
self.newEditor.setText(open(filename, "r").read())
self.newEditor.setText(open(filename, "rt").read())
self.newEditor.setModified(False)
self.path = filename

@@ -763,7 +763,6 @@ def listObject(self, tab):
#print sys.modules[module]
if pathFile not in sys.path:
sys.path.append(pathFile)

try:
reload(pyclbr)
dictObject = {}

0 comments on commit 269a419

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