--- a/src/eric7/EricWidgets/EricToolBarManager.py Tue Dec 19 11:04:03 2023 +0100 +++ b/src/eric7/EricWidgets/EricToolBarManager.py Tue Dec 19 19:57:08 2023 +0100 @@ -57,8 +57,10 @@ """ Constructor - @param ui reference to the user interface object (UI.UserInterface) - @param parent reference to the parent object (QObject) + @param ui reference to the user interface object + @type UI.UserInterface + @param parent reference to the parent object + @type QObject """ super().__init__(parent) @@ -98,8 +100,10 @@ """ Private slot to get a toolbar by its object name. - @param name object name of the toolbar (string) - @return reference to the toolbar (QToolBar) + @param name object name of the toolbar + @type str + @return reference to the toolbar + @rtype QToolBar """ for toolBar in self.__allToolBars.values(): if toolBar.objectName() == name: @@ -110,8 +114,10 @@ """ Private method to find an action by name. - @param name name of the action to search for (string) - @return reference to the action (QAction) + @param name name of the action to search for + @type str + @return reference to the action + @rtype QAction """ # check objectName() first for action in self.__allActions.values(): @@ -129,8 +135,10 @@ """ Private method to find a default toolbar by name. - @param name name of the default toolbar to search for (string) - @return reference to the default toolbar (QToolBar) + @param name name of the default toolbar to search for + @type str + @return reference to the default toolbar + @rtype QToolBar """ # check objectName() first for tbID in self.__defaultToolBars: @@ -154,7 +162,8 @@ """ Public method to set the reference to the main window. - @param mainWindow reference to the main window (QMainWindow) + @param mainWindow reference to the main window + @type QMainWindow """ self.__mainWindow = mainWindow @@ -162,7 +171,8 @@ """ Public method to get the reference to the main window. - @return reference to the main window (QMainWindow) + @return reference to the main window + @rtype QMainWindow """ return self.__mainWindow @@ -170,8 +180,10 @@ """ Public method to add a toolbar to be managed. - @param toolBar reference to the toolbar to be managed (QToolBar) - @param category category for the toolbar (string) + @param toolBar reference to the toolbar to be managed + @type QToolBar + @param category category for the toolbar + @type str """ if toolBar is None: return @@ -207,7 +219,8 @@ """ Public method to remove a toolbar added with addToolBar(). - @param toolBar reference to the toolbar to be removed (QToolBar) + @param toolBar reference to the toolbar to be removed + @type QToolBar """ if toolBar is None: return @@ -239,6 +252,7 @@ @param toolBars dictionary with toolbar id as key and a list of actions as value + @type dict """ for key, actions in toolBars.items(): tb = self.__allToolBars[key] @@ -248,8 +262,10 @@ """ Public method to set the actions of a toolbar. - @param toolBar reference to the toolbar to configure (QToolBar) - @param actions list of actions to be set (list of QAction) + @param toolBar reference to the toolbar to configure + @type QToolBar + @param actions list of actions to be set + @type list of QAction """ if toolBar is None: return @@ -311,7 +327,8 @@ """ Public method to reset a toolbar to its default state. - @param toolBar reference to the toolbar to configure (QToolBar) + @param toolBar reference to the toolbar to configure + @type QToolBar """ if not self.isDefaultToolBar(): return @@ -329,7 +346,8 @@ """ Public method to get all toolbars added with addToolBar(). - @return list of all default toolbars (list of QToolBar) + @return list of all default toolbars + @rtype list of QToolBar """ return list(self.__defaultToolBars.values()) @@ -337,8 +355,10 @@ """ Public method to check, if a toolbar was added with addToolBar(). - @param toolBar reference to the toolbar to be checked (QToolBar) - @return flag indicating an added toolbar (boolean) + @param toolBar reference to the toolbar to be checked + @type QToolBar + @return flag indicating an added toolbar + @rtype bool """ return toolBar is not None and id(toolBar) in self.__defaultToolBars @@ -346,9 +366,12 @@ """ Public method to create a custom toolbar. - @param title title to be used for the toolbar (string) - @param name optional name for the new toolbar (string) - @return reference to the created toolbar (QToolBar) + @param title title to be used for the toolbar + @type str + @param name optional name for the new toolbar + @type str + @return reference to the created toolbar + @rtype QToolBar """ if self.__mainWindow is None: return None @@ -380,7 +403,8 @@ """ Public method to remove a custom toolbar created with createToolBar(). - @param toolBar reference to the toolbar to be managed (QToolBar) + @param toolBar reference to the toolbar to be managed + @type QToolBar """ if toolBar is None: return @@ -407,8 +431,10 @@ """ Public method to give a toolbar a new title. - @param toolBar reference to the toolbar to be managed (QToolBar) - @param title title to be used for the toolbar (string) + @param toolBar reference to the toolbar to be managed + @type QToolBar + @param title title to be used for the toolbar + @type str """ if toolBar is None: return @@ -422,7 +448,8 @@ """ Public method to get all toolbars. - @return list of all toolbars (list of QToolBar) + @return list of all toolbars + @rtype list of QToolBar """ return list(self.__allToolBars.values()) @@ -430,8 +457,10 @@ """ Public method to add an action to be managed. - @param action reference to the action to be managed (QAction) - @param category category for the toolbar (string) + @param action reference to the action to be managed + @type QAction + @param category category for the toolbar + @type str """ if action is None: return @@ -466,7 +495,8 @@ """ Public method to remove an action from the manager. - @param action reference to the action to be removed (QAction) + @param action reference to the action to be removed + @type QAction """ aID = id(action) @@ -502,7 +532,8 @@ """ Public method to remove the actions belonging to a category. - @param category category for the actions (string) + @param category category for the actions + @type str """ for action in self.categoryActions(category): self.removeAction(action) @@ -511,8 +542,10 @@ """ Public method to save the state of the toolbar manager. - @param version version number stored with the data (integer) - @return saved state as a byte array (QByteArray) + @param version version number stored with the data + @type int + @return saved state as a byte array + @rtype QByteArray """ data = QByteArray() stream = QDataStream(data, QIODevice.OpenModeFlag.WriteOnly) @@ -563,9 +596,12 @@ """ Public method to restore the state of the toolbar manager. - @param state byte array containing the saved state (QByteArray) - @param version version number stored with the data (integer) - @return flag indicating success (boolean) + @param state byte array containing the saved state + @type QByteArray + @param version version number stored with the data + @type int + @return flag indicating success + @rtype bool """ if state.isEmpty(): return False @@ -638,8 +674,10 @@ """ Public method to get the toolbar for a widget action. - @param action widget action to check for (QAction) - @return reference to the toolbar containing action (QToolBar) + @param action widget action to check for + @type QAction + @return reference to the toolbar containing action + @rtype QToolBar """ aID = id(action) if aID in self.__widgetActions: @@ -652,6 +690,7 @@ @param actions dictionary with toolbar id as key and a list of widget actions as value + @type dict """ for tbID in list(actions): toolBar = self.__allToolBars[tbID] @@ -677,8 +716,10 @@ """ Public method to check, if action is a widget action. - @param action reference to the action to be checked (QAction) - @return flag indicating a widget action (boolean) + @param action reference to the action to be checked + @type QAction + @return flag indicating a widget action + @rtype bool """ return id(action) in self.__allWidgetActions @@ -686,7 +727,8 @@ """ Public method to get the list of categories. - @return list of categories (list of string) + @return list of categories + @rtype list of str """ return list(self.__categoryToActions) @@ -694,8 +736,10 @@ """ Public method to get the actions belonging to a category. - @param category category for the actions (string) - @return list of actions (list of QAction) + @param category category for the actions + @type str + @return list of actions + @rtype list of QAction """ if category not in self.__categoryToActions: return [] @@ -706,8 +750,10 @@ """ Public method to get an action given its id. - @param aID id of the action object (integer) - @return reference to the action (QAction) + @param aID id of the action object + @type int + @return reference to the action + @rtype QAction """ if aID not in self.__allActions: return None @@ -717,8 +763,10 @@ """ Public method to get a toolbar given its id. - @param tbID id of the toolbar object (integer) - @return reference to the toolbar (QToolBar) + @param tbID id of the toolbar object + @type int + @return reference to the toolbar + @rtype QToolBar """ if tbID not in self.__allToolBars: return None @@ -728,8 +776,10 @@ """ Public method to get a toolbar's actions given its id. - @param tbID id of the toolbar object (integer) - @return list of actions (list of QAction) + @param tbID id of the toolbar object + @type int + @return list of actions + @rtype list of QAction """ if tbID not in self.__toolBars: return [] @@ -741,6 +791,7 @@ @return reference to dictionary of toolbar IDs as key and list of actions as values + @rtype dict """ return self.__toolBars @@ -748,8 +799,10 @@ """ Public method to get a default toolbar's actions given its id. - @param tbID id of the default toolbar object (integer) - @return list of actions (list of QAction) + @param tbID id of the default toolbar object + @type int + @return list of actions + @rtype list of QAction """ if tbID not in self.__defaultToolBars: return []