Skip to content

Commit

Permalink
[pyqgis-console] Follow up 7096a73
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Apr 21, 2013
1 parent 7096a73 commit b70934a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion python/console/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def qtGui(self):

def toggleEditor(self, checked):
self.widgetEditor.show() if checked else self.widgetEditor.hide()
self.tabEditorWidget.checkToRestoreTabs()
self.tabEditorWidget.enableToolBarEditor(checked)

def toggleObjectListWidget(self, checked):
self.listClassMethod.show() if checked else self.listClassMethod.hide()
Expand Down
35 changes: 22 additions & 13 deletions python/console/console_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,13 @@ def contextMenuEvent(self, e):
action = menu.exec_(self.mapToGlobal(e.pos()))

def objectListEditor(self):
listObj = self.parent.pc.splitterObj
listObj.hide() if listObj.isVisible() else listObj.show()
self.parent.pc.objectListButton.setChecked(False)
listObj = self.parent.pc.listClassMethod
if listObj.isVisible():
listObj.hide()
self.parent.pc.objectListButton.setChecked(False)
else:
listObj.show()
self.parent.pc.objectListButton.setChecked(True)

def codepad(self):
import urllib2, urllib
Expand Down Expand Up @@ -348,8 +352,8 @@ def codepad(self):
self.parent.pc.callWidgetMessageBarEditor(msgText + str(e.args))

def hideEditor(self):
Ed = self.parent.pc.widgetEditor
Ed.hide()
self.parent.pc.widgetEditor.hide()
self.parent.pc.listClassMethod.hide()
self.parent.pc.showEditorButton.setChecked(False)

def commentEditorCode(self, commentCheck):
Expand Down Expand Up @@ -599,6 +603,11 @@ def __init__(self, parent):
tabScripts = self.settings.value("pythonConsole/tabScripts")
self.restoreTabList = tabScripts.toList()

if self.restoreTabList:
self.topFrame.show()
else:
self.newTabEditor(filename=None)

self.setDocumentMode(True)
self.setMovable(True)
#self.setTabsClosable(True)
Expand Down Expand Up @@ -629,12 +638,10 @@ def __init__(self, parent):
self.setCornerWidget(self.newTabButton, Qt.TopLeftCorner)
self.connect(self.newTabButton, SIGNAL('clicked()'), self.newTabEditor)

def checkToRestoreTabs(self):
if self.restoreTabList:
self.topFrame.show()
else:
self.newTabEditor(filename=None)
self.parent.toolBarEditor.setEnabled(True)
def enableToolBarEditor(self, enable):
if self.topFrame.isVisible():
enable = False
self.parent.toolBarEditor.setEnabled(enable)

def newTabEditor(self, tabName=None, filename=None):
nr = self.count()
Expand Down Expand Up @@ -722,14 +729,16 @@ def restoreTabs(self):
if os.path.exists(pathFile):
tabName = pathFile.split('/')[-1]
self.newTabEditor(tabName, pathFile)
else:
self.newTabEditor(filename=None)
self.topFrame.close()
self.parent.toolBarEditor.setEnabled(True)
self.enableToolBarEditor(True)

def closeRestore(self):
self.parent.updateTabListScript('empty')
self.topFrame.close()
self.newTabEditor(filename=None)
self.parent.toolBarEditor.setEnabled(True)
self.enableToolBarEditor(True)

def showFileTabMenu(self):
self.fileTabMenu.clear()
Expand Down

0 comments on commit b70934a

Please sign in to comment.