Skip to content

Commit

Permalink
[pyqgis-console] converts all newlines to "\n" in order to fix the "E…
Browse files Browse the repository at this point in the history
…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 269a419
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
32 changes: 20 additions & 12 deletions python/console/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions python/console/console_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 = {}
Expand Down

0 comments on commit 269a419

Please sign in to comment.