added spinners to save history and sub-index list + some tweaking and fxes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-04 21:28:46 +03:00
parent 639d3c9edc
commit dc93052a93
4 changed files with 121 additions and 79 deletions

View File

@ -549,20 +549,69 @@ var FileSystemLoaderUIActions = actions.Actions({
browseIndex: ['File/Load index...', makeBrowseProxy('loadIndex')],
browseImages: ['File/Load images...', makeBrowseProxy('loadImages')],
// XXX add dialog to list sub-indexes...
// XXX
browseSubIndexes: ['File/List sub-indexes...',
widgets.makeUIDialog(function(){
var that = this
var index_dir = this.config['index-dir']
var o = browse.makeLister(null, function(path, make){
var dialog = this
var path = that.location.path
if(that.location.method != 'loadIndex'){
make('No indexes loaded...', null, true)
return
}
// indicate that we are working...
var spinner = make($('<center><div class="loader"/></center>'))
// XXX we do not need to actually read anything....
//file.loadIndex(path, that.config['index-dir'], this.logger)
// XXX we need to prune the indexes -- avoid loading nested indexes...
file.listIndexes(path, index_dir)
.on('end', function(res){
// we got the data, we can now remove the spinner...
spinner.remove()
res.forEach(function(p){
// trim local paths and keep external paths as-is...
p = p.split(index_dir)[0]
var txt = p.split(path).pop()
txt = txt != p ? './'+pathlib.join('.', txt) : txt
make(txt)
.on('open', function(){
that.loadIndex(p)
})
})
})
})
.on('open', function(){
o.parent.close()
})
return o
})],
// NOTE: for multiple indexes this will show the combined history
// and selecting a postion will load all the participating
// indexes to that date.
// NOTE: this will show nothing if .location.method is not loadIndex..
//
// XXX should this affect .changes ???
// XXX handle named saves...
// XXX add ability to name a save...
// XXX need to handle saves when loaded a specific history position...
// XXX need to handle saves (saveIndex(..) and friends) when loaded
// a specific history position...
// ...in theory saving and old index will create an incremental
// save which should not damage the history and can be fixed
// either by removing the actual .json files or simply loading
// from a previous position and re-saving... (XXX test)
// XXX should this also list journal stuff or have the ability for
// extending???
listSaveHistoryDialog: ['File/History...',
listSaveHistory: ['File/History...',
widgets.makeUIDialog(function(){
var that = this
@ -585,6 +634,9 @@ var FileSystemLoaderUIActions = actions.Actions({
make('---')
// indicate that we are working...
var spinner = make($('<center><div class="loader"/></center>'))
that.loadSaveHistoryList()
.catch(function(err){
// XXX
@ -593,6 +645,9 @@ var FileSystemLoaderUIActions = actions.Actions({
.then(function(data){
var list = []
// got the data, remove the spinner...
spinner.remove()
Object.keys(data).forEach(function(path){
Object.keys(data[path]).forEach(function(d){
list.push(d)
@ -618,8 +673,9 @@ var FileSystemLoaderUIActions = actions.Actions({
// NOTE: here we will select 'Latest' if nothing
// was selected...
o.select()
dialog.select()
.addClass('highlighted')
})
})
.on('open', function(){

View File

@ -140,7 +140,7 @@ module.GLOBAL_KEYBOARD = {
H: {
default: 'flipHorizontal',
ctrl: 'listURLHistory',
'ctrl+shift': 'listSaveHistoryDialog',
'ctrl+shift': 'listSaveHistory',
alt: 'browseActions: "/History/" -- Open history menu',
},
V: 'flipVertical',

View File

@ -25,6 +25,7 @@ var keyboard = require('lib/keyboard')
var actions = require('lib/actions')
var core = require('features/core')
var base = require('features/base')
var widgets = require('features/ui-widgets')
var browse = require('lib/widget/browse')
var overlay = require('lib/widget/overlay')
@ -327,7 +328,8 @@ var MetadataUIActions = actions.Actions({
// XXX should we replace 'mode' with nested set of metadata???
// XXX make this support multiple images...
showMetadata: ['Image/Show metadata',
function(image, mode){
widgets.makeUIDialog(function(image, mode){
//function(image, mode){
var that = this
image = this.data.getImage(image)
mode = mode || 'disabled'
@ -445,8 +447,7 @@ var MetadataUIActions = actions.Actions({
}
// XXX might be a good idea to directly bind ctrl-c to copy value...
var o = overlay.Overlay(this.ribbons.viewer,
browse.makeList(
var o = browse.makeList(
null,
_buildInfoList(image, metadata),
{
@ -468,7 +469,7 @@ var MetadataUIActions = actions.Actions({
.map(function(f){ return util.quoteRegExp(f) })
.join('|'))
var elem = o.client.filter(path).find('.text').last()
var elem = o.filter(path).find('.text').last()
// handle select...
if(that.config['metadata-auto-select-mode'] == 'on open'){
@ -497,13 +498,14 @@ var MetadataUIActions = actions.Actions({
}
})
}
}))
.close(function(){
})
.on('close', function(){
// XXX
})
o.client.dom.addClass('metadata-view')
o.client.updateMetadata = function(metadata){
o.dom.addClass('metadata-view')
o.updateMetadata = function(metadata){
metadata = metadata || that.getMetadata()
// build new data set and update view...
@ -514,7 +516,7 @@ var MetadataUIActions = actions.Actions({
}
return o
}]
})]
})
var MetadataUI =
@ -556,14 +558,12 @@ module.MetadataFSUI = core.ImageGridFeatures.Feature({
var that = this
var reader = this.readMetadata(image)
return reader && function(overlay){
var client = overlay.client
return reader && function(client){
var data = client.options.data
// add a loading indicator...
// NOTE: this will get removed when calling .updateMetadata()
// NOTE: this will get overwritten when calling .updateMetadata()
data.push('---')
//data.push($('<center>Loading...</center>'))
data.push($('<center><div class="loader"/></center>'))
client.update()

View File

@ -551,23 +551,9 @@ var BrowserPrototype = {
var skip = false
return this.dom.find('.path .dir:not(.cur)')
.map(function(i, e){ return $(e).text() })
.toArray()
},
.toArray() },
set path(value){
this.update(value)
/*
// XXX check if path has changed...
value = this.path2list(value)
var cur = this.path
// update only if path is different...
value.length == cur.length
&& cur
.filter(function(e, i){ return e == value[i] }).length != cur.length
&& this.update(value)
*/
},
this.update(value) },
// String path...
//
@ -960,7 +946,7 @@ var BrowserPrototype = {
.click(function(){
if(!$(this).hasClass('disabled')){
//that.push(quoteWS($(this).find('.text').text()))
that.push($(this).find('.text').text())
that.push('"'+ $(this).find('.text').text() +'"')
}
})
// append text elements...