mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-02-22 01:42:47 +01:00
fix scheme load bug
This commit is contained in:
parent
857b2167c5
commit
988993483f
@ -25,13 +25,14 @@ class BaseApplication extends this.OS.GUI.BaseModel
|
|||||||
CTRL: {}
|
CTRL: {}
|
||||||
SHIFT: {}
|
SHIFT: {}
|
||||||
META: {}
|
META: {}
|
||||||
init: ->
|
|
||||||
me = @
|
|
||||||
# first register some base event to the app
|
|
||||||
@subscribe "appregistry"
|
@subscribe "appregistry"
|
||||||
, ( m ) ->
|
, ( m ) ->
|
||||||
me.applySetting m.data.m if (m.name is me.name)
|
me.applySetting m.data.m if (m.name is me.name)
|
||||||
|
init: ->
|
||||||
|
me = @
|
||||||
|
@off "*"
|
||||||
|
@on "exit", () -> me.quit()
|
||||||
|
# first register some base event to the app
|
||||||
@on "focus", () ->
|
@on "focus", () ->
|
||||||
me.sysdock.set "selectedApp", me
|
me.sysdock.set "selectedApp", me
|
||||||
me.appmenu.pid = me.pid
|
me.appmenu.pid = me.pid
|
||||||
@ -48,6 +49,7 @@ class BaseApplication extends this.OS.GUI.BaseModel
|
|||||||
when "#{me.name}-about" then me.openDialog "AboutDialog", ()->
|
when "#{me.name}-about" then me.openDialog "AboutDialog", ()->
|
||||||
when "#{me.name}-exit" then me.trigger "exit"
|
when "#{me.name}-exit" then me.trigger "exit"
|
||||||
@loadScheme()
|
@loadScheme()
|
||||||
|
|
||||||
loadScheme: () ->
|
loadScheme: () ->
|
||||||
#now load the scheme
|
#now load the scheme
|
||||||
path = "#{@meta().path}/scheme.html"
|
path = "#{@meta().path}/scheme.html"
|
||||||
|
@ -52,7 +52,9 @@ class BaseModel
|
|||||||
|
|
||||||
one: (e, f) -> @observable.one e, f
|
one: (e, f) -> @observable.one e, f
|
||||||
on: (e, f) -> @observable.on e, f
|
on: (e, f) -> @observable.on e, f
|
||||||
|
off: (e, f) ->
|
||||||
|
return @observable.off e unless f
|
||||||
|
@observable.off e, f
|
||||||
trigger: (e, d) -> @observable.trigger e, d
|
trigger: (e, d) -> @observable.trigger e, d
|
||||||
|
|
||||||
subscribe: (e, f) ->
|
subscribe: (e, f) ->
|
||||||
|
@ -37,6 +37,7 @@ self.OS.GUI =
|
|||||||
]
|
]
|
||||||
htmlToScheme: (html, app, parent) ->
|
htmlToScheme: (html, app, parent) ->
|
||||||
scheme = $.parseHTML html
|
scheme = $.parseHTML html
|
||||||
|
|
||||||
$(app.scheme).remove() if app.scheme
|
$(app.scheme).remove() if app.scheme
|
||||||
($ parent).append scheme
|
($ parent).append scheme
|
||||||
riot.mount ($ scheme), { observable: app.observable }
|
riot.mount ($ scheme), { observable: app.observable }
|
||||||
@ -186,11 +187,11 @@ self.OS.GUI =
|
|||||||
# 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)
|
||||||
dock = $ "#sysdock"
|
dock = $ "#sysdock"
|
||||||
|
app.init()
|
||||||
app.one "rendered", () ->
|
app.one "rendered", () ->
|
||||||
dock.get(0).newapp data
|
dock.get(0).newapp data
|
||||||
app.sysdock = dock.get(0)
|
app.sysdock = dock.get(0)
|
||||||
app.appmenu = ($ "[data-id = 'appmenu']", "#syspanel")[0]
|
app.appmenu = ($ "[data-id = 'appmenu']", "#syspanel")[0]
|
||||||
app.init()
|
|
||||||
|
|
||||||
toggleFullscreen: () ->
|
toggleFullscreen: () ->
|
||||||
el = ($ "body")[0]
|
el = ($ "body")[0]
|
||||||
|
@ -31,7 +31,7 @@ class AntOSDK extends this.OS.GUI.BaseApplication
|
|||||||
(@find "btnnewprj").set "onbtclick", () ->
|
(@find "btnnewprj").set "onbtclick", () ->
|
||||||
me.newProject (path) ->
|
me.newProject (path) ->
|
||||||
me.prjfile = "#{path}/project.apj".asFileHandler()
|
me.prjfile = "#{path}/project.apj".asFileHandler()
|
||||||
me.loadScheme()
|
me.init()
|
||||||
(@find "btnopenprj").set "onbtclick", () ->
|
(@find "btnopenprj").set "onbtclick", () ->
|
||||||
me.actionProject "#{me.name}-Open"
|
me.actionProject "#{me.name}-Open"
|
||||||
return
|
return
|
||||||
@ -208,7 +208,32 @@ class AntOSDK extends this.OS.GUI.BaseApplication
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "#{rpath}/README.md",
|
path: "#{rpath}/README.md",
|
||||||
content: "##{n}"
|
content: """
|
||||||
|
# #{n}
|
||||||
|
This is an example project, generated by AntOS Development Kit
|
||||||
|
|
||||||
|
## Howto
|
||||||
|
|
||||||
|
1. Open the project.apj file with AntOSDK (simply double Click on it)
|
||||||
|
2. Modify the UI in *assets/scheme.html*
|
||||||
|
3. Modify application code in *coffees/main.coffee*
|
||||||
|
4. Modify CSS style in *css/main.css*
|
||||||
|
5. Other files need to be copied: put in to assets
|
||||||
|
|
||||||
|
## Set up build target
|
||||||
|
|
||||||
|
Click **Menu> Build > Build Option** or simply hit **ALT-Y**
|
||||||
|
|
||||||
|
In the build options dialog, add or remove files that need to be
|
||||||
|
included into the build
|
||||||
|
|
||||||
|
Click **Save**
|
||||||
|
|
||||||
|
## Build application
|
||||||
|
* To build: **Menu > Build > Build** or **ALT-C**
|
||||||
|
* To build and run: **Menu > Build > Build and Run** or **CTRL-R**
|
||||||
|
* To release: **Menu > Build > Build release** or **ALT-P**
|
||||||
|
"""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "#{rpath}/project.apj",
|
path: "#{rpath}/project.apj",
|
||||||
@ -264,7 +289,7 @@ class AntOSDK extends this.OS.GUI.BaseApplication
|
|||||||
me.log "INFO", __("Opening {0}", me.prjfile.path)
|
me.log "INFO", __("Opening {0}", me.prjfile.path)
|
||||||
me.tabarea.set "selected", -1
|
me.tabarea.set "selected", -1
|
||||||
me.tabarea.set "items", []
|
me.tabarea.set "items", []
|
||||||
me.currfile = "#{d.root}/coffees/main.coffee".asFileHandler()
|
me.currfile = "#{d.root}/README.md".asFileHandler()
|
||||||
me.currfile.dirty = false
|
me.currfile.dirty = false
|
||||||
me.chdir d.root if d.root
|
me.chdir d.root if d.root
|
||||||
me.prjfile.cache = d
|
me.prjfile.cache = d
|
||||||
@ -272,7 +297,7 @@ class AntOSDK extends this.OS.GUI.BaseApplication
|
|||||||
me.open me.currfile
|
me.open me.currfile
|
||||||
,"json"
|
,"json"
|
||||||
else
|
else
|
||||||
me.loadScheme()
|
me.init()
|
||||||
|
|
||||||
open: (file) ->
|
open: (file) ->
|
||||||
#find table
|
#find table
|
||||||
|
@ -16,6 +16,7 @@ afx-app-window[data-id="antOSDK"] afx-resizer[data-id="botrz"]
|
|||||||
z-index: 9;
|
z-index: 9;
|
||||||
border-top: 1px solid #a6a6a6;
|
border-top: 1px solid #a6a6a6;
|
||||||
background-color: #2f3129;
|
background-color: #2f3129;
|
||||||
|
border-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
afx-app-window[data-id="antOSDK"] div.welcome-cnt {
|
afx-app-window[data-id="antOSDK"] div.welcome-cnt {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<afx-vbox>
|
<afx-vbox>
|
||||||
<afx-hbox >
|
<afx-hbox >
|
||||||
<div class = "welcome-cnt">
|
<div class = "welcome-cnt">
|
||||||
<afx-label text="__(Wecome to AntOSDK)" class="wmsg"></afx-label>
|
<afx-label text="__(Welcome to AntOSDK)" class="wmsg"></afx-label>
|
||||||
<p>
|
<p>
|
||||||
<afx-button data-id="btnnewprj" iconclass= "fa fa-plus-circle" text = "__(New project)"></afx-button>
|
<afx-button data-id="btnnewprj" iconclass= "fa fa-plus-circle" text = "__(New project)"></afx-button>
|
||||||
<afx-button data-id="btnopenprj" iconclass = "fa fa-folder-open" text = "__(Open project)"></afx-button>
|
<afx-button data-id="btnopenprj" iconclass = "fa fa-folder-open" text = "__(Open project)"></afx-button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user