mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
e37e14b017
commit
05cf89a1f0
@ -75,13 +75,13 @@ class FilenamePattern(QWidget, Ui_Form):
|
|||||||
# has added.
|
# has added.
|
||||||
val_hist = [unicode(self.re.lineEdit().text())] + [unicode(self.re.itemText(i)) for i in xrange(self.re.count())]
|
val_hist = [unicode(self.re.lineEdit().text())] + [unicode(self.re.itemText(i)) for i in xrange(self.re.count())]
|
||||||
self.re.clear()
|
self.re.clear()
|
||||||
|
|
||||||
if defaults:
|
if defaults:
|
||||||
val = prefs.defaults['filename_pattern']
|
val = prefs.defaults['filename_pattern']
|
||||||
else:
|
else:
|
||||||
val = prefs['filename_pattern']
|
val = prefs['filename_pattern']
|
||||||
self.re.lineEdit().setText(val)
|
self.re.lineEdit().setText(val)
|
||||||
|
|
||||||
val_hist += gprefs.get('filename_pattern_history', ['(?P<title>.+)', '(?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ?'])
|
val_hist += gprefs.get('filename_pattern_history', ['(?P<title>.+)', '(?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ?'])
|
||||||
if val in val_hist:
|
if val in val_hist:
|
||||||
del val_hist[val_hist.index(val)]
|
del val_hist[val_hist.index(val)]
|
||||||
@ -129,15 +129,15 @@ class FilenamePattern(QWidget, Ui_Form):
|
|||||||
def commit(self):
|
def commit(self):
|
||||||
pat = self.pattern().pattern
|
pat = self.pattern().pattern
|
||||||
prefs['filename_pattern'] = pat
|
prefs['filename_pattern'] = pat
|
||||||
|
|
||||||
history = []
|
history = []
|
||||||
history_pats = [unicode(self.re.lineEdit().text())] + [unicode(self.re.itemText(i)) for i in xrange(self.re.count())]
|
history_pats = [unicode(self.re.lineEdit().text())] + [unicode(self.re.itemText(i)) for i in xrange(self.re.count())]
|
||||||
for p in history_pats[:14]:
|
for p in history_pats[:14]:
|
||||||
# Ensure we don't have duplicate items.
|
# Ensure we don't have duplicate items.
|
||||||
if p and p not in history:
|
if p and p not in history:
|
||||||
history.append(p)
|
history.append(p)
|
||||||
gprefs['filename_pattern_history'] = history
|
gprefs['filename_pattern_history'] = history
|
||||||
|
|
||||||
return pat
|
return pat
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user