Sat, 27 Jul 2024 17:23:40 +0200
Changed the toolbars configuration dialog slightly to present the actions list of the selected category, if the selected toolbar name is such a predefined category.
src/eric7/EricWidgets/EricToolBarDialog.py | file | annotate | diff | comparison | revisions |
--- a/src/eric7/EricWidgets/EricToolBarDialog.py Sat Jul 27 14:22:24 2024 +0200 +++ b/src/eric7/EricWidgets/EricToolBarDialog.py Sat Jul 27 17:23:40 2024 +0200 @@ -9,10 +9,11 @@ from dataclasses import dataclass -from PyQt6.QtCore import Qt, pyqtSlot +from PyQt6.QtCore import QItemSelectionModel, Qt, pyqtSlot from PyQt6.QtGui import QColor from PyQt6.QtWidgets import ( QAbstractButton, + QAbstractItemView, QDialog, QDialogButtonBox, QInputDialog, @@ -137,12 +138,6 @@ self.__toolBarItemToWidgetActionID[id(tbItem)].append(aID) tbItem.actionIDs = actionIDs self.toolbarComboBox.addItem(tb.windowTitle(), int(id(tbItem))) - if default: - self.toolbarComboBox.setItemData( - self.toolbarComboBox.count() - 1, - QColor(Qt.GlobalColor.darkGreen), - Qt.ItemDataRole.ForegroundRole, - ) self.toolbarComboBox.model().sort(0) self.toolbarComboBox.currentIndexChanged[int].connect( @@ -302,6 +297,18 @@ ) self.toolbarActionsList.setCurrentRow(0) + category = self.toolbarComboBox.itemText(index) + for index in range(self.actionsTree.topLevelItemCount()): + topItem = self.actionsTree.topLevelItem(index) + if topItem.text(0) == category: + self.actionsTree.setCurrentItem( + topItem, 0, QItemSelectionModel.SelectionFlag.SelectCurrent + ) + self.actionsTree.scrollToItem( + topItem, QAbstractItemView.ScrollHint.PositionAtTop + ) + break + self.__setupButtons() @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem)