cleaned up some UI legace from the export interface...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-04-16 19:03:42 +03:00
parent dd9759035f
commit 39754e2ec0

View File

@ -2228,12 +2228,14 @@ var FileSystemWriterUIActions = actions.Actions({
// XXX is this the right title??? // XXX is this the right title???
// XXX this is not yet working... // XXX this is not yet working...
'Save index to current location': { 'Save index to current location': {
alias: 'save',
action: 'saveIndexHere', action: 'saveIndexHere',
data: [ data: [
'comment' 'comment'
], ],
}, },
'Current state as index': { 'Current state as index': {
alias: 'index',
action: 'exportIndex', action: 'exportIndex',
data: [ data: [
'target_dir', 'target_dir',
@ -2248,6 +2250,7 @@ var FileSystemWriterUIActions = actions.Actions({
], ],
}, },
'Images only': { 'Images only': {
alias: 'images',
action: 'exportDirs', action: 'exportDirs',
data: [ data: [
'pattern', 'pattern',
@ -2274,18 +2277,13 @@ var FileSystemWriterUIActions = actions.Actions({
// ...at this point this depends on .saveIndexHere(..), thus // ...at this point this depends on .saveIndexHere(..), thus
// it is here... // it is here...
// XXX should this return a promise??? // XXX should this return a promise???
saveFullIndex: ['File/Save (full)', saveFullIndex: ['File/Save ($full)',
function(){ function(){
return this return this
.markChanged('all') .markChanged('all')
.saveIndexHere()}], .saveIndexHere()}],
saveWithCommentDialog: ['File/Save with $comment...',
// XXX need to be able to make dirs... 'exportDialog: "save"'],
browseExportIndex: ['File/Export/Export Index...',
makeBrowseProxy('exportIndex')],
// XXX need to be able to make dirs...
browseExportDirs: ['File/Export/Export Images...',
makeBrowseProxy('exportDirs')],
// Export dialog... // Export dialog...
@ -2403,11 +2401,11 @@ var FileSystemWriterUIActions = actions.Actions({
length_limit: 10, length_limit: 10,
})) }))
}, },
// XXX should we merge this with 'size_limit'????
'size': function(actions, make, parent){ 'size': function(actions, make, parent){
return make(['Image $size: ', return make(['Image $size: ',
function(){ function(){
return actions.config['export-preview-size'] || 1000 }]) return actions.config['export-preview-size'] || 1000 }])
// XXX add validation???
.on('open', .on('open',
widgets.makeNestedConfigListEditor(actions, parent, widgets.makeNestedConfigListEditor(actions, parent,
'export-preview-sizes', 'export-preview-sizes',
@ -2415,6 +2413,8 @@ var FileSystemWriterUIActions = actions.Actions({
{ {
length_limit: 10, length_limit: 10,
sort: function(a, b){ return parseInt(a) - parseInt(b) }, sort: function(a, b){ return parseInt(a) - parseInt(b) },
check: function(e){
return !!parseInt(e) },
})) }))
}, },
@ -2423,13 +2423,11 @@ var FileSystemWriterUIActions = actions.Actions({
function(){ function(){
return actions.config['export-preview-size-limit'] || 'no limit' }], return actions.config['export-preview-size-limit'] || 'no limit' }],
{ buttons: [ { buttons: [
//['&times;', function(p){
['clear', function(p){ ['clear', function(p){
actions.config['export-preview-size-limit'] = 'no limit' actions.config['export-preview-size-limit'] = 'no limit'
parent.update() parent.update()
}], }],
] }) ] })
// XXX add validation???
.on('open', .on('open',
widgets.makeNestedConfigListEditor(actions, parent, widgets.makeNestedConfigListEditor(actions, parent,
'export-preview-size-limits', 'export-preview-size-limits',
@ -2534,14 +2532,26 @@ var FileSystemWriterUIActions = actions.Actions({
}) })
}, },
}, },
// XXX indicate export state: index, crop, image... // XXX update export state: index, crop, image...
exportDialog: ['File/Export/$Export...', // XXX should this be visible directly???
widgets.makeUIDialog(function(){ exportDialog: ['- File/$Export/Export...',
widgets.makeUIDialog(function(mode){
var that = this var that = this
// mode aliases...
var mode_aliases = Object.entries(that.config['export-dialog-modes'] || {})
.reduce(function(res, [key, value]){
res[value.alias || key] = key
return res
}, {})
var show_mode = mode_aliases[mode] || mode
var o = browse.makeLister(null, function(path, make){ var o = browse.makeLister(null, function(path, make){
var dialog = this var dialog = this
var mode = that.config['export-dialog-mode'] || 'Images only'
mode = show_mode
|| that.config['export-dialog-mode']
|| 'Images only'
// if invalid mode get the first... // if invalid mode get the first...
mode = !that.config['export-dialog-modes'][mode] ? mode = !that.config['export-dialog-modes'][mode] ?
Object.keys(that.config['export-dialog-modes']).shift() Object.keys(that.config['export-dialog-modes']).shift()
@ -2549,20 +2559,23 @@ var FileSystemWriterUIActions = actions.Actions({
var data = that.config['export-dialog-modes'][mode].data var data = that.config['export-dialog-modes'][mode].data
// mode selector... // mode selector...
make(['Export $mode: ', !show_mode
function(){ return mode }]) && make(['Export $mode: ',
.on('open', function(){
// XXX for some reason o is initially undefined when return mode }],
// it should be set to the dialog... {
//widgets.makeNestedConfigListEditor(that, o, // XXX for some reason o is initially undefined when
widgets.makeNestedConfigListEditor(that, make.dialog, // it should be set to the dialog...
'export-dialog-modes', //widgets.makeNestedConfigListEditor(that, o,
'export-dialog-mode', open: widgets.makeNestedConfigListEditor(that, make.dialog,
{ 'export-dialog-modes',
length_limit: 10, 'export-dialog-mode',
new_item: false, {
itemButtons: [], length_limit: 10,
})) new_item: false,
itemButtons: [],
}),
})
// get the root and user fields... // get the root and user fields...
var fields = that.__export_dialog_fields__ || {} var fields = that.__export_dialog_fields__ || {}
@ -2578,15 +2591,19 @@ var FileSystemWriterUIActions = actions.Actions({
// Start action... // Start action...
make([function(){ make([function(){
// XXX indicate export state: index, crop, image... // XXX indicate export state: index, crop, image...
return '$Export'}]) return mode == mode_aliases['save'] ?
.on('open', function(){ '$Save'
var mode = : '$Export'}],
that.config['export-dialog-modes'][that.config['export-dialog-mode']] {
that[mode.action]( cls: 'selected',
that.config['export-path'] || undefined) open: function(){
dialog.close() var mode =
}) that.config['export-dialog-modes'][that.config['export-dialog-mode']]
.addClass('selected') that[mode.action](
that.config['export-path'] || undefined)
dialog.close()
},
})
make.done() make.done()
}) })
@ -2595,6 +2612,13 @@ var FileSystemWriterUIActions = actions.Actions({
return o return o
})], })],
// aliases...
// NOTE: .saveWithCommentDialog(..) is another alias (see above)...
exportIndexDialog: ['File/Export/$Export Index...',
'exportDialog: "index"'],
exportImagesDialog: ['File/Export/Export $Images...',
'exportDialog: "images"'],
}) })