From 478369c7cba88cf04d8778d8d4b2ea14c40872ed Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Sun, 22 May 2011 20:47:47 +0100 Subject: [PATCH] Add colors icon to preferences dialog. Correctly clean template values when the column is set to empty. --- src/calibre/gui2/preferences/look_feel.py | 8 +++++++- src/calibre/gui2/preferences/look_feel.ui | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index c96d980505..ffbc82eefd 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -194,7 +194,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): choices = db.field_metadata.displayable_field_keys() choices.sort(key=sort_key) choices.insert(0, '') - for i in range(1, db.column_color_count+1): + self.column_color_count = db.column_color_count+1 + for i in range(1, self.column_color_count): r('column_color_name_'+str(i), db.prefs, choices=choices) r('column_color_template_'+str(i), db.prefs) all_colors = [unicode(s) for s in list(QColor.colorNames())] @@ -267,6 +268,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.changed_signal.emit() def commit(self, *args): + for i in range(1, self.column_color_count): + col = getattr(self, 'opt_column_color_name_'+str(i)) + if not col.currentText(): + temp = getattr(self, 'opt_column_color_template_'+str(i)) + temp.setText('') rr = ConfigWidgetBase.commit(self, *args) if self.current_font != self.initial_font: gprefs['font'] = (self.current_font[:4] if self.current_font else diff --git a/src/calibre/gui2/preferences/look_feel.ui b/src/calibre/gui2/preferences/look_feel.ui index 1194109c6c..9dedcf4f8c 100644 --- a/src/calibre/gui2/preferences/look_feel.ui +++ b/src/calibre/gui2/preferences/look_feel.ui @@ -410,7 +410,7 @@ then the tags will be displayed each on their own line. - :/images/cover_flow.png:/images/cover_flow.png + :/images/format-fill-color.png:/images/format-fill-color.png Column Coloring