From 7e779cddeb822b727e944e1d54237bed4b5692a9 Mon Sep 17 00:00:00 2001 From: Blaine Date: Fri, 19 Jun 2020 13:44:01 +0530 Subject: camelCase to PascalCase for class names --- src/main/python/utils/tabs.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/python/utils/tabs.py') diff --git a/src/main/python/utils/tabs.py b/src/main/python/utils/tabs.py index 1186191..cedb298 100644 --- a/src/main/python/utils/tabs.py +++ b/src/main/python/utils/tabs.py @@ -1,7 +1,7 @@ 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 """ @@ -26,17 +26,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 -- cgit From f8519766d7f7fc70180411f912ed8ca15abb6a95 Mon Sep 17 00:00:00 2001 From: Blaine Date: Sat, 20 Jun 2020 14:43:57 +0530 Subject: refactor and comment code --- src/main/python/utils/tabs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/python/utils/tabs.py') diff --git a/src/main/python/utils/tabs.py b/src/main/python/utils/tabs.py index cedb298..70f9def 100644 --- a/src/main/python/utils/tabs.py +++ b/src/main/python/utils/tabs.py @@ -3,7 +3,7 @@ from PyQt5.QtCore import pyqtSignal, QSize, Qt 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() -- cgit