mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Enhancement #1888456: Request: "if column is set/not set" for int columns
This commit is contained in:
parent
d572330733
commit
f5838785d9
@ -61,7 +61,9 @@ class ConditionEditor(QWidget): # {{{
|
|||||||
'int' : (
|
'int' : (
|
||||||
(_('is equal to'), 'eq'),
|
(_('is equal to'), 'eq'),
|
||||||
(_('is less than'), 'lt'),
|
(_('is less than'), 'lt'),
|
||||||
(_('is greater than'), 'gt')
|
(_('is greater than'), 'gt'),
|
||||||
|
(_('is set'), 'is set'),
|
||||||
|
(_('is not set'), 'is not set')
|
||||||
),
|
),
|
||||||
'datetime' : (
|
'datetime' : (
|
||||||
(_('is equal to'), 'eq'),
|
(_('is equal to'), 'eq'),
|
||||||
|
@ -129,6 +129,10 @@ class Rule(object): # {{{
|
|||||||
return "check_yes_no('%s', %s)"%(col, test)
|
return "check_yes_no('%s', %s)"%(col, test)
|
||||||
|
|
||||||
def number_condition(self, col, action, val):
|
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 = {
|
lt, eq, gt = {
|
||||||
'eq': ('', '1', ''),
|
'eq': ('', '1', ''),
|
||||||
'lt': ('1', '', ''),
|
'lt': ('1', '', ''),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user