diff --git a/src/calibre/gui2/preferences/coloring.py b/src/calibre/gui2/preferences/coloring.py index 162070d051..ae0c7ff315 100644 --- a/src/calibre/gui2/preferences/coloring.py +++ b/src/calibre/gui2/preferences/coloring.py @@ -61,7 +61,9 @@ class ConditionEditor(QWidget): # {{{ 'int' : ( (_('is equal to'), 'eq'), (_('is less than'), 'lt'), - (_('is greater than'), 'gt') + (_('is greater than'), 'gt'), + (_('is set'), 'is set'), + (_('is not set'), 'is not set') ), 'datetime' : ( (_('is equal to'), 'eq'), diff --git a/src/calibre/library/coloring.py b/src/calibre/library/coloring.py index e877db474b..e2a24eb739 100644 --- a/src/calibre/library/coloring.py +++ b/src/calibre/library/coloring.py @@ -129,6 +129,10 @@ class Rule(object): # {{{ return "check_yes_no('%s', %s)"%(col, test) def number_condition(self, col, action, val): + if action == 'is set': + return "test(field('%s'), '1', '')"%col + if action == 'is not set': + return "test(field('%s'), '', '1')"%col lt, eq, gt = { 'eq': ('', '1', ''), 'lt': ('1', '', ''),