global settting

This commit is contained in:
Xuan Sang LE
2018-01-22 19:59:08 +01:00
parent 338dca02b9
commit 46e50b191f
15 changed files with 133 additions and 176 deletions

View File

@ -6,28 +6,6 @@ cssfiles = main.css
copyfiles = scheme.html package.json
PKG_NAME=ActivityMonitor
BLUE=\033[1;34m
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/*
include ../pkg.mk

View File

@ -0,0 +1,23 @@
class Calendar extends this.OS.GUI.BaseService
constructor: (args) ->
super "Calendar", args
#@iconclass = "fa fa-commenting"
@text = ""
@iconclass = "fa fa-calendar"
init: ->
#update time each second
me = @
@watch 1000, () ->
now = new Date
me.text = "#{now.getDate()}/#{(now.getMonth()+1)}/#{now.getFullYear()} " +
"#{now.getHours()}:#{now.getMinutes()}:#{now.getSeconds()}"
me.update()
awake: (e) ->
@.openDialog "CalendarDialog", (d) -> console.log d
# do nothing
cleanup: (evt) ->
console.log "cleanup for quit"
# do nothing
this.OS.register "Calendar",Calendar

View File

@ -0,0 +1,11 @@
coffee_files = Calendar.coffee PushNotification.coffee Spotlight.coffee
jsfiles =
cssfiles =
copyfiles = package.json
PKG_NAME=CoreServices
include ../pkg.mk

View File

@ -0,0 +1,93 @@
class PushNotification extends this.OS.GUI.BaseService
constructor: (args) ->
super "PushNotification", args
@iconclass = "fa fa-bars"
@onmenuselect = (e) -> console.log e
@cb = undefined
@pending = []
init: ->
@view = false
path = "resources/schemes/notifications.html"
@render path
spin: (b) ->
if b and @iconclass is "fa fa-bars"
@iconclass = "fa fa-spinner fa-spin"
@color = "#f90e00"
@update()
else if not b and @iconclass is "fa fa-spinner fa-spin"
@iconclass = "fa fa-bars"
@color = "#414339"
@update()
main: ->
me = @
@mlist = @find "notifylist"
@mfeed = @find "notifeed"
@nzone = @find "notifyzone"
@fzone = @find "feedzone"
(@find "btclear").set "onbtclick", (e) -> me.mlist.set "items", []
#mlist.set "onlistselect", (e) -> console.log e
@subscribe "notification", (o) -> me.pushout 'INFO', o
@subscribe "fail", (o) -> me.pushout 'FAIL', o
@subscribe "error", (o) -> me.pushout 'ERROR', o
@subscribe "loading", (o) ->
me.pending.push o.id
me.spin true
@subscribe "loaded", (o) ->
i = me.pending.indexOf o.id
me.pending.splice i, 1 if i >= 0
me.spin false if me.pending.length is 0
($ @nzone).css "right", 0
.css "top", "-3px"
.css "height", ""
.css "bottom", "0"
.css "z-index", 1000000
.hide()
($ @fzone)
#.css("z-index", 99999)
.css("bottom", "0")
.css("height", "")
.hide()
pushout: (s, o, mfeed) ->
d = {
text: "[#{s}] #{o.name} (#{o.id}): #{o.data.m}",
icon: o.data.icon,
iconclass: o.data.iconclass,
closable: true }
@mlist.unshift d, true
@notifeed d
notifeed: (d) ->
me = @
@mfeed.unshift d, true
($ @fzone).show()
timer = setTimeout () ->
me.mfeed.remove d, true
clearTimeout timer
, 3000
awake: (e) ->
if @view then ($ @nzone).hide() else ($ @nzone).show()
@view = not @view
me = @
if not @cb
@cb = (e) ->
return if e.originalEvent.item and e.originalEvent.item.i isnt undefined
if not ($ e.target).closest($ me.nzone).length and not ($ e.target).closest($ me.holder.root).length
($ me.nzone).hide()
$(document).unbind "click", me.cb
me.view = not me.view
if @view
$(document).on "click", @cb
else
$(document).unbind "click", @cb
cleanup: (evt) ->
# do nothing
this.OS.register "PushNotification",PushNotification

View File

@ -0,0 +1,20 @@
class Spotlight extends this.OS.GUI.BaseService
constructor: (args) ->
super "Spotlight", args
@iconclass = "fa fa-search"
init: ->
@child = [
{
text: "#{@.name} (#{@.pid}): dummy notif",
child: [ { text: "submenu" } ]
}
]
# do nothing
main: ->
awake: (e) ->
console.log @name ,@pid
cleanup: (evt) ->
# do nothing
this.OS.register "Spotlight",Spotlight

View 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":["*"]
}

View File

@ -7,27 +7,5 @@ cssfiles = main.css
copyfiles = scheme.html package.json
BLUE=\033[1;34m
NC=\033[0m
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/*
PKG_NAME=DummyApp
include ../pkg.mk

View File

@ -7,27 +7,5 @@ cssfiles = main.css
copyfiles = scheme.html package.json
BLUE=\033[1;34m
NC=\033[0m
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/*
PKG_NAME=ActivityFile
include ../pkg.mk

View File

@ -9,7 +9,6 @@ class Files extends this.OS.GUI.BaseApplication
@navbar = @find "nav-bar"
@prepaths = []
@favo = @find "favouri"
@loadSetting()
@view.contextmenuHandler = (e, m) ->
m.set "items", [ me.mnFile(), me.mnEdit() ]
@ -34,13 +33,7 @@ class Files extends this.OS.GUI.BaseApplication
me._api.handler.scandir e.child.path,
(d) -> f d.result
, (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 = [
{ text: "Applications", path: 'apps:///', iconclass:"fa fa-adn"},
{ 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" },
] if not @setting.favorite
@setting.sidebar = true if @setting.sidebar is undefined
@toggleSidebar @setting.sidebar
@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
chdir: (p, push) ->
@ -123,16 +123,19 @@ class Files extends this.OS.GUI.BaseApplication
actionView: (e) ->
switch e.item.data.dataid
when "#{@name}-hidden"
@.view.set "showhidden", e.item.data.checked
@.setting.showhidden = e.item.data.checked
#@.view.set "showhidden", e.item.data.checked
@registry "showhidden",e.item.data.checked
#@.setting.showhidden = e.item.data.checked
when "#{@name}-refresh"
@.chdir ($ @.navinput).val(), false
when "#{@name}-side"
@setting.sidebar = e.item.data.checked
@toggleSidebar e.item.data.checked
@registry "sidebar",e.item.data.checked
#@setting.sidebar = e.item.data.checked
#@toggleSidebar e.item.data.checked
when "#{@name}-nav"
@setting.nav = e.item.data.checked
@toggleNav e.item.data.checked
@registry "nav", e.item.data.checked
#@setting.nav = e.item.data.checked
#@toggleNav e.item.data.checked
actionEdit: (e) ->
switch e.item.data.dataid

View File

@ -7,27 +7,5 @@ cssfiles = main.css
copyfiles = scheme.html package.json
BLUE=\033[1;34m
NC=\033[0m
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/*
PKG_NAME=NotePad
include ../pkg.mk

25
src/packages/pkg.mk Normal file
View 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/*

View File

@ -7,28 +7,5 @@ cssfiles = xterm.css main.css
copyfiles = scheme.html package.json
BLUE=\033[1;34m
NC=\033[0m
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/*
PKG_NAME=wTerm
include ../pkg.mk