mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-26 13:01:58 +00:00
some work on path handling in Walk(..), still not done...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
df145fd5e1
commit
b82a168292
@ -197,8 +197,11 @@ var listDir = module.listDir = listDirfs
|
|||||||
|
|
||||||
// XXX for some reason pop does not focus the container dir correctly...
|
// XXX for some reason pop does not focus the container dir correctly...
|
||||||
// ...this is potentially due to the list not being ready yet...
|
// ...this is potentially due to the list not being ready yet...
|
||||||
|
// XXX this should be smarter and support other URL schemes...
|
||||||
var WalkPrototype = Object.create(browse.Browser.prototype)
|
var WalkPrototype = Object.create(browse.Browser.prototype)
|
||||||
WalkPrototype.options = {
|
WalkPrototype.options = {
|
||||||
|
// XXX this should be smarter and support other URL schemes...
|
||||||
|
pathPrefix: os.type() == 'Windows_NT' ? '' : '/',
|
||||||
|
|
||||||
fullPathEdit: true,
|
fullPathEdit: true,
|
||||||
traversable: true,
|
traversable: true,
|
||||||
@ -221,7 +224,6 @@ object.makeConstructor('Walk',
|
|||||||
|
|
||||||
var makeWalk =
|
var makeWalk =
|
||||||
module.makeWalk = function(elem, path, showNonTraversable, showDisabled){
|
module.makeWalk = function(elem, path, showNonTraversable, showDisabled){
|
||||||
//return Walk(elem, { path: path })
|
|
||||||
var w = Walk(elem, {
|
var w = Walk(elem, {
|
||||||
path: path,
|
path: path,
|
||||||
showNonTraversable: showNonTraversable == null ?
|
showNonTraversable: showNonTraversable == null ?
|
||||||
|
|||||||
@ -162,6 +162,10 @@ var BrowserPrototype = {
|
|||||||
|
|
||||||
//show_path: true,
|
//show_path: true,
|
||||||
|
|
||||||
|
// XXX at this time this is used only for generating paths, need
|
||||||
|
// to also use this for parsing...
|
||||||
|
pathPrefix: '/',
|
||||||
|
|
||||||
// Enable/disable user selection filtering...
|
// Enable/disable user selection filtering...
|
||||||
// NOTE: this only affects starting the filter...
|
// NOTE: this only affects starting the filter...
|
||||||
filter: true,
|
filter: true,
|
||||||
@ -423,7 +427,7 @@ var BrowserPrototype = {
|
|||||||
//
|
//
|
||||||
// XXX need to append '/' only if traversable...
|
// XXX need to append '/' only if traversable...
|
||||||
get strPath(){
|
get strPath(){
|
||||||
return '/' + this.path.join('/') + '/'
|
return this.options.pathPrefix + this.path.join('/') + '/'
|
||||||
},
|
},
|
||||||
set strPath(value){
|
set strPath(value){
|
||||||
this.path = value
|
this.path = value
|
||||||
@ -1650,7 +1654,8 @@ var BrowserPrototype = {
|
|||||||
res = res || this
|
res = res || this
|
||||||
|
|
||||||
// XXX do we strigify the path???
|
// XXX do we strigify the path???
|
||||||
path = '/' + path.join('/')
|
// XXX should we use .strPath here???
|
||||||
|
path = this.options.pathPrefix + path.join('/')
|
||||||
|
|
||||||
// trigger the 'open' events...
|
// trigger the 'open' events...
|
||||||
if(elem.length > 0){
|
if(elem.length > 0){
|
||||||
@ -2019,7 +2024,7 @@ PathListPrototype.options = {
|
|||||||
|
|
||||||
// use the custom lister (defined by trailing '*')...
|
// use the custom lister (defined by trailing '*')...
|
||||||
if(data !== keys && lister){
|
if(data !== keys && lister){
|
||||||
return data[lister].call(this, '/' + path.join('/'), make)
|
return data[lister].call(this, this.options.pathPrefix + path.join('/'), make)
|
||||||
|
|
||||||
// list via provided paths...
|
// list via provided paths...
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -236,7 +236,7 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
alt: 'browseActions: "/Bookmark/"',
|
alt: 'browseActions: "/Bookmark/"',
|
||||||
},
|
},
|
||||||
C: 'browseActions: "/Crop/"',
|
C: 'browseActions: "/Crop/"',
|
||||||
O: 'pathBrowse',
|
O: 'browsePath',
|
||||||
|
|
||||||
// XXX for debug...
|
// XXX for debug...
|
||||||
G: function(){ $('.viewer').toggleClass('visible-gid') },
|
G: function(){ $('.viewer').toggleClass('visible-gid') },
|
||||||
|
|||||||
@ -2718,46 +2718,6 @@ var ActionTreeActions = actions.Actions({
|
|||||||
&& parent.focus()
|
&& parent.focus()
|
||||||
})
|
})
|
||||||
}],
|
}],
|
||||||
// XXX make this nw only...
|
|
||||||
// XXX BUG: for some reason this when run from .browseActions(..) loads
|
|
||||||
// incorrectly while when called directly is OK...
|
|
||||||
pathBrowse: ['Interface|Test/Path lister test (floating)...',
|
|
||||||
function(base, callback){
|
|
||||||
var that = this
|
|
||||||
var parent = this.preventClosing ? this.preventClosing() : null
|
|
||||||
base = base || '/'
|
|
||||||
|
|
||||||
var o = overlay.Overlay(this.ribbons.viewer,
|
|
||||||
require('./lib/widget/browse-walk').makeWalk(null, base, false, false)
|
|
||||||
.open(function(evt, path){
|
|
||||||
|
|
||||||
o.close()
|
|
||||||
|
|
||||||
// close the parent ui...
|
|
||||||
parent
|
|
||||||
&& parent.close
|
|
||||||
&& parent.close()
|
|
||||||
|
|
||||||
|
|
||||||
// XXX need to strip the leading '/' in a more cross-platform way...
|
|
||||||
path = path.strip(1)
|
|
||||||
|
|
||||||
// XXX use logger...
|
|
||||||
console.log('PATH:', path)
|
|
||||||
|
|
||||||
if(callback){
|
|
||||||
callback(path)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
that.loadPath && that.loadPath(path)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
.close(function(){
|
|
||||||
parent
|
|
||||||
&& parent.focus
|
|
||||||
&& parent.focus()
|
|
||||||
})
|
|
||||||
}],
|
|
||||||
// XXX use this.ribbons.viewer as base...
|
// XXX use this.ribbons.viewer as base...
|
||||||
drawerTest: ['Interface|Test/Drawer widget test',
|
drawerTest: ['Interface|Test/Drawer widget test',
|
||||||
function(){
|
function(){
|
||||||
@ -3323,6 +3283,48 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
that.load(index)
|
that.load(index)
|
||||||
})
|
})
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
// XXX move this to the UI version of this feature...
|
||||||
|
// ...and make the UI version of .loadPath(..) run this if no
|
||||||
|
// path was given...
|
||||||
|
// XXX STUB: this dances around an issue in the browser -- removing
|
||||||
|
// the leading '/' on windows...
|
||||||
|
// ...fix in Browse(..) / Walk(..)
|
||||||
|
// XXX BUG: for some reason this when run from .browseActions(..) loads
|
||||||
|
// incorrectly while when called directly is OK...
|
||||||
|
browsePath: ['File/Browse file system...',
|
||||||
|
function(base, callback){
|
||||||
|
var that = this
|
||||||
|
var parent = this.preventClosing ? this.preventClosing() : null
|
||||||
|
base = base || '/'
|
||||||
|
|
||||||
|
var o = overlay.Overlay(this.ribbons.viewer,
|
||||||
|
require('./lib/widget/browse-walk').makeWalk(null, base, false, false)
|
||||||
|
// path selected...
|
||||||
|
.open(function(evt, path){
|
||||||
|
// close self and parent...
|
||||||
|
o.close()
|
||||||
|
parent
|
||||||
|
&& parent.close
|
||||||
|
&& parent.close()
|
||||||
|
|
||||||
|
console.log('PATH:', path)
|
||||||
|
|
||||||
|
// pass the selected path on...
|
||||||
|
if(callback){
|
||||||
|
callback(path)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
that.loadPath(path)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
// we closed the browser...
|
||||||
|
.close(function(){
|
||||||
|
parent
|
||||||
|
&& parent.focus
|
||||||
|
&& parent.focus()
|
||||||
|
})
|
||||||
|
}],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user