mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
Fix #1926454 [[Enhancement] Add a context menu action to expand/collapse all categories of plugins](https://bugs.launchpad.net/calibre/+bug/1926454)
This commit is contained in:
parent
efd443ecb6
commit
29336f4e32
@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import textwrap, os
|
import textwrap, os
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from qt.core import (Qt, QModelIndex, QAbstractItemModel, QIcon,
|
from qt.core import (Qt, QMenu, QModelIndex, QAbstractItemModel, QIcon,
|
||||||
QBrush, QDialog, QItemSelectionModel, QAbstractItemView)
|
QBrush, QDialog, QItemSelectionModel, QAbstractItemView)
|
||||||
|
|
||||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
||||||
@ -250,6 +250,14 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.previous_button.clicked.connect(self.find_previous)
|
self.previous_button.clicked.connect(self.find_previous)
|
||||||
self.changed_signal.connect(self.reload_store_plugins)
|
self.changed_signal.connect(self.reload_store_plugins)
|
||||||
self.user_installed_plugins.stateChanged.connect(self.show_user_installed_plugins)
|
self.user_installed_plugins.stateChanged.connect(self.show_user_installed_plugins)
|
||||||
|
self.plugin_view.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
|
self.plugin_view.customContextMenuRequested.connect(self.show_context_menu)
|
||||||
|
|
||||||
|
def show_context_menu(self, pos):
|
||||||
|
menu = QMenu(self)
|
||||||
|
menu.addAction(_('Expand all'), self.plugin_view.expandAll)
|
||||||
|
menu.addAction(_('Collapse all'), self.plugin_view.collapseAll)
|
||||||
|
menu.exec_(self.plugin_view.mapToGlobal(pos))
|
||||||
|
|
||||||
def show_user_installed_plugins(self, state):
|
def show_user_installed_plugins(self, state):
|
||||||
self._plugin_model.toggle_shown_plugins(self.user_installed_plugins.isChecked())
|
self._plugin_model.toggle_shown_plugins(self.user_installed_plugins.isChecked())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user