src/eric7/EricWidgets/EricToolBarDialog.py

branch
eric7
changeset 9500
5771348ded12
parent 9473
3f23dbf37dbe
child 9573
9960d19d66b5
--- a/src/eric7/EricWidgets/EricToolBarDialog.py	Wed Nov 09 11:32:13 2022 +0100
+++ b/src/eric7/EricWidgets/EricToolBarDialog.py	Wed Nov 09 15:05:06 2022 +0100
@@ -7,6 +7,8 @@
 Module implementing a toolbar configuration dialog.
 """
 
+from dataclasses import dataclass
+
 from PyQt6.QtCore import Qt, pyqtSlot
 from PyQt6.QtGui import QColor
 from PyQt6.QtWidgets import (
@@ -25,25 +27,17 @@
 from .Ui_EricToolBarDialog import Ui_EricToolBarDialog
 
 
+@dataclass
 class EricToolBarItem:
     """
     Class storing data belonging to a toolbar entry of the toolbar dialog.
     """
 
-    def __init__(self, toolBarId, actionIDs, default):
-        """
-        Constructor
-
-        @param toolBarId id of the toolbar object (integer)
-        @param actionIDs list of action IDs belonging to the toolbar
-            (list of integer)
-        @param default flag indicating a default toolbar (boolean)
-        """
-        self.toolBarId = toolBarId
-        self.actionIDs = actionIDs[:]
-        self.isDefault = default
-        self.title = ""
-        self.isChanged = False
+    toolBarId: int
+    actionIDs: list[int]
+    isDefault: bool
+    title: str = ""
+    isChanged: bool = False
 
 
 class EricToolBarDialog(QDialog, Ui_EricToolBarDialog):
@@ -116,7 +110,11 @@
         for tbID, actions in list(self.__manager.toolBarsActions().items()):
             tb = self.__manager.toolBarById(tbID)
             default = self.__manager.isDefaultToolBar(tb)
-            tbItem = EricToolBarItem(tbID, [], default)
+            tbItem = EricToolBarItem(
+                toolBarId=tbID,
+                actionIDs=[],
+                isDefault=default,
+            )
             self.__toolbarItems[id(tbItem)] = tbItem
             self.__toolBarItemToWidgetActionID[id(tbItem)] = []
             actionIDs = []
@@ -167,7 +165,11 @@
                 )
                 return
 
-            tbItem = EricToolBarItem(None, [], False)
+            tbItem = EricToolBarItem(
+                toolBarId=None,
+                actionIDs=[],
+                isDefault=False,
+            )
             tbItem.title = name
             tbItem.isChanged = True
             self.__toolbarItems[id(tbItem)] = tbItem

eric ide

mercurial