mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Changes after testing advance icon rules
This commit is contained in:
parent
2add5649ef
commit
4b3c9ba540
@ -203,13 +203,13 @@ class TemplateHighlighter(QSyntaxHighlighter):
|
||||
class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
|
||||
def __init__(self, parent, text, mi=None, fm=None, color_field=None,
|
||||
icon_file=None, icon_rule_kind=None):
|
||||
icon_field_key=None, icon_rule_kind=None):
|
||||
QDialog.__init__(self, parent)
|
||||
Ui_TemplateDialog.__init__(self)
|
||||
self.setupUi(self)
|
||||
|
||||
self.coloring = color_field is not None
|
||||
self.iconing = icon_file is not None
|
||||
self.iconing = icon_field_key is not None
|
||||
|
||||
cols = []
|
||||
if fm is not None:
|
||||
@ -229,7 +229,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
self.color_layout.setVisible(True)
|
||||
for n1, k1 in cols:
|
||||
self.colored_field.addItem(n1, k1)
|
||||
self.colored_field.setCurrentIndex(self.colored_field.findText(color_field))
|
||||
self.colored_field.setCurrentIndex(self.colored_field.findData(color_field))
|
||||
colors = QColor.colorNames()
|
||||
colors.sort()
|
||||
self.color_name.addItems(colors)
|
||||
@ -250,6 +250,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
self.icon_with_text.setChecked(True)
|
||||
if icon_rule_kind == 'icon_only':
|
||||
self.icon_without_text.setChecked(True)
|
||||
self.icon_field.setCurrentIndex(self.icon_field.findData(icon_field_key))
|
||||
|
||||
if mi:
|
||||
self.mi = mi
|
||||
|
@ -114,7 +114,7 @@
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="image_chooser_label">
|
||||
<property name="text">
|
||||
<string>Copy a icon file name to the clipboard:</string>
|
||||
<string>Copy an icon file name to the clipboard:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>color_name</cstring>
|
||||
@ -135,14 +135,17 @@
|
||||
<normaloff>:/images/edit-copy.png</normaloff>:/images/edit-copy.png</iconset>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy the selected color name to the clipboard</string>
|
||||
<string>Copy the selected icon file name to the clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="filename_button">
|
||||
<property name="text">
|
||||
<string>Add file</string>
|
||||
<string>Add icon</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add an icon file to the set of choices</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -793,7 +793,7 @@ class EditRules(QWidget): # {{{
|
||||
self.rules_view.scrollTo(idx)
|
||||
self.changed.emit()
|
||||
else:
|
||||
td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, icon_file='')
|
||||
td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, icon_field_key='')
|
||||
if td.exec_() == td.Accepted:
|
||||
print(td.rule)
|
||||
typ, col, r = td.rule
|
||||
@ -813,7 +813,7 @@ class EditRules(QWidget): # {{{
|
||||
elif self.pref_name == 'column_color_rules':
|
||||
d = TemplateDialog(self, rule, mi=self.mi, fm=self.fm, color_field=col)
|
||||
else:
|
||||
d = TemplateDialog(self, rule, mi=self.mi, fm=self.fm, icon_file=col,
|
||||
d = TemplateDialog(self, rule, mi=self.mi, fm=self.fm, icon_field_key=col,
|
||||
icon_rule_kind=kind)
|
||||
|
||||
if d.exec_() == d.Accepted:
|
||||
|
Loading…
x
Reference in New Issue
Block a user