This commit is contained in:
Kovid Goyal 2022-04-26 17:11:17 +05:30
commit fde3f7bbb0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -61,7 +61,7 @@ class MarkWithTextDialog(QDialog):
layout.addWidget(button_box, button_rows+3, 0, 1, 2) layout.addWidget(button_box, button_rows+3, 0, 1, 2)
def text(self): def text(self):
return self.text_box.text() return self.text_box.text().strip()
def button_pushed(self, checked, text=''): def button_pushed(self, checked, text=''):
self.text_box.setText(text) self.text_box.setText(text)
@ -69,7 +69,7 @@ class MarkWithTextDialog(QDialog):
self.accept() self.accept()
def accept(self): def accept(self):
if not self.text_box.text(): if not self.text_box.text().strip():
d = error_dialog(self.gui, _('Value cannot be empty'), _('You must provide a value')) d = error_dialog(self.gui, _('Value cannot be empty'), _('You must provide a value'))
d.exec_() d.exec_()
else: else:
@ -173,10 +173,14 @@ class MarkBooksAction(InterfaceAction):
labels = sorted(counts.keys(), key=sort_key) labels = sorted(counts.keys(), key=sort_key)
self.show_marked_with_text.clear() self.show_marked_with_text.clear()
if len(labels): if len(labels):
labs = labels[0:40]
self.show_marked_with_text.setEnabled(True) self.show_marked_with_text.setEnabled(True)
for t in labels: for t in labs:
ac = self.show_marked_with_text.addAction(self.search_icon, f'{t} ({counts[t]})') ac = self.show_marked_with_text.addAction(self.search_icon, f'{t} ({counts[t]})')
ac.triggered.connect(partial(self.show_marked_text, txt=t)) ac.triggered.connect(partial(self.show_marked_text, txt=t))
if len(labs) < len(labels):
self.show_marked_with_text.addAction(
_('{0} labels not shown').format(len(labels) - len(labs)))
else: else:
self.show_marked_with_text.setEnabled(False) self.show_marked_with_text.setEnabled(False)