mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-02-22 01:42:47 +01:00
fix resource load
This commit is contained in:
parent
69849db99a
commit
f5ff434152
@ -102,32 +102,27 @@ self.OS.GUI =
|
|||||||
_GUI.launch app, args
|
_GUI.launch app, args
|
||||||
|
|
||||||
loadApp: (app, ok, err) ->
|
loadApp: (app, ok, err) ->
|
||||||
path = "packages/#{app}/"
|
path = "os:///packages/#{app}"
|
||||||
_API.script path + "main.js",
|
path = _OS.setting.system.packages[app].path if _OS.setting.system.packages[app].path
|
||||||
(d) ->
|
js = path + "/main.js"
|
||||||
|
js.asFileHandler().read (d) ->
|
||||||
#load css file
|
#load css file
|
||||||
_API.get "#{path}main.css",
|
css = "#{path}/main.css"
|
||||||
() ->
|
css.asFileHandler().onready (d) ->
|
||||||
$ '<link>', { rel: 'stylesheet', type: 'text/css', 'href': "#{path}main.css" }
|
$ '<link>', { rel: 'stylesheet', type: 'text/css', 'href': "#{_API.handler.get}/#{css}" }
|
||||||
.appendTo 'head'
|
.appendTo 'head'
|
||||||
, () ->
|
, () ->
|
||||||
#launch
|
#launch
|
||||||
if _OS.APP[app]
|
if _OS.APP[app]
|
||||||
# load app meta data
|
# load app meta data
|
||||||
_API.get "#{path}package.json",
|
"#{path}/package.json".asFileHandler().read (data) ->
|
||||||
(data) ->
|
data.path = path
|
||||||
_OS.APP[app].meta = data
|
_OS.APP[app].meta = data
|
||||||
ok app
|
ok app
|
||||||
, (e, s) ->
|
, "json"
|
||||||
_courrier.osfail "Cannot read application metadata: #{app}", e, s
|
|
||||||
err e, s
|
|
||||||
else
|
else
|
||||||
ok app
|
ok app
|
||||||
, (e, s) ->
|
, "script"
|
||||||
#BUG report here
|
|
||||||
_courrier.osfail "Cannot load application script: #{app}", e, s
|
|
||||||
console.log "bug report", e, s, path
|
|
||||||
err e,s
|
|
||||||
launch: (app, args) ->
|
launch: (app, args) ->
|
||||||
if not _OS.APP[app]
|
if not _OS.APP[app]
|
||||||
# first load it
|
# first load it
|
||||||
@ -147,7 +142,8 @@ self.OS.GUI =
|
|||||||
iconclass: meta.iconclass || ""
|
iconclass: meta.iconclass || ""
|
||||||
app: app
|
app: app
|
||||||
onbtclick: () -> app.toggle()
|
onbtclick: () -> app.toggle()
|
||||||
data.icon = "packages/#{meta.app}/#{meta.icon}" if meta.icon
|
# TODO: this path is not good, need to create a blob of it
|
||||||
|
data.icon = "#{_API.handler.get}/#{meta.path}/#{meta.icon}" if meta.icon
|
||||||
# TODO: add default app icon class in system setting
|
# TODO: add default app icon class in system setting
|
||||||
# so that it can be themed
|
# so that it can be themed
|
||||||
data.iconclass = "fa fa-cogs" if (not meta.icon) and (not meta.iconclass)
|
data.iconclass = "fa fa-cogs" if (not meta.icon) and (not meta.iconclass)
|
||||||
@ -369,9 +365,9 @@ self.OS.GUI =
|
|||||||
"CoreServices/Spotlight",
|
"CoreServices/Spotlight",
|
||||||
"CoreServices/Calendar"
|
"CoreServices/Calendar"
|
||||||
]
|
]
|
||||||
|
#_GUI.launch "DummyApp"
|
||||||
|
|
||||||
# startup application here
|
# startup application here
|
||||||
_courrier.observable.one "desktoploaded", () ->
|
_courrier.observable.one "desktoploaded", () ->
|
||||||
console.log "startup app"
|
#_GUI.launch "DummyApp"
|
||||||
_GUI.launch "DummyApp"
|
|
||||||
#_GUI.launch "NotePad"
|
#_GUI.launch "NotePad"
|
@ -1,4 +1,6 @@
|
|||||||
self.OS.API.handler =
|
self.OS.API.handler =
|
||||||
|
get: "lua-api/fs/get"
|
||||||
|
|
||||||
scandir: (p, c ) ->
|
scandir: (p, c ) ->
|
||||||
path = "lua-api/fs/scandir"
|
path = "lua-api/fs/scandir"
|
||||||
_API.post path, { path: p }, c, (e, s) ->
|
_API.post path, { path: p }, c, (e, s) ->
|
||||||
@ -13,11 +15,11 @@ self.OS.API.handler =
|
|||||||
_API.post path, { path: p }, c, (e, s) ->
|
_API.post path, { path: p }, c, (e, s) ->
|
||||||
_courrier.osfail "Fail to get file metadata: #{p}", e, s
|
_courrier.osfail "Fail to get file metadata: #{p}", e, s
|
||||||
|
|
||||||
readfile: (p, c) ->
|
readfile: (p, c, t) ->
|
||||||
path = "lua-api/fs/get/"
|
path = "lua-api/fs/get/"
|
||||||
_API.get path + p, c, (e, s) ->
|
_API.get path + p, c, (e, s) ->
|
||||||
_courrier.osfail "Fail to read file: #{p}", e, s
|
_courrier.osfail "Fail to read file: #{p}", e, s
|
||||||
, "text"
|
, t
|
||||||
|
|
||||||
move: (s, d, c) ->
|
move: (s, d, c) ->
|
||||||
path = "lua-api/fs/move"
|
path = "lua-api/fs/move"
|
||||||
|
@ -68,9 +68,9 @@ class BasicFileHandler
|
|||||||
me.ready = true
|
me.ready = true
|
||||||
f()
|
f()
|
||||||
|
|
||||||
read: (f) ->
|
read: (f, t) ->
|
||||||
me = @
|
me = @
|
||||||
@onready (() -> me.action "read", null, f)
|
@onready (() -> me.action "read", t, f)
|
||||||
|
|
||||||
write: (d, f) ->
|
write: (d, f) ->
|
||||||
me = @
|
me = @
|
||||||
@ -136,7 +136,7 @@ class RemoteFileHandler extends self.OS.API.VFS.BasicFileHandler
|
|||||||
when "read"
|
when "read"
|
||||||
return _API.handler.scandir @path, f if @info.type is "dir"
|
return _API.handler.scandir @path, f if @info.type is "dir"
|
||||||
#read the file
|
#read the file
|
||||||
_API.handler.readfile @path, f
|
_API.handler.readfile @path, f, if p then p else "text"
|
||||||
when "mk"
|
when "mk"
|
||||||
return f { error: "#{@path} is not a directory" } if @info.type is "file"
|
return f { error: "#{@path} is not a directory" } if @info.type is "file"
|
||||||
_API.handler.mkdir "#{@path}/#{p}", f
|
_API.handler.mkdir "#{@path}/#{p}", f
|
||||||
|
@ -4,7 +4,7 @@ jsfiles =
|
|||||||
|
|
||||||
cssfiles = main.css
|
cssfiles = main.css
|
||||||
|
|
||||||
copyfiles = scheme.html package.json
|
copyfiles = scheme.html package.json icon.png
|
||||||
|
|
||||||
|
|
||||||
PKG_NAME=DummyApp
|
PKG_NAME=DummyApp
|
||||||
|
BIN
src/packages/DummyApp/icon.png
Normal file
BIN
src/packages/DummyApp/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,7 @@
|
|||||||
|
.dummyapp-icon {
|
||||||
|
background-image: url("icon.png");
|
||||||
|
background-color: blueviolet;
|
||||||
|
display: block;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user