Skip to content

Commit

Permalink
[pyqgis-console] disables tab widget editor if restore tabs is prompt…
Browse files Browse the repository at this point in the history
…ed and adds tab tooltip
  • Loading branch information
slarosa committed Apr 20, 2013
1 parent 6488725 commit cfa3f57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/console/console.py
Expand Up @@ -331,7 +331,7 @@ def __init__(self, parent=None):
self.toolBarEditor = QToolBar()
self.toolBarEditor.setStyleSheet('QToolBar{background-color: rgb(200, 200, 200);\
border-right: 1px solid rgb(155, 155, 155);}')
self.toolBarEditor.setEnabled(True)
self.toolBarEditor.setEnabled(False)
self.toolBarEditor.setFocusPolicy(Qt.NoFocus)
self.toolBarEditor.setContextMenuPolicy(Qt.DefaultContextMenu)
self.toolBarEditor.setLayoutDirection(Qt.LeftToRight)
Expand Down
11 changes: 10 additions & 1 deletion python/console/console_editor.py
Expand Up @@ -570,9 +570,11 @@ def __init__(self, parent):
self.settings = QSettings()
tabScripts = self.settings.value("pythonConsole/tabScripts")
self.restoreTabList = tabScripts.toList()
self.newTabEditor(filename=None)

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

self.setDocumentMode(True)
self.setMovable(True)
Expand Down Expand Up @@ -615,6 +617,10 @@ def newTabEditor(self, tabName=None, filename=None):
self.iconTab = QgsApplication.getThemeIcon('console/iconTabEditorConsole.png')
self.addTab(self.tab, self.iconTab, tabName)
self.setCurrentWidget(self.tab)
if filename:
self.setTabToolTip(self.currentIndex(), unicode(filename))
else:
self.setTabToolTip(self.currentIndex(), tabName)

def tabModified(self, tab, modified):
index = self.indexOf(tab)
Expand Down Expand Up @@ -685,10 +691,13 @@ def restoreTabs(self):
tabName = pathFile.split('/')[-1]
self.newTabEditor(tabName, pathFile)
self.topFrame.close()
self.parent.toolBarEditor.setEnabled(True)

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

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

0 comments on commit cfa3f57

Please sign in to comment.