mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix editing of series type custom columns in the book list. Fixes #8765 (Custom series like column weird behaviour)
This commit is contained in:
commit
215c469093
@ -791,6 +791,16 @@ 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 = unicode(value.toString()).strip()
|
val = unicode(value.toString()).strip()
|
||||||
|
if val:
|
||||||
|
pat = re.compile(r'\[([.0-9]+)\]')
|
||||||
|
match = pat.search(val)
|
||||||
|
if match is not None:
|
||||||
|
s_index = float(match.group(1))
|
||||||
|
val = pat.sub('', val).strip()
|
||||||
|
elif val:
|
||||||
|
if tweaks['series_index_auto_increment'] != 'const':
|
||||||
|
s_index = self.db.get_next_cc_series_num_for(val,
|
||||||
|
label=label, num=None)
|
||||||
elif typ == 'composite':
|
elif typ == 'composite':
|
||||||
tmpl = unicode(value.toString()).strip()
|
tmpl = unicode(value.toString()).strip()
|
||||||
disp = cc['display']
|
disp = cc['display']
|
||||||
|
@ -484,7 +484,9 @@ class CustomColumns(object):
|
|||||||
if not existing:
|
if not existing:
|
||||||
existing = []
|
existing = []
|
||||||
for x in set(set_val) - set(existing):
|
for x in set(set_val) - set(existing):
|
||||||
if x is None:
|
# normalized types are text and ratings, so we can do this check
|
||||||
|
# to see if we need to re-add the value
|
||||||
|
if not x:
|
||||||
continue
|
continue
|
||||||
case_change = False
|
case_change = False
|
||||||
existing = list(self.all_custom(num=data['num']))
|
existing = list(self.all_custom(num=data['num']))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user