fix import state before import started

This commit is contained in:
j 2016-01-25 12:18:24 +05:30
parent 26f2a40601
commit ceffe456db
3 changed files with 16 additions and 11 deletions

View File

@ -328,9 +328,12 @@ def _import(data):
mode copy|move
}
'''
if 'cancel' in state.activity:
del state.activity['cancel']
state.tasks.queue('import', data)
if os.path.exists(data['path']):
state.activity = {
'activity': 'import',
'path': data['path'],
}
state.tasks.queue('import', data)
return {}
actions.register(_import, 'import', cache=False)

View File

@ -233,13 +233,14 @@ def run_import(options=None):
remove_empty_folders(prefix, True)
def import_folder():
import_path = settings.preferences['importPath']
logger.debug('scan importPath %s', import_path)
if os.path.exists(import_path):
run_import({
'path': import_path,
'mode': 'move'
})
remove_empty_folders(import_path, True)
if not (state.activity and state.activity.get('activity') == 'import'):
import_path = settings.preferences['importPath']
logger.debug('scan importPath %s', import_path)
if os.path.exists(import_path):
run_import({
'path': import_path,
'mode': 'move'
})
remove_empty_folders(import_path, True)
if state.main:
state.main.call_later(10*60, lambda: state.tasks.queue('scanimport'))

View File

@ -111,6 +111,7 @@ oml.ui.importExportDialog = function() {
: renderForm('export', isActive)
);
that.options({content: $outerPanel});
setButton(result.data);
});
});