diff --git a/buildcache.py b/buildcache.py index a0e7ff99..8172e388 100755 --- a/buildcache.py +++ b/buildcache.py @@ -1,7 +1,7 @@ #======================================================================= __version__ = '''0.0.01''' -__sub_version__ = '''20130528215723''' +__sub_version__ = '''20130613200255''' __copyright__ = '''(c) Alex A. Naanou 2011''' @@ -40,7 +40,7 @@ CONFIG = { 'cache-image-name': '%(guid)s - %(name)s', # the rest of the paths will be relative to this... - 'cache-dir': '.ImageGridCache', + 'cache-dir': '.ImageGrid', 'images': 'images.json', 'data': 'data.json', diff --git a/ui/data.js b/ui/data.js index 98366d7b..4f198619 100755 --- a/ui/data.js +++ b/ui/data.js @@ -16,7 +16,8 @@ var LOAD_SCREENS = 6 var DEFAULT_SCREEN_IMAGES = 4 var MAX_SCREEN_IMAGES = 12 -var CACHE_DIR = '.ImageGridCache' +var CACHE_DIR = '.ImageGrid' +var CACHE_DIR_VAR = '${CACHE_DIR}' // A stub image, also here for documentation... var STUB_IMAGE_DATA = { @@ -434,6 +435,8 @@ function normalizePath(url, base, mode){ //mode = /^\./.test(base) && mode == null ? 'relative' : null mode = mode == null ? 'absolute' : mode + res = '' + // windows path... // - replace all '\\' with '/'... url = url.replace(/\\/g, '/') @@ -447,25 +450,33 @@ function normalizePath(url, base, mode){ // check if we start with base, and remove it if so... if(mode == 'relative' && url.substring(0, base.length) == base){ url = url.substring(base.length - 1) - return url[0] == '/' ? url.substring(1) : url + res = url[0] == '/' ? url.substring(1) : url // if it's a different path, return as-is } else if(mode == 'absolute'){ - return url + res = url } // make an absolute path... } else if(mode == 'absolute') { // if base ends and url starts with '.' avoid making it a '..' if(base[base.length-1] == '.' && url[0] == '.'){ - return base + url.substring(1) + res = base + url.substring(1) // avoid creating '//'... } else if(base[base.length-1] != '/' && url[0] != '/'){ - return base + '/' + url + res = base + '/' + url } else { - return base + url + res = base + url } } + + // get the actual path... + res = res.replace('${CACHE_DIR}', CACHE_DIR) + + // XXX legacy support... + res = res.replace('.ImageGridCache', CACHE_DIR) + + return res } diff --git a/ui/files.js b/ui/files.js index b71793de..19b4d102 100755 --- a/ui/files.js +++ b/ui/files.js @@ -245,7 +245,7 @@ function loadFileImages(path, no_load_diffs){ // default locations... if(path == null){ - var base = normalizePath(CACHE_DIR) + var base = normalizePath(CACHE_DIR_VAR) var loader = loadLatestFile(base, IMAGES_FILE_DEFAULT, IMAGES_FILE_PATTERN, @@ -253,7 +253,7 @@ function loadFileImages(path, no_load_diffs){ // explicit base dir... } else if(!/\.json$/i.test(path)) { - var base = normalizePath(path +'/'+ CACHE_DIR) + var base = normalizePath(path +'/'+ CACHE_DIR_VAR) var loader = loadLatestFile(base, IMAGES_FILE_DEFAULT, IMAGES_FILE_PATTERN, @@ -283,7 +283,7 @@ function loadFileImages(path, no_load_diffs){ // NOTE: this will uses CACHE_DIR as the location if no name is given. function saveFileImages(name){ var remove_diffs = (name == null) - name = name == null ? normalizePath(CACHE_DIR +'/'+ Date.timeStamp()) : name + name = name == null ? normalizePath(CACHE_DIR_VAR +'/'+ Date.timeStamp()) : name if(window.dumpJSON == null){ showErrorStatus('Can\'t save to file.') @@ -292,11 +292,11 @@ function saveFileImages(name){ // remove the diffs... if(remove_diffs){ - $.each($.map(listDir(normalizePath(CACHE_DIR)), function(e){ + $.each($.map(listDir(normalizePath(CACHE_DIR_VAR)), function(e){ return IMAGES_DIFF_FILE_PATTERN.test(e) ? e : null }), function(i, e){ showStatusQ('removeing:', e) - removeFile(normalizePath(CACHE_DIR +'/'+ e)) + removeFile(normalizePath(CACHE_DIR_VAR +'/'+ e)) }) IMAGES_UPDATED = [] } @@ -312,7 +312,7 @@ function loadFileMarks(path){ var res = $.Deferred() // default locations... if(path == null){ - var base = normalizePath(CACHE_DIR) + var base = normalizePath(CACHE_DIR_VAR) var loader = loadLatestFile(base, MARKED_FILE_DEFAULT, MARKED_FILE_PATTERN) @@ -322,7 +322,8 @@ function loadFileMarks(path){ } else { path = normalizePath(path) var base = path.split(CACHE_DIR)[0] - base += '/'+ CACHE_DIR + //base = normalizePath(path +'/'+ CACHE_DIR_VAR) + base = path +'/'+ CACHE_DIR // XXX is this correct??? var loader = loadLatestFile(base, @@ -342,7 +343,7 @@ function loadFileMarks(path){ // Save image marks to file function saveFileMarks(name){ - name = name == null ? normalizePath(CACHE_DIR +'/'+ Date.timeStamp()) : name + name = name == null ? normalizePath(CACHE_DIR_VAR +'/'+ Date.timeStamp()) : name dumpJSON(name + '-marked.json', MARKED) } @@ -424,7 +425,7 @@ function saveFileState(name, no_normalize_path){ name = name == null ? Date.timeStamp() : name if(!no_normalize_path){ - name = normalizePath(CACHE_DIR +'/'+ name) + name = normalizePath(CACHE_DIR_VAR +'/'+ name) // write .image_file only if saving data to a non-cache dir... // XXX check if this is correct... diff --git a/ui/layout.css b/ui/layout.css index e3037b88..b75f5c69 100644 --- a/ui/layout.css +++ b/ui/layout.css @@ -121,21 +121,30 @@ button:hover { width: 100%; height: 100%; } +.ribbon-set:empty:before, .ribbon-set:empty:after { display: block; position: absolute; - content: "No files loaded, press 'O' to load."; + content: "Nothing loaded..."; top: 50%; left: 0px; width: 100%; height: 20px; - margin-top: -10px; + margin-top: -20px; text-align: center; vertical-align: center; - font-size: 20px; + font-size: 18px; + font-weight: bold; color: silver; opacity: 0.9; } +.ribbon-set:empty:after { + content: "Press 'O' to load, 'F1' for help or '?' for keyboard mappings."; + margin-top: 5px; + font-weight: normal; + font-size: 16px; + opacity: 0.5; +} /********************************************************** Ribbon ***/ .ribbon { position: relative; @@ -862,6 +871,7 @@ button:hover { .light.viewer .overlay-block:hover .background:after { color: black; } +.light.viewer .ribbon-set:empty:before, .light.viewer .ribbon-set:empty:after { color: gray; } diff --git a/ui/layout.less b/ui/layout.less index 3cb8eba2..1d585499 100755 --- a/ui/layout.less +++ b/ui/layout.less @@ -197,24 +197,36 @@ button:hover { width: 100%; height: 100%; } +.ribbon-set:empty:before, .ribbon-set:empty:after { display: block; position: absolute; - content: "No files loaded, press 'O' to load."; + + content: "Nothing loaded..."; top: 50%; left: 0px; width: 100%; height: 20px; - margin-top: -10px; + margin-top: -20px; text-align: center; vertical-align: center; - font-size: 20px; + font-size: 18px; + font-weight: bold; color: silver; opacity: 0.9; } +.ribbon-set:empty:after { + + content: "Press 'O' to load, 'F1' for help or '?' for keyboard mappings."; + + margin-top: 5px; + font-weight: normal; + font-size: 16px; + opacity: 0.5; +} @@ -863,6 +875,7 @@ button:hover { .light.viewer .overlay-block:hover .background:after { color: black; } +.light.viewer .ribbon-set:empty:before, .light.viewer .ribbon-set:empty:after { color: gray; }