mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Edit Book: Bulk file rename dialog: Remember last used prefix
This commit is contained in:
parent
d5640ec8b7
commit
0e79f5a1c3
@ -74,7 +74,9 @@ def get_bulk_rename_settings(parent, number, msg=None, sanitize=sanitize_file_na
|
|||||||
d.l = l = QFormLayout(d)
|
d.l = l = QFormLayout(d)
|
||||||
d.setLayout(l)
|
d.setLayout(l)
|
||||||
d.prefix = p = QLineEdit(d)
|
d.prefix = p = QLineEdit(d)
|
||||||
prefix = prefix or {k:v for k, __, v in CATEGORIES}.get(category, _('Chapter-'))
|
default_prefix = {k:v for k, __, v in CATEGORIES}.get(category, _('Chapter-'))
|
||||||
|
previous = tprefs.get('file-list-bulk-rename-prefix', {})
|
||||||
|
prefix = prefix or previous.get(category, default_prefix)
|
||||||
p.setText(prefix)
|
p.setText(prefix)
|
||||||
p.selectAll()
|
p.selectAll()
|
||||||
d.la = la = QLabel(msg or _(
|
d.la = la = QLabel(msg or _(
|
||||||
@ -90,6 +92,8 @@ def get_bulk_rename_settings(parent, number, msg=None, sanitize=sanitize_file_na
|
|||||||
|
|
||||||
if d.exec_() == d.Accepted:
|
if d.exec_() == d.Accepted:
|
||||||
prefix = sanitize(unicode(d.prefix.text()))
|
prefix = sanitize(unicode(d.prefix.text()))
|
||||||
|
previous[category] = prefix
|
||||||
|
tprefs.set('file-list-bulk-rename-prefix', previous)
|
||||||
num = d.num.value()
|
num = d.num.value()
|
||||||
fmt = '%d'
|
fmt = '%d'
|
||||||
if leading_zeros:
|
if leading_zeros:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user