Fix #1924674 [Column icon editor: Advanced template has no column selected by default](https://bugs.launchpad.net/calibre/+bug/1924674)
This commit is contained in:
Kovid Goyal 2021-04-17 16:00:40 +05:30
commit f51826b188
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -710,19 +710,22 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
def accept(self):
txt = unicode_type(self.textbox.toPlainText()).rstrip()
if (self.coloring or self.iconing or self.embleming) and not txt:
error_dialog(self, _('No template provided'),
_('The template box cannot be empty'), show=True)
return
if self.coloring:
if self.colored_field.currentIndex() == -1:
error_dialog(self, _('No column chosen'),
_('You must specify a column to be colored'), show=True)
return
if not txt:
error_dialog(self, _('No template provided'),
_('The template box cannot be empty'), show=True)
return
self.rule = (unicode_type(self.colored_field.itemData(
self.colored_field.currentIndex()) or ''), txt)
elif self.iconing:
if self.icon_field.currentIndex() == -1:
error_dialog(self, _('No column chosen'),
_('You must specify the column where the icons are applied'), show=True)
return
rt = unicode_type(self.icon_kind.itemData(self.icon_kind.currentIndex()) or '')
self.rule = (rt,
unicode_type(self.icon_field.itemData(