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 mode copy|move
} }
''' '''
if 'cancel' in state.activity: if os.path.exists(data['path']):
del state.activity['cancel'] state.activity = {
state.tasks.queue('import', data) 'activity': 'import',
'path': data['path'],
}
state.tasks.queue('import', data)
return {} return {}
actions.register(_import, 'import', cache=False) actions.register(_import, 'import', cache=False)

View File

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

View File

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