From ffe8c86a126f0c7d77a581118e530e52fc14c5de Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 22 Sep 2020 18:23:19 +0300 Subject: [PATCH] working on export presets... Signed-off-by: Alex A. Naanou --- Viewer/experiments/grayscale.jpg | Bin 0 -> 1919 bytes Viewer/features/filesystem.js | 113 ++++++++++++++++++++++++------- Viewer/lib/widget/browse.js | 3 +- 3 files changed, 88 insertions(+), 28 deletions(-) create mode 100644 Viewer/experiments/grayscale.jpg diff --git a/Viewer/experiments/grayscale.jpg b/Viewer/experiments/grayscale.jpg new file mode 100644 index 0000000000000000000000000000000000000000..348f17a7eeca75e7571a127cd3a00ea19dc3ee37 GIT binary patch literal 1919 zcmex=+?Y3g}8rDsmsfc zeJfalqgN~Y=B?qr^!Fh%5HqYb{SmO``a_5Jm#0X`FV`@Tt%x&cYkgR8M~bJW&Vl{- z6K2Vm$4n&W%}I86v#X|BN!-6bMMP=(dv+jZEPa`88?#C*IpgitA9_x7Kphn z$G39()`{@_wRCL!Rn*LQz4dWHMx1!>!3D>UKVbkm#SrKO$C*I4@SR?Me3N3yk8h4n znspzFfLJ_k+UF(WOZU9s44SX;Dl7P@EYsbpO}&Sw$E{ghz_!^y?#zK7g`>eS8XTjk QV>GjjmK_uprT=dN0Gv@jO#lD@ literal 0 HcmV?d00001 diff --git a/Viewer/features/filesystem.js b/Viewer/features/filesystem.js index 683838f5..75567de5 100755 --- a/Viewer/features/filesystem.js +++ b/Viewer/features/filesystem.js @@ -2600,6 +2600,14 @@ var FileSystemWriterUIActions = actions.Actions({ target_dir: './select', clean_target_dir: true, }, + { + type: 'index', + size: '1000', + include_virtual: true, + target_dir: './select', + clean_target_dir: true, + comment: 'demo', + }, ], 'export-history': [ ], @@ -3002,38 +3010,91 @@ var FileSystemWriterUIActions = actions.Actions({ // XXX export using a preset... - // - display a list of presets accessible with 1-9 keys + title - // hotkeys... - // a-la collection list + location history... - // - edit, remove buttons - // - sortable - // - pinnable? - // ...thought of prioritizing based on path (relative vs. - // absolute) but this seems to be wrong... - // prioritizing based on title (optional) is logical - // on the other hand, but not sure if having a title here - // is a good idea in the first place -- overcomplicating things - // ...having a note/comment on the other hand is a good idea... - // - fixed number??? - // - select last used - // - use .exportDialog(..) as preset editor - // - add optional 'title' - // - "New/Custom..." button - // - single image mode: - // - disable index exporting for single images - // - add option to export only current image from any view... - // XXX need a means to save/manage/run presets... - exportPresets: ['- File/Export...', + // XXX should presets be available just in UI??? + // need to: + // - pass values to export dialog (load) + // - pass values to export action (use) + exportPresets: ['- File/', widgets.makeUIDialog(function(mode){ var that = this + + // presets... + // XXX better names... + var index = (that.config['export-presets'] || []) + .reduce(function(res, e, i){ + name = e.name + // XXX these should be type-specific... + || `${ e.type }: ${ e.target_dir }${ e.pattern ? ': "'+e.pattern+'"' : '' }` + res[name] = i + return res }, {}) + var presets = Object.keys(index) + + // history... + // XXX + var history = [] + return browse.makeLister(null, function(path, make){ + // presets... + presets.length == 0 ? + make.Empty() + : make.EditableList(presets, { + list_id: 'presets', + sortable: true, + new_item: false, + buttons: [ + // XXX new export... + ['N', function(){ + // XXX + }], + // XXX not sure about the default icon... + 'TO_TOP', + 'REMOVE', + ], + // XXX export... + open: function(evt, title){ + console.log('###', title + }, + // XXX handle rename -> update index... + // XXX + }) - make('Export...') + /*/ export dialog... + // XXX do we need this??? + make.Separator() + make('$Export...', { + open: function(){ + that.exportDialog() + //make.dialog.close() + }, + }) + //*/ - make('---') + // history... + make.Separator() + history.length == 0 ? + make.Empty() + : ake.EditableList(history, { + list_id: 'history', + sortable: false, + new_item: false, + editable_items: false, + buttons: [ + // to preset... + ['P', function(){ + // XXX + }], + 'REMOVE', + ], + // XXX export... + open: function(evt, title){ + console.log('###', title + }, + }) + }) + .close(function(){ - - make('---') + // XXX need to merge history/presets back when dialog closes... + // XXX }) })], diff --git a/Viewer/lib/widget/browse.js b/Viewer/lib/widget/browse.js index 8ed09ec6..d13e06f5 100755 --- a/Viewer/lib/widget/browse.js +++ b/Viewer/lib/widget/browse.js @@ -132,8 +132,7 @@ function(text, options){ var attrs = options.doc ? {doc: options.doc} : {} attrs.__proto__ = options.attrs || {} options.attrs = attrs - return this(text, options) -} + return this(text, options) } // Action... //