mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Book details panel: Show custom column values for numeric columns even when the value is zero
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
ecce202556
@ -69,7 +69,7 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=
|
|||||||
continue
|
continue
|
||||||
if field == 'sort':
|
if field == 'sort':
|
||||||
field = 'title_sort'
|
field = 'title_sort'
|
||||||
if metadata['datatype'] == 'bool':
|
if metadata['is_custom'] and metadata['datatype'] in {'bool', 'int', 'float'}:
|
||||||
isnull = mi.get(field) is None
|
isnull = mi.get(field) is None
|
||||||
else:
|
else:
|
||||||
isnull = mi.is_null(field)
|
isnull = mi.is_null(field)
|
||||||
|
@ -20,6 +20,7 @@ from calibre.gui2.dialogs.tag_editor import TagEditor
|
|||||||
from calibre.utils.config import tweaks
|
from calibre.utils.config import tweaks
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
from calibre.library.comments import comments_to_html
|
from calibre.library.comments import comments_to_html
|
||||||
|
from calibre.gui2.library.delegates import ClearingDoubleSpinBox, ClearingSpinBox
|
||||||
|
|
||||||
class Base(object):
|
class Base(object):
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ class Int(Base):
|
|||||||
|
|
||||||
def setup_ui(self, parent):
|
def setup_ui(self, parent):
|
||||||
self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent),
|
self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent),
|
||||||
QSpinBox(parent)]
|
ClearingSpinBox(parent)]
|
||||||
w = self.widgets[1]
|
w = self.widgets[1]
|
||||||
w.setRange(-1000000, 100000000)
|
w.setRange(-1000000, 100000000)
|
||||||
w.setSpecialValueText(_('Undefined'))
|
w.setSpecialValueText(_('Undefined'))
|
||||||
@ -114,7 +115,7 @@ class Float(Int):
|
|||||||
|
|
||||||
def setup_ui(self, parent):
|
def setup_ui(self, parent):
|
||||||
self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent),
|
self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent),
|
||||||
QDoubleSpinBox(parent)]
|
ClearingDoubleSpinBox(parent)]
|
||||||
w = self.widgets[1]
|
w = self.widgets[1]
|
||||||
w.setRange(-1000000., float(100000000))
|
w.setRange(-1000000., float(100000000))
|
||||||
w.setDecimals(2)
|
w.setDecimals(2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user