mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 22:06:02 +02:00
Enhancement #1934211: Show warning in User category editor
This commit is contained in:
parent
d5b6005a34
commit
8b25db556b
1 changed files with 11 additions and 1 deletions
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
from calibre.gui2.dialogs.tag_categories_ui import Ui_TagCategories
|
||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||
from calibre.gui2 import error_dialog
|
||||
from calibre.gui2 import error_dialog, warning_dialog
|
||||
from calibre.constants import islinux
|
||||
from calibre.utils.icu import sort_key, strcmp, primary_contains
|
||||
from polyglot.builtins import iteritems, unicode_type
|
||||
|
|
@ -201,6 +201,11 @@ def apply_tags(self, node=None):
|
|||
if self.current_cat_name is None:
|
||||
return
|
||||
nodes = self.available_items_box.selectedItems() if node is None else [node]
|
||||
if len(nodes) == 0:
|
||||
warning_dialog(self, _('No items selected'),
|
||||
_('You must select items to apply'),
|
||||
show=True, show_copy_button=False)
|
||||
return
|
||||
for node in nodes:
|
||||
index = self.all_items[node.data(Qt.ItemDataRole.UserRole)].index
|
||||
if index not in self.applied_items:
|
||||
|
|
@ -213,6 +218,11 @@ def unapply_button_clicked(self):
|
|||
|
||||
def unapply_tags(self, node=None):
|
||||
nodes = self.applied_items_box.selectedItems() if node is None else [node]
|
||||
if len(nodes) == 0:
|
||||
warning_dialog(self, _('No items selected'),
|
||||
_('You must select items to unapply'),
|
||||
show=True, show_copy_button=False)
|
||||
return
|
||||
for node in nodes:
|
||||
index = self.all_items[node.data(Qt.ItemDataRole.UserRole)].index
|
||||
self.applied_items.remove(index)
|
||||
|
|
|
|||
Loading…
Reference in a new issue