mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-26 21:11:57 +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...
|
||||
// ...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)
|
||||
WalkPrototype.options = {
|
||||
// XXX this should be smarter and support other URL schemes...
|
||||
pathPrefix: os.type() == 'Windows_NT' ? '' : '/',
|
||||
|
||||
fullPathEdit: true,
|
||||
traversable: true,
|
||||
@ -221,7 +224,6 @@ object.makeConstructor('Walk',
|
||||
|
||||
var makeWalk =
|
||||
module.makeWalk = function(elem, path, showNonTraversable, showDisabled){
|
||||
//return Walk(elem, { path: path })
|
||||
var w = Walk(elem, {
|
||||
path: path,
|
||||
showNonTraversable: showNonTraversable == null ?
|
||||
|
||||
@ -161,6 +161,10 @@ var BrowserPrototype = {
|
||||
//path: null,
|
||||
|
||||
//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...
|
||||
// NOTE: this only affects starting the filter...
|
||||
@ -423,7 +427,7 @@ var BrowserPrototype = {
|
||||
//
|
||||
// XXX need to append '/' only if traversable...
|
||||
get strPath(){
|
||||
return '/' + this.path.join('/') + '/'
|
||||
return this.options.pathPrefix + this.path.join('/') + '/'
|
||||
},
|
||||
set strPath(value){
|
||||
this.path = value
|
||||
@ -1650,7 +1654,8 @@ var BrowserPrototype = {
|
||||
res = res || this
|
||||
|
||||
// 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...
|
||||
if(elem.length > 0){
|
||||
@ -2019,7 +2024,7 @@ PathListPrototype.options = {
|
||||
|
||||
// use the custom lister (defined by trailing '*')...
|
||||
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...
|
||||
} else {
|
||||
|
||||
@ -236,7 +236,7 @@ module.GLOBAL_KEYBOARD = {
|
||||
alt: 'browseActions: "/Bookmark/"',
|
||||
},
|
||||
C: 'browseActions: "/Crop/"',
|
||||
O: 'pathBrowse',
|
||||
O: 'browsePath',
|
||||
|
||||
// XXX for debug...
|
||||
G: function(){ $('.viewer').toggleClass('visible-gid') },
|
||||
|
||||
@ -2718,46 +2718,6 @@ var ActionTreeActions = actions.Actions({
|
||||
&& 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...
|
||||
drawerTest: ['Interface|Test/Drawer widget test',
|
||||
function(){
|
||||
@ -3323,6 +3283,48 @@ var FileSystemLoaderActions = actions.Actions({
|
||||
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