tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-09-27 03:41:22 +03:00
parent 078c977ad3
commit c32144bee7
2 changed files with 47 additions and 33 deletions

View File

@ -2653,26 +2653,29 @@ var FileSystemWriterUIActions = actions.Actions({
// ...a dict would require keys (gid/title??) // ...a dict would require keys (gid/title??)
// XXX should this api be accessible from outside the ui??? // XXX should this api be accessible from outside the ui???
'export-presets': [ 'export-presets': [
// XXX STUB: placeholders, replace with real examples...
{ {
type: 'images', 'name': './select (ribbons to "./fav/..")',
pattern: '%(fav)l%n%(-bookmarked)b%(-m)m%(-%c)c', 'mode': 'Images only',
size: '1000', 'path': './select',
include_virtual: true, 'include-virtual': true,
target_dir: './select', 'clean-target': true,
clean_target_dir: true, 'preview-name-pattern': '%(fav)l%n%(-%c)c',
'preview-size': 1000,
'preview-size-limit': 'no limit',
}, },
{ {
type: 'index', 'mode': 'Images only',
size: '1000', 'path': 'L:/tmp/test/export-test/images-only/',
include_virtual: true, 'include-virtual': true,
target_dir: './select', 'clean-target': true,
clean_target_dir: true, 'preview-name-pattern': '%(fav)l%n%(-%c)c',
comment: 'demo', 'preview-size': 1000,
'preview-size-limit': 'no limit',
}, },
], ],
'export-history': [ // XXX need to manage history length...
], 'export-history-length': 50,
'export-history': [],
}, },
// XXX this needs feedback... // XXX this needs feedback...
@ -3092,13 +3095,12 @@ var FileSystemWriterUIActions = actions.Actions({
var that = this var that = this
// presets... // presets...
// XXX better names...
var presets = that.config['export-presets'] || [] var presets = that.config['export-presets'] || []
var index = presets var index = presets
.reduce(function(res, e, i){ .reduce(function(res, e, i){
name = e.name name = e.name
// XXX these should be type-specific... // XXX these should be type-specific...
|| `${ e.type }: ${ e.target_dir }${ e.pattern ? ': "'+e.pattern+'"' : '' }` || `${ e.mode }: ${ e.path }`
res[name] = i res[name] = i
return res }, {}) return res }, {})
var keys = Object.keys(index) var keys = Object.keys(index)
@ -3106,6 +3108,20 @@ var FileSystemWriterUIActions = actions.Actions({
// history... // history...
// XXX // XXX
var history = [] var history = []
var history_index = {}
var history_keys = Object.keys(history_index)
var runExport = function(title, presets, index){
// XXX BUG: this does not get the second preset...
var preset = presets[index[title]]
console.log('###', title, preset)
// XXX load...
// XXX STUB...
that.exportDialog(preset)
}
return browse.makeLister(null, function(path, make){ return browse.makeLister(null, function(path, make){
// presets... // presets...
@ -3116,7 +3132,7 @@ var FileSystemWriterUIActions = actions.Actions({
sortable: true, sortable: true,
new_item: false, new_item: false,
buttons: [ buttons: [
// XXX new export... // XXX new export or should this be edit???
['N', function(){ ['N', function(){
// XXX // XXX
}], }],
@ -3126,15 +3142,8 @@ var FileSystemWriterUIActions = actions.Actions({
], ],
// XXX export... // XXX export...
open: function(evt, title){ open: function(evt, title){
var preset = presets[index[title]] runExport(title, presets, index)
// XXX handle order... make.dialog.close() },
// XXX handle removed...
// XXX load...
console.log('###', title, preset)
},
// XXX handle rename -> update index... // XXX handle rename -> update index...
// XXX // XXX
}) })
@ -3168,8 +3177,8 @@ var FileSystemWriterUIActions = actions.Actions({
], ],
// XXX export... // XXX export...
open: function(evt, title){ open: function(evt, title){
console.log('###', title) runExport(title, history, history_index)
}, make.dialog.close() },
}) })
}) })
.close(function(){ .close(function(){
@ -3182,11 +3191,14 @@ var FileSystemWriterUIActions = actions.Actions({
// XXX these do note need the ui -- move to a separate feature... // XXX these do note need the ui -- move to a separate feature...
// XXX these are essentially the same as the history API, make a // XXX these are essentially the same as the history API, make a
// generic list manager??? // generic list manager???
saveExportPreset: ['- File/', exportPresetSave: ['- File/',
function(){}], function(){}],
deleteExportPreset: ['- File/', exportPresetDelete: ['- File/',
function(){}], function(){}],
runExportPreset: ['- File/', exportPresetRun: ['- File/',
function(){}],
exportHistoryPush: ['- File/',
function(){}], function(){}],
}) })

View File

@ -227,7 +227,9 @@ module.GLOBAL_KEYBOARD = {
// open/save... // open/save...
O: 'browsePath', O: 'browsePath',
ctrl_S: 'saveIndexHere', ctrl_S: 'saveIndexHere',
ctrl_shift_S: 'exportDialog', //ctrl_shift_S: 'exportDialog',
ctrl_shift_S: 'exportPresets',
ctrl_alt_S: 'exportDialog',
// external editors... // external editors...