Fixes #1909507 [Enhancement Request: Make "Formats" a default column](https://bugs.launchpad.net/calibre/+bug/1909507)
This commit is contained in:
Kovid Goyal 2020-12-29 15:27:33 +05:30
commit 2e367ac402
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 4 deletions

View File

@ -242,7 +242,8 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
if self.coloring:
self.color_layout.setVisible(True)
for n1, k1 in cols:
self.colored_field.addItem(n1, k1)
self.colored_field.addItem(n1 +
(' (' + k1 + ')' if k1 != color_row_key else ''), k1)
self.colored_field.setCurrentIndex(self.colored_field.findData(color_field))
elif self.iconing or self.embleming:
self.icon_layout.setVisible(True)
@ -253,7 +254,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
self.icon_field.setVisible(False)
for n1, k1 in cols:
self.icon_field.addItem(n1, k1)
self.icon_field.addItem('{} ({})'.format(n1, k1), k1)
self.icon_file_names = []
d = os.path.join(config_dir, 'cc_icons')
if os.path.exists(d):

View File

@ -137,7 +137,7 @@ class ConditionEditor(QWidget): # {{{
for key in sorted(
conditionable_columns(fm),
key=lambda key: sort_key(fm[key]['name'])):
self.column_box.addItem(fm[key]['name'], key)
self.column_box.addItem('{} ({})'.format(fm[key]['name'], key), key)
self.column_box.setCurrentIndex(0)
self.column_box.currentIndexChanged.connect(self.init_action_box)
@ -443,7 +443,8 @@ class RuleEditor(QDialog): # {{{
continue
name = all_columns_string if key == color_row_key else fm[key]['name']
if name:
self.column_box.addItem(name, key)
self.column_box.addItem(name +
(' (' + key + ')' if key != color_row_key else ''), key)
self.column_box.setCurrentIndex(0)
if self.rule_kind == 'color':