Skip to content

Commit b70934a

Browse files
committedApr 21, 2013
[pyqgis-console] Follow up 7096a73
1 parent 7096a73 commit b70934a

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed
 

‎python/console/console.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def qtGui(self):
481481

482482
def toggleEditor(self, checked):
483483
self.widgetEditor.show() if checked else self.widgetEditor.hide()
484-
self.tabEditorWidget.checkToRestoreTabs()
484+
self.tabEditorWidget.enableToolBarEditor(checked)
485485

486486
def toggleObjectListWidget(self, checked):
487487
self.listClassMethod.show() if checked else self.listClassMethod.hide()

‎python/console/console_editor.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,13 @@ def contextMenuEvent(self, e):
309309
action = menu.exec_(self.mapToGlobal(e.pos()))
310310

311311
def objectListEditor(self):
312-
listObj = self.parent.pc.splitterObj
313-
listObj.hide() if listObj.isVisible() else listObj.show()
314-
self.parent.pc.objectListButton.setChecked(False)
312+
listObj = self.parent.pc.listClassMethod
313+
if listObj.isVisible():
314+
listObj.hide()
315+
self.parent.pc.objectListButton.setChecked(False)
316+
else:
317+
listObj.show()
318+
self.parent.pc.objectListButton.setChecked(True)
315319

316320
def codepad(self):
317321
import urllib2, urllib
@@ -348,8 +352,8 @@ def codepad(self):
348352
self.parent.pc.callWidgetMessageBarEditor(msgText + str(e.args))
349353

350354
def hideEditor(self):
351-
Ed = self.parent.pc.widgetEditor
352-
Ed.hide()
355+
self.parent.pc.widgetEditor.hide()
356+
self.parent.pc.listClassMethod.hide()
353357
self.parent.pc.showEditorButton.setChecked(False)
354358

355359
def commentEditorCode(self, commentCheck):
@@ -599,6 +603,11 @@ def __init__(self, parent):
599603
tabScripts = self.settings.value("pythonConsole/tabScripts")
600604
self.restoreTabList = tabScripts.toList()
601605

606+
if self.restoreTabList:
607+
self.topFrame.show()
608+
else:
609+
self.newTabEditor(filename=None)
610+
602611
self.setDocumentMode(True)
603612
self.setMovable(True)
604613
#self.setTabsClosable(True)
@@ -629,12 +638,10 @@ def __init__(self, parent):
629638
self.setCornerWidget(self.newTabButton, Qt.TopLeftCorner)
630639
self.connect(self.newTabButton, SIGNAL('clicked()'), self.newTabEditor)
631640

632-
def checkToRestoreTabs(self):
633-
if self.restoreTabList:
634-
self.topFrame.show()
635-
else:
636-
self.newTabEditor(filename=None)
637-
self.parent.toolBarEditor.setEnabled(True)
641+
def enableToolBarEditor(self, enable):
642+
if self.topFrame.isVisible():
643+
enable = False
644+
self.parent.toolBarEditor.setEnabled(enable)
638645

639646
def newTabEditor(self, tabName=None, filename=None):
640647
nr = self.count()
@@ -722,14 +729,16 @@ def restoreTabs(self):
722729
if os.path.exists(pathFile):
723730
tabName = pathFile.split('/')[-1]
724731
self.newTabEditor(tabName, pathFile)
732+
else:
733+
self.newTabEditor(filename=None)
725734
self.topFrame.close()
726-
self.parent.toolBarEditor.setEnabled(True)
735+
self.enableToolBarEditor(True)
727736

728737
def closeRestore(self):
729738
self.parent.updateTabListScript('empty')
730739
self.topFrame.close()
731740
self.newTabEditor(filename=None)
732-
self.parent.toolBarEditor.setEnabled(True)
741+
self.enableToolBarEditor(True)
733742

734743
def showFileTabMenu(self):
735744
self.fileTabMenu.clear()

0 commit comments

Comments
 (0)
Please sign in to comment.