some cleanup of external editor ui, still not final...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-01-06 20:58:23 +03:00
parent 4743531cd5
commit 9f7e267527

View File

@ -382,6 +382,11 @@ module.WidgetTest = core.ImageGridFeatures.Feature({
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// External editor... // External editor...
// XXX need to get the resulting (edited) file and add it to the index... // XXX need to get the resulting (edited) file and add it to the index...
// XXX make a UI for adding new editors:
// - enter path / browse (done)
// - pretty name
// - shortcut key
// - image type to open
// XXX move this to a separate feature... // XXX move this to a separate feature...
var ExternalEditorActions = actions.Actions({ var ExternalEditorActions = actions.Actions({
@ -390,11 +395,11 @@ var ExternalEditorActions = actions.Actions({
// XXX // XXX
'external-editors': [ 'external-editors': [
// XXX system default might be different on different systems... // XXX system default might be different on different systems...
['System default|"$PATH"', 'current'], ['System default|"$PATH"'],
// XXX for some reason irfanview doesnot open a path passed // XXX for some reason irfanview doesnot open a path passed
// as argument unless it uses only '\' and not '/' // as argument unless it uses only '\' and not '/'
['IrfanView|"C:/Program Files (x86)/IrfanView/i_view32.exe" "$PATH"', 'current'], ['IrfanView|"C:/Program Files (x86)/IrfanView/i_view32.exe" "$PATH"'],
], ],
}, },
@ -421,13 +426,15 @@ var ExternalEditorActions = actions.Actions({
var full_path = img.base_path +'/'+ img.path var full_path = img.base_path +'/'+ img.path
// XXX is this portable enough???
var path = requirejs('path')
full_path = path.normalize(full_path)
editor = editor editor = editor
// XXX make '$' quotable.... // XXX make '$' quotable....
.replace(/\$PATH/, full_path) .replace(/\$PATH/, full_path)
// XXX add other stuff??? // XXX add other stuff???
console.log('>>>>', editor)
// do the actual running... // do the actual running...
requirejs('child_process') requirejs('child_process')
.exec(editor, function(err, res){ .exec(editor, function(err, res){
@ -494,7 +501,10 @@ var ExternalEditorUIActions = actions.Actions({
// XXX update the editor list... // XXX update the editor list...
// is this the correct way to do this???
b.close() b.close()
o.close()
that.listExtenalEditors()
})) }))
.close(function(){ .close(function(){
o.focus() o.focus()