cancel while reading in directory
This commit is contained in:
parent
f2c7491d4c
commit
60a454d929
1 changed files with 4 additions and 0 deletions
|
@ -136,12 +136,16 @@ def run_import(options=None):
|
||||||
if ext in extensions:
|
if ext in extensions:
|
||||||
books.append(f)
|
books.append(f)
|
||||||
count += 1
|
count += 1
|
||||||
|
if state.activity.get('cancel'):
|
||||||
|
state.activity = {}
|
||||||
|
return
|
||||||
if count % 1000 == 0:
|
if count % 1000 == 0:
|
||||||
state.activity = {
|
state.activity = {
|
||||||
'activity': 'import',
|
'activity': 'import',
|
||||||
'path': prefix,
|
'path': prefix,
|
||||||
'progress': [0, count],
|
'progress': [0, count],
|
||||||
}
|
}
|
||||||
|
trigger_event('activity', state.activity)
|
||||||
state.activity = {
|
state.activity = {
|
||||||
'activity': 'import',
|
'activity': 'import',
|
||||||
'path': prefix,
|
'path': prefix,
|
||||||
|
|
Loading…
Reference in a new issue