Skip to content
Permalink
Browse files

[pyqgis-console] just shows the context menu on tabs (does not on tab…

…bar)
  • Loading branch information
slarosa committed May 5, 2013
1 parent eb47ff5 commit 471dab184a2bd94f1cebb3767bf496376dfb82dd
Showing with 26 additions and 25 deletions.
  1. +26 −25 python/console/console_editor.py
@@ -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

0 comments on commit 471dab1

Please sign in to comment.
You can’t perform that action at this time.