Fix #5788 (Floating point numbers truncated to integer value)

This commit is contained in:
Kovid Goyal 2010-06-11 09:31:26 -06:00
commit 48b8cb4d75
3 changed files with 6 additions and 7 deletions

View File

@ -47,7 +47,7 @@ class Book(MetaInformation):
def __eq__(self, other):
# use lpath because the prefix can change, changing path
return self.path == getattr(other, 'lpath', None)
return self.lpath == getattr(other, 'lpath', None)
@dynamic_property
def db_id(self):

View File

@ -101,6 +101,11 @@ class Float(Int):
w.setSpecialValueText(_('Undefined'))
w.setSingleStep(1)
def setter(self, val):
if val is None:
val = self.widgets[1].minimum()
self.widgets[1].setValue(val)
class Rating(Int):
def setup_ui(self, parent):

View File

@ -1304,12 +1304,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
aid = self.conn.execute('INSERT INTO series(name) VALUES (?)', (series,)).lastrowid
self.conn.execute('INSERT INTO books_series_link(book, series) VALUES (?,?)', (id, aid))
self.conn.commit()
try:
row = self.row(id)
if row is not None:
self.data.set(row, 9, series)
except ValueError:
pass
self.data.set(id, self.FIELD_MAP['series'], series, row_is_id=True)
if notify:
self.notify('metadata', [id])