mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-11-19 10:58:20 +01:00
global settting
This commit is contained in:
parent
338dca02b9
commit
46e50b191f
13
Makefile
13
Makefile
@ -19,13 +19,12 @@ coffees= src/core/core.coffee\
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
packages = NotePad wTerm ActivityMonitor DummyApp Files
|
packages = CoreServices NotePad wTerm ActivityMonitor DummyApp Files
|
||||||
services = PushNotification Spotlight Calendar
|
|
||||||
|
|
||||||
main: build_coffees build_tags build_themes schemes libs build_services build_packages
|
main: build_coffees build_tags build_themes schemes libs build_packages
|
||||||
- cp src/index.html $(BUILDDIR)/
|
- cp src/index.html $(BUILDDIR)/
|
||||||
|
|
||||||
lite: build_coffee build_tag build_theme schemes build_services build_packages
|
lite: build_coffee build_tag build_theme schemes build_packages
|
||||||
#%.js: %.coffee
|
#%.js: %.coffee
|
||||||
# coffee --compile $<
|
# coffee --compile $<
|
||||||
|
|
||||||
@ -33,6 +32,7 @@ build_coffees:
|
|||||||
@echo "$(BLUE)Building coffee files$(NC)"
|
@echo "$(BLUE)Building coffee files$(NC)"
|
||||||
- mkdir $(BUILDDIR)/scripts
|
- mkdir $(BUILDDIR)/scripts
|
||||||
- rm $(BUILDDIR)/scripts/antos.js
|
- rm $(BUILDDIR)/scripts/antos.js
|
||||||
|
- rm $(BUILDDIR)/scripts/antos.coffee
|
||||||
for f in $(coffees); do (cat "$${f}"; echo) >> $(BUILDDIR)/scripts/antos.coffee; done
|
for f in $(coffees); do (cat "$${f}"; echo) >> $(BUILDDIR)/scripts/antos.coffee; done
|
||||||
coffee --compile $(BUILDDIR)/scripts/antos.coffee
|
coffee --compile $(BUILDDIR)/scripts/antos.coffee
|
||||||
- rm $(BUILDDIR)/scripts/antos.coffee
|
- rm $(BUILDDIR)/scripts/antos.coffee
|
||||||
@ -70,11 +70,6 @@ antos_themes_build:
|
|||||||
cp src/themes/antos/wp.png $(BUILDDIR)/resources/themes/antos/
|
cp src/themes/antos/wp.png $(BUILDDIR)/resources/themes/antos/
|
||||||
|
|
||||||
|
|
||||||
build_services:
|
|
||||||
@echo "$(BLUE)Building services$(NC)"
|
|
||||||
-mkdir -p $(BUILDDIR)/services
|
|
||||||
-rm -rf $(BUILDDIR)/services/*
|
|
||||||
for f in $(services); do (coffee -cs < "src/services/$$f.coffee" >$(BUILDDIR)/services/"$$f.js");done
|
|
||||||
build_packages:
|
build_packages:
|
||||||
- mkdir $(BUILDDIR)/packages
|
- mkdir $(BUILDDIR)/packages
|
||||||
- for d in $(packages); do ( test -d $(BUILDDIR)/packages/$$d && rm -rf $(BUILDDIR)/packages/$$d/* ); done
|
- for d in $(packages); do ( test -d $(BUILDDIR)/packages/$$d && rm -rf $(BUILDDIR)/packages/$$d/* ); done
|
||||||
|
@ -8,6 +8,13 @@ class BaseModel
|
|||||||
_OS.setting.applications[@name] = {} if not _OS.setting.applications[@name]
|
_OS.setting.applications[@name] = {} if not _OS.setting.applications[@name]
|
||||||
@setting = _OS.setting.applications[@name]
|
@setting = _OS.setting.applications[@name]
|
||||||
@dialog = undefined
|
@dialog = undefined
|
||||||
|
@subscribe "appregistry"
|
||||||
|
,(m)->
|
||||||
|
me.applySetting m.data.m if (m.name is me.name)
|
||||||
|
|
||||||
|
registry: (k,v) ->
|
||||||
|
@setting[k] = v
|
||||||
|
@publish "appregistry",k
|
||||||
|
|
||||||
render: (p) ->
|
render: (p) ->
|
||||||
_GUI.loadScheme p, @, @host
|
_GUI.loadScheme p, @, @host
|
||||||
@ -24,12 +31,14 @@ class BaseModel
|
|||||||
#implement by sub class
|
#implement by sub class
|
||||||
onexit: (e) ->
|
onexit: (e) ->
|
||||||
#implement by subclass
|
#implement by subclass
|
||||||
|
applySetting: (k) ->
|
||||||
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
|
||||||
|
|
||||||
trigger: (e, d) -> @observable.trigger e, d
|
trigger: (e, d) -> @observable.trigger e, d
|
||||||
|
|
||||||
subscribe: (e, f) -> _courrier.on e, f, @
|
subscribe: (e, f) ->
|
||||||
|
_courrier.on e, f, @
|
||||||
|
|
||||||
openDialog: (d, f, data) ->
|
openDialog: (d, f, data) ->
|
||||||
if @dialog
|
if @dialog
|
||||||
|
@ -36,13 +36,15 @@ self.OS.GUI =
|
|||||||
srvs.splice 0, 1
|
srvs.splice 0, 1
|
||||||
f i for i in srvs
|
f i for i in srvs
|
||||||
|
|
||||||
pushService: (srv) ->
|
pushService: (ph) ->
|
||||||
|
arr = ph.split "/"
|
||||||
|
srv = arr[1]
|
||||||
|
app = arr[0]
|
||||||
return _PM.createProcess srv, _OS.APP[srv] if _OS.APP[srv]
|
return _PM.createProcess srv, _OS.APP[srv] if _OS.APP[srv]
|
||||||
path = "services/#{srv}.js"
|
_GUI.loadApp app,
|
||||||
_API.script path,
|
(a)->
|
||||||
(d) ->
|
return _PM.createProcess srv, _OS.APP[srv] if _OS.APP[srv]
|
||||||
_PM.createProcess srv, _OS.APP[srv]
|
(e, s) ->
|
||||||
, (e, s) ->
|
|
||||||
_courrier.trigger "srvroutineready", srv
|
_courrier.trigger "srvroutineready", srv
|
||||||
_courrier.osfail "Cannot read service script: #{srv} ", e, s
|
_courrier.osfail "Cannot read service script: #{srv} ", e, s
|
||||||
|
|
||||||
@ -52,9 +54,7 @@ self.OS.GUI =
|
|||||||
_OS.APP[app] = undefined
|
_OS.APP[app] = undefined
|
||||||
_GUI.launch app, args
|
_GUI.launch app, args
|
||||||
|
|
||||||
launch: (app, args) ->
|
loadApp:(app, ok, err) ->
|
||||||
if not _OS.APP[app]
|
|
||||||
# first load it
|
|
||||||
path = "packages/#{app}/"
|
path = "packages/#{app}/"
|
||||||
_API.script path + "main.js",
|
_API.script path + "main.js",
|
||||||
(d) ->
|
(d) ->
|
||||||
@ -70,14 +70,24 @@ self.OS.GUI =
|
|||||||
_API.get "#{path}package.json",
|
_API.get "#{path}package.json",
|
||||||
(data) ->
|
(data) ->
|
||||||
_OS.APP[app].meta = data
|
_OS.APP[app].meta = data
|
||||||
_PM.createProcess app, _OS.APP[app], args
|
ok app
|
||||||
, (e, s) ->
|
, (e, s) ->
|
||||||
_courrier.osfail "Cannot read application metadata: #{app}", e, s
|
_courrier.osfail "Cannot read application metadata: #{app}", e, s
|
||||||
alert "cannot read application, meta-data"
|
err e, s
|
||||||
|
else
|
||||||
|
ok app
|
||||||
, (e, s) ->
|
, (e, s) ->
|
||||||
#BUG report here
|
#BUG report here
|
||||||
_courrier.osfail "Cannot load application script: #{app}", e, s
|
_courrier.osfail "Cannot load application script: #{app}", e, s
|
||||||
console.log "bug report", e, s, path
|
console.log "bug report", e, s, path
|
||||||
|
err e,s
|
||||||
|
launch: (app, args) ->
|
||||||
|
if not _OS.APP[app]
|
||||||
|
# first load it
|
||||||
|
_GUI.loadApp app,
|
||||||
|
(a)->
|
||||||
|
_PM.createProcess a, _OS.APP[a], args
|
||||||
|
, (e, s) ->
|
||||||
else
|
else
|
||||||
# now launch it
|
# now launch it
|
||||||
if _OS.APP[app]
|
if _OS.APP[app]
|
||||||
@ -168,4 +178,5 @@ self.OS.GUI =
|
|||||||
_GUI.loadTheme "antos"
|
_GUI.loadTheme "antos"
|
||||||
_GUI.initDM()
|
_GUI.initDM()
|
||||||
_courrier.observable.one "syspanelloaded", () ->
|
_courrier.observable.one "syspanelloaded", () ->
|
||||||
_GUI.pushServices ["PushNotification", "Spotlight", "Calendar"]
|
#_GUI.loadApp "CoreServices", (a) ->
|
||||||
|
_GUI.pushServices ["CoreServices/PushNotification", "CoreServices/Spotlight", "CoreServices/Calendar"]
|
@ -6,28 +6,6 @@ cssfiles = main.css
|
|||||||
|
|
||||||
copyfiles = scheme.html package.json
|
copyfiles = scheme.html package.json
|
||||||
|
|
||||||
|
PKG_NAME=ActivityMonitor
|
||||||
|
|
||||||
BLUE=\033[1;34m
|
include ../pkg.mk
|
||||||
NC=\033[0m
|
|
||||||
|
|
||||||
main: title clean js css copy
|
|
||||||
|
|
||||||
title:
|
|
||||||
@echo "$(BLUE)======= Package ActivityMonitor =======$(NC)"
|
|
||||||
|
|
||||||
coffee:
|
|
||||||
- mkdir build
|
|
||||||
for f in $(coffee_files); do (coffee -cs < $$f >build/"$$f.js");done
|
|
||||||
for f in build/*.coffee.js; do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
- rm build/*.coffee.js
|
|
||||||
|
|
||||||
js: coffee
|
|
||||||
for f in $(jsfiles); do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
|
|
||||||
css:
|
|
||||||
for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
|
|
||||||
|
|
||||||
copy:
|
|
||||||
cp -rf $(copyfiles) build/
|
|
||||||
clean:
|
|
||||||
- rm -rf build/*
|
|
11
src/packages/CoreServices/Makefile
Normal file
11
src/packages/CoreServices/Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
coffee_files = Calendar.coffee PushNotification.coffee Spotlight.coffee
|
||||||
|
|
||||||
|
jsfiles =
|
||||||
|
|
||||||
|
cssfiles =
|
||||||
|
|
||||||
|
copyfiles = package.json
|
||||||
|
|
||||||
|
|
||||||
|
PKG_NAME=CoreServices
|
||||||
|
include ../pkg.mk
|
14
src/packages/CoreServices/package.json
Normal file
14
src/packages/CoreServices/package.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"app":"CoreServices",
|
||||||
|
"name":"CoreServices",
|
||||||
|
"description":"This is the core services",
|
||||||
|
"info":{
|
||||||
|
"author": "Xuan Sang LE",
|
||||||
|
"email": "xsang.le@gmail.com",
|
||||||
|
"credit": "dedicated to some one here",
|
||||||
|
"licences": "MIT"
|
||||||
|
},
|
||||||
|
"version":"0.1a",
|
||||||
|
"category":"System",
|
||||||
|
"mimes":["*"]
|
||||||
|
}
|
@ -7,27 +7,5 @@ cssfiles = main.css
|
|||||||
copyfiles = scheme.html package.json
|
copyfiles = scheme.html package.json
|
||||||
|
|
||||||
|
|
||||||
BLUE=\033[1;34m
|
PKG_NAME=DummyApp
|
||||||
NC=\033[0m
|
include ../pkg.mk
|
||||||
|
|
||||||
main: title clean js css copy
|
|
||||||
|
|
||||||
title:
|
|
||||||
@echo "$(BLUE)======= Package DummyApp =======$(NC)"
|
|
||||||
|
|
||||||
coffee:
|
|
||||||
- mkdir build
|
|
||||||
for f in $(coffee_files); do (coffee -cs < $$f >build/"$$f.js");done
|
|
||||||
for f in build/*.coffee.js; do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
- rm build/*.coffee.js
|
|
||||||
|
|
||||||
js: coffee
|
|
||||||
for f in $(jsfiles); do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
|
|
||||||
css:
|
|
||||||
for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
|
|
||||||
|
|
||||||
copy:
|
|
||||||
cp -rf $(copyfiles) build/
|
|
||||||
clean:
|
|
||||||
- rm -rf build/*
|
|
@ -7,27 +7,5 @@ cssfiles = main.css
|
|||||||
copyfiles = scheme.html package.json
|
copyfiles = scheme.html package.json
|
||||||
|
|
||||||
|
|
||||||
BLUE=\033[1;34m
|
PKG_NAME=ActivityFile
|
||||||
NC=\033[0m
|
include ../pkg.mk
|
||||||
|
|
||||||
main: title clean js css copy
|
|
||||||
|
|
||||||
title:
|
|
||||||
@echo "$(BLUE)======= Package Files =======$(NC)"
|
|
||||||
|
|
||||||
coffee:
|
|
||||||
- mkdir build
|
|
||||||
for f in $(coffee_files); do (coffee -cs < $$f >build/"$$f.js");done
|
|
||||||
for f in build/*.coffee.js; do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
- rm build/*.coffee.js
|
|
||||||
|
|
||||||
js: coffee
|
|
||||||
for f in $(jsfiles); do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
|
|
||||||
css:
|
|
||||||
for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
|
|
||||||
|
|
||||||
copy:
|
|
||||||
cp -rf $(copyfiles) build/
|
|
||||||
clean:
|
|
||||||
- rm -rf build/*
|
|
@ -9,7 +9,6 @@ class Files extends this.OS.GUI.BaseApplication
|
|||||||
@navbar = @find "nav-bar"
|
@navbar = @find "nav-bar"
|
||||||
@prepaths = []
|
@prepaths = []
|
||||||
@favo = @find "favouri"
|
@favo = @find "favouri"
|
||||||
@loadSetting()
|
|
||||||
|
|
||||||
@view.contextmenuHandler = (e, m) ->
|
@view.contextmenuHandler = (e, m) ->
|
||||||
m.set "items", [ me.mnFile(), me.mnEdit() ]
|
m.set "items", [ me.mnFile(), me.mnEdit() ]
|
||||||
@ -35,12 +34,6 @@ class Files extends this.OS.GUI.BaseApplication
|
|||||||
(d) -> f d.result
|
(d) -> f d.result
|
||||||
, (e, s) -> me.error "Cannot fetch child dir #{e.child.path}"
|
, (e, s) -> me.error "Cannot fetch child dir #{e.child.path}"
|
||||||
|
|
||||||
@favo.set "items", @setting.favorite
|
|
||||||
|
|
||||||
loadSetting: () ->
|
|
||||||
# view setting
|
|
||||||
@view.set "view", @setting.view if @setting.view
|
|
||||||
@view.set "showhidden", @setting.showhidden if @setting.showhidden
|
|
||||||
@setting.favorite = [
|
@setting.favorite = [
|
||||||
{ text: "Applications", path: 'apps:///', iconclass:"fa fa-adn"},
|
{ text: "Applications", path: 'apps:///', iconclass:"fa fa-adn"},
|
||||||
{ text: "Home", path: 'home:///', iconclass:"fa fa-home", selected:true},
|
{ text: "Home", path: 'home:///', iconclass:"fa fa-home", selected:true},
|
||||||
@ -48,8 +41,15 @@ class Files extends this.OS.GUI.BaseApplication
|
|||||||
{ text: "Desktop", path: 'home:///.desktop', iconclass: "fa fa-desktop" },
|
{ text: "Desktop", path: 'home:///.desktop', iconclass: "fa fa-desktop" },
|
||||||
] if not @setting.favorite
|
] if not @setting.favorite
|
||||||
@setting.sidebar = true if @setting.sidebar is undefined
|
@setting.sidebar = true if @setting.sidebar is undefined
|
||||||
@toggleSidebar @setting.sidebar
|
|
||||||
@setting.nav = true if @setting.nav is undefined
|
@setting.nav = true if @setting.nav is undefined
|
||||||
|
@favo.set "items", @setting.favorite
|
||||||
|
@applySetting()
|
||||||
|
|
||||||
|
applySetting: (k) ->
|
||||||
|
# view setting
|
||||||
|
@view.set "view", @setting.view if @setting.view
|
||||||
|
@view.set "showhidden", @setting.showhidden if @setting.showhidden
|
||||||
|
@toggleSidebar @setting.sidebar
|
||||||
@toggleNav @setting.nav
|
@toggleNav @setting.nav
|
||||||
|
|
||||||
chdir: (p, push) ->
|
chdir: (p, push) ->
|
||||||
@ -123,16 +123,19 @@ class Files extends this.OS.GUI.BaseApplication
|
|||||||
actionView: (e) ->
|
actionView: (e) ->
|
||||||
switch e.item.data.dataid
|
switch e.item.data.dataid
|
||||||
when "#{@name}-hidden"
|
when "#{@name}-hidden"
|
||||||
@.view.set "showhidden", e.item.data.checked
|
#@.view.set "showhidden", e.item.data.checked
|
||||||
@.setting.showhidden = e.item.data.checked
|
@registry "showhidden",e.item.data.checked
|
||||||
|
#@.setting.showhidden = e.item.data.checked
|
||||||
when "#{@name}-refresh"
|
when "#{@name}-refresh"
|
||||||
@.chdir ($ @.navinput).val(), false
|
@.chdir ($ @.navinput).val(), false
|
||||||
when "#{@name}-side"
|
when "#{@name}-side"
|
||||||
@setting.sidebar = e.item.data.checked
|
@registry "sidebar",e.item.data.checked
|
||||||
@toggleSidebar e.item.data.checked
|
#@setting.sidebar = e.item.data.checked
|
||||||
|
#@toggleSidebar e.item.data.checked
|
||||||
when "#{@name}-nav"
|
when "#{@name}-nav"
|
||||||
@setting.nav = e.item.data.checked
|
@registry "nav", e.item.data.checked
|
||||||
@toggleNav e.item.data.checked
|
#@setting.nav = e.item.data.checked
|
||||||
|
#@toggleNav e.item.data.checked
|
||||||
|
|
||||||
actionEdit: (e) ->
|
actionEdit: (e) ->
|
||||||
switch e.item.data.dataid
|
switch e.item.data.dataid
|
||||||
|
@ -7,27 +7,5 @@ cssfiles = main.css
|
|||||||
copyfiles = scheme.html package.json
|
copyfiles = scheme.html package.json
|
||||||
|
|
||||||
|
|
||||||
BLUE=\033[1;34m
|
PKG_NAME=NotePad
|
||||||
NC=\033[0m
|
include ../pkg.mk
|
||||||
|
|
||||||
main: title clean js css copy
|
|
||||||
|
|
||||||
title:
|
|
||||||
@echo "$(BLUE)======= Package NotePad =======$(NC)"
|
|
||||||
|
|
||||||
coffee:
|
|
||||||
- mkdir build
|
|
||||||
for f in $(coffee_files); do (coffee -cs < $$f >build/"$$f.js");done
|
|
||||||
for f in build/*.coffee.js; do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
- rm build/*.coffee.js
|
|
||||||
|
|
||||||
js: coffee
|
|
||||||
for f in $(jsfiles); do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
|
|
||||||
css:
|
|
||||||
for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
|
|
||||||
|
|
||||||
copy:
|
|
||||||
cp -rf $(copyfiles) build/
|
|
||||||
clean:
|
|
||||||
- rm -rf build/*
|
|
25
src/packages/pkg.mk
Normal file
25
src/packages/pkg.mk
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
BLUE=\033[1;34m
|
||||||
|
NC=\033[0m
|
||||||
|
|
||||||
|
main: title clean js css copy
|
||||||
|
|
||||||
|
title:
|
||||||
|
@echo "$(BLUE)======= Package $(PKG_NAME) =======$(NC)"
|
||||||
|
|
||||||
|
coffee:
|
||||||
|
- mkdir build
|
||||||
|
for f in $(coffee_files); do (coffee -cs < $$f >build/"$$f.js");done
|
||||||
|
for f in build/*.coffee.js; do (cat "$${f}"; echo) >> build/main.js; done
|
||||||
|
- rm build/*.coffee.js
|
||||||
|
|
||||||
|
js: coffee
|
||||||
|
for f in $(jsfiles); do (cat "$${f}"; echo) >> build/main.js; done
|
||||||
|
|
||||||
|
css:
|
||||||
|
for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
|
||||||
|
|
||||||
|
copy:
|
||||||
|
cp -rf $(copyfiles) build/
|
||||||
|
clean:
|
||||||
|
- rm -rf build/*
|
@ -7,28 +7,5 @@ cssfiles = xterm.css main.css
|
|||||||
copyfiles = scheme.html package.json
|
copyfiles = scheme.html package.json
|
||||||
|
|
||||||
|
|
||||||
BLUE=\033[1;34m
|
PKG_NAME=wTerm
|
||||||
NC=\033[0m
|
include ../pkg.mk
|
||||||
|
|
||||||
main: title clean js css copy
|
|
||||||
|
|
||||||
title:
|
|
||||||
@echo "$(BLUE)======= Package wTerm =======$(NC)"
|
|
||||||
- rm -rf build/*
|
|
||||||
|
|
||||||
coffee:
|
|
||||||
- mkdir build
|
|
||||||
for f in $(coffee_files); do (coffee -cs < $$f >build/"$$f.js");done
|
|
||||||
for f in build/*.coffee.js; do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
- rm build/*.coffee.js
|
|
||||||
|
|
||||||
js: coffee
|
|
||||||
for f in $(jsfiles); do (cat "$${f}"; echo) >> build/main.js; done
|
|
||||||
|
|
||||||
css:
|
|
||||||
for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
|
|
||||||
|
|
||||||
copy:
|
|
||||||
cp -rf $(copyfiles) build/
|
|
||||||
clean:
|
|
||||||
- rm -rf build/*
|
|
Loading…
Reference in New Issue
Block a user