Skip to content

Commit

Permalink
[pyqgis-console] just shows the context menu on tabs (does not on tab…
Browse files Browse the repository at this point in the history
…bar)
  • Loading branch information
slarosa committed May 5, 2013
1 parent eb47ff5 commit 471dab1
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions python/console/console_editor.py
Expand Up @@ -790,31 +790,32 @@ def __init__(self, parent):
def contextMenuEvent(self, e):
tabBar = self.tabBar()
self.idx = tabBar.tabAt(e.pos())
cW = self.currentWidget()
menu = QMenu(self)
menu.addSeparator()
newTabAction = menu.addAction("New Editor",
self.newTabEditor)
menu.addSeparator()
closeTabAction = menu.addAction("Close Tab",
cW.close)
closeAllTabAction = menu.addAction("Close All",
self.closeAll)
closeOthersTabAction = menu.addAction("Close Others",
self.closeOthers)
menu.addSeparator()
saveAction = menu.addAction("Save",
cW.save)
saveAsAction = menu.addAction("Save As",
self.parent.saveAsScriptFile)
closeTabAction.setEnabled(False)
closeAllTabAction.setEnabled(False)
closeOthersTabAction.setEnabled(False)
if self.count() > 1:
closeTabAction.setEnabled(True)
closeAllTabAction.setEnabled(True)
closeOthersTabAction.setEnabled(True)
action = menu.exec_(self.mapToGlobal(e.pos()))
if self.widget(self.idx):
cW = self.currentWidget()
menu = QMenu(self)
menu.addSeparator()
newTabAction = menu.addAction("New Editor",
self.newTabEditor)
menu.addSeparator()
closeTabAction = menu.addAction("Close Tab",
cW.close)
closeAllTabAction = menu.addAction("Close All",
self.closeAll)
closeOthersTabAction = menu.addAction("Close Others",
self.closeOthers)
menu.addSeparator()
saveAction = menu.addAction("Save",
cW.save)
saveAsAction = menu.addAction("Save As",
self.parent.saveAsScriptFile)
closeTabAction.setEnabled(False)
closeAllTabAction.setEnabled(False)
closeOthersTabAction.setEnabled(False)
if self.count() > 1:
closeTabAction.setEnabled(True)
closeAllTabAction.setEnabled(True)
closeOthersTabAction.setEnabled(True)
action = menu.exec_(self.mapToGlobal(e.pos()))

def closeOthers(self):
idx = self.idx
Expand Down

0 comments on commit 471dab1

Please sign in to comment.