summaryrefslogtreecommitdiff
path: root/src/main/python/utils/tabs.py
diff options
context:
space:
mode:
authorpravindalve2020-06-22 16:37:47 +0530
committerGitHub2020-06-22 16:37:47 +0530
commitcca55e231036850b2ea235ef0e1a1dc05db2a4b0 (patch)
tree8ff6b465e177e632a544471e1ec4b4add9279045 /src/main/python/utils/tabs.py
parentc3ca9374cfc2b91238e431055ab1cc2a0074a511 (diff)
parent5afc44d63266bb1e8a57a880d64b33f95b29e3d8 (diff)
downloadChemical-PFD-cca55e231036850b2ea235ef0e1a1dc05db2a4b0.tar.gz
Chemical-PFD-cca55e231036850b2ea235ef0e1a1dc05db2a4b0.tar.bz2
Chemical-PFD-cca55e231036850b2ea235ef0e1a1dc05db2a4b0.zip
Merge pull request #24 from Blakeinstein/master
Final PR
Diffstat (limited to 'src/main/python/utils/tabs.py')
-rw-r--r--src/main/python/utils/tabs.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/python/utils/tabs.py b/src/main/python/utils/tabs.py
index 1186191..70f9def 100644
--- a/src/main/python/utils/tabs.py
+++ b/src/main/python/utils/tabs.py
@@ -1,9 +1,9 @@
from PyQt5.QtWidgets import QTabBar, QPushButton, QTabWidget, QInputDialog
from PyQt5.QtCore import pyqtSignal, QSize, Qt
-class tabBarPlus(QTabBar):
+class TabBarPlus(QTabBar):
"""
- Just implemented to overload resize and layout change to emit a signal
+ Just implemented to overload resize and layout change to emit a signal and change tab names.
"""
layoutChanged = pyqtSignal()
nameChanged = pyqtSignal(int, str)
@@ -16,6 +16,7 @@ class tabBarPlus(QTabBar):
self.layoutChanged.emit()
def mouseDoubleClickEvent(self, event):
+ # tab name change request
if event.button() != Qt.LeftButton:
return super().mouseDoubleClickEvent()
index = self.currentIndex()
@@ -26,17 +27,17 @@ class tabBarPlus(QTabBar):
self.nameChanged.emit(index, newName)
-class customTabWidget(QTabWidget):
+class CustomTabWidget(QTabWidget):
"""
QTabWidget with a new tab button, also catches layoutChange signal by
- the tabBarPlus to dynamically move the button to the correct location
+ the TabBarPlus to dynamically move the button to the correct location
"""
plusClicked = pyqtSignal()
def __init__(self, parent=None):
- super(customTabWidget, self).__init__(parent)
+ super(CustomTabWidget, self).__init__(parent)
- self.tab = tabBarPlus()
- self.setTabBar(self.tab) #set tabBar to our custom tabBarPlus
+ self.tab = TabBarPlus()
+ self.setTabBar(self.tab) #set tabBar to our custom TabBarPlus
self.plusButton = QPushButton('+', self) #create the new tab button
#style the new tab button