mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix clearing custom series columns. They should be cleared to None, not the empty string
This commit is contained in:
parent
6623db3063
commit
00b25125b1
@ -299,7 +299,9 @@ class Series(Base):
|
|||||||
val, s_index = self.gui_val
|
val, s_index = self.gui_val
|
||||||
val = self.normalize_ui_val(val)
|
val = self.normalize_ui_val(val)
|
||||||
if val != self.initial_val or s_index != self.initial_index:
|
if val != self.initial_val or s_index != self.initial_index:
|
||||||
if s_index == 0.0:
|
if val == '':
|
||||||
|
val = s_index = None
|
||||||
|
elif s_index == 0.0:
|
||||||
if tweaks['series_index_auto_increment'] == 'next':
|
if tweaks['series_index_auto_increment'] == 'next':
|
||||||
s_index = self.db.get_next_cc_series_num_for(val,
|
s_index = self.db.get_next_cc_series_num_for(val,
|
||||||
num=self.col_id)
|
num=self.col_id)
|
||||||
@ -488,7 +490,7 @@ class BulkSeries(BulkBase):
|
|||||||
|
|
||||||
def commit(self, book_ids, notify=False):
|
def commit(self, book_ids, notify=False):
|
||||||
val, update_indices, force_start, at_value, clear = self.gui_val
|
val, update_indices, force_start, at_value, clear = self.gui_val
|
||||||
val = '' if clear else self.normalize_ui_val(val)
|
val = None if clear else self.normalize_ui_val(val)
|
||||||
if clear or val != '':
|
if clear or val != '':
|
||||||
extras = []
|
extras = []
|
||||||
next_index = self.db.get_next_cc_series_num_for(val, num=self.col_id)
|
next_index = self.db.get_next_cc_series_num_for(val, num=self.col_id)
|
||||||
|
@ -743,6 +743,8 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
val = qt_to_dt(val, as_utc=False)
|
val = qt_to_dt(val, as_utc=False)
|
||||||
elif typ == 'series':
|
elif typ == 'series':
|
||||||
val, s_index = parse_series_string(self.db, label, value.toString())
|
val, s_index = parse_series_string(self.db, label, value.toString())
|
||||||
|
if not val:
|
||||||
|
val = s_index = None
|
||||||
elif typ == 'composite':
|
elif typ == 'composite':
|
||||||
tmpl = unicode(value.toString()).strip()
|
tmpl = unicode(value.toString()).strip()
|
||||||
disp = cc['display']
|
disp = cc['display']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user