summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBlaine2020-05-08 17:50:06 +0530
committerBlaine2020-05-08 17:50:06 +0530
commitfa9718e35973bb07fee8bab44ca105eac14290f2 (patch)
treeb414ea97f5fa62e2d53e3f6bf9db8c5397f40387 /src
parent47ab33d71bec2e099b0bd6a432b3cbae067f4bba (diff)
downloadChemical-PFD-fa9718e35973bb07fee8bab44ca105eac14290f2.tar.gz
Chemical-PFD-fa9718e35973bb07fee8bab44ca105eac14290f2.tar.bz2
Chemical-PFD-fa9718e35973bb07fee8bab44ca105eac14290f2.zip
Move switch view to context menu for a 6 limit
Diffstat (limited to 'src')
-rw-r--r--src/main/python/utils/fileWindow.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py
index 1c53c86..0230cd2 100644
--- a/src/main/python/utils/fileWindow.py
+++ b/src/main/python/utils/fileWindow.py
@@ -153,13 +153,25 @@ class fileWindow(QMdiSubWindow):
def sideViewContextMenu(self, point):
menu = QMenu("Context Menu", self.sideView)
- menu.addAction("Close Side View", lambda : setattr(self, 'sideViewTab', None))
- menu.addAction("Switch side view tab", self.sideViewSwitchTab)
menu.addAction("Reset Zoom", lambda : setattr(self.sideView, 'zoom', 1))
+ menu.addSection('Change Side View Tab')
+ if self.tabCount > 5:
+ menu.addAction("Show switch menu", self.sideViewSwitchTab)
+ else:
+ for i in range(self.tabCount):
+ j = self.tabber.widget(i)
+ if j == self.sideViewTab:
+ continue
+ menu.addAction(f'{i}. {j.objectName()}', lambda index=i: self.sideViewSwitchCMenu(index))
+ menu.addAction("Remove side view", lambda : setattr(self, 'sideViewTab', None))
menu.exec_(self.sideView.mapToGlobal(point))
+ def sideViewSwitchCMenu(self, index):
+ print(index)
+ self.sideViewTab = self.tabber.widget(index)
+
def sideViewSwitchTab(self):
- tabList = [f'{i}. {j.objectName()}' for i, j in enumerate(self.tabList)] + ['None (Remove)']
+ tabList = [f'{i}. {j.objectName()}' for i, j in enumerate(self.tabList)]
initial = self.tabList.index(self.sideViewTab)
result = dialogs.sideViewSwitchDialog(self.tabber, tabList, initial).exec_()
if result != initial: