mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 03:09:45 +02:00
core for app development
This commit is contained in:
33
src/packages/ActivityMonitor/Makefile
Normal file
33
src/packages/ActivityMonitor/Makefile
Normal file
@ -0,0 +1,33 @@
|
||||
coffee_files = main.coffee
|
||||
|
||||
jsfiles =
|
||||
|
||||
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 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/*
|
56
src/packages/ActivityMonitor/main.coffee
Normal file
56
src/packages/ActivityMonitor/main.coffee
Normal file
@ -0,0 +1,56 @@
|
||||
_PM = this.OS.PM
|
||||
_APP = this.OS.APP
|
||||
class ActivityMonitor extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "ActivityMonitor"
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", "Activity Monitor"
|
||||
@grid = @find "mygrid"
|
||||
@on "btclick", (e)->
|
||||
return unless e.id == "btkill"
|
||||
item = me.grid.get "selected"
|
||||
return unless item
|
||||
app = _PM.appByPid item[0].value
|
||||
app.quit() if app
|
||||
|
||||
header = [{width:50,value:"Pid"},{value:"Name"},{width:100,value:"Alive (ms)"}]
|
||||
@gdata =
|
||||
processes:{}
|
||||
alive:[]
|
||||
@grid.set "header",header
|
||||
@monitor()
|
||||
|
||||
monitor: () ->
|
||||
me = @
|
||||
#get all current running process
|
||||
me.gdata.alive = []
|
||||
now = (new Date).getTime()
|
||||
$.each _PM.processes, (i,d)->
|
||||
$.each d , (j,a)->
|
||||
if me.gdata.processes[a.pid] #update it
|
||||
me.gdata.processes[a.pid][2].value = now - a.birth
|
||||
else #add it
|
||||
me.gdata.processes[a.pid] = [
|
||||
{value:a.pid},
|
||||
{icon:_APP[a.name].meta.icon,iconclass:_APP[a.name].meta.iconclass,value:a.name},
|
||||
{value: now - a.birth}
|
||||
]
|
||||
me.gdata.alive.push a.pid
|
||||
@refreshGrid()
|
||||
@timer = setTimeout (()-> me.monitor()),500#one second
|
||||
|
||||
refreshGrid: ()->
|
||||
activeList = []
|
||||
me = @
|
||||
$.each @gdata.processes, (i,e) ->
|
||||
if ($.inArray (Number i),me.gdata.alive) >= 0
|
||||
activeList.push e
|
||||
else
|
||||
me.gdata.processes[i] = undefined
|
||||
@grid.set "rows",activeList
|
||||
exit: (e) ->
|
||||
clearTimeout @timer if @timer
|
||||
|
||||
ActivityMonitor.singleton = true
|
||||
this.OS.register "ActivityMonitor",ActivityMonitor
|
8
src/packages/ActivityMonitor/main.css
Normal file
8
src/packages/ActivityMonitor/main.css
Normal file
@ -0,0 +1,8 @@
|
||||
afx-app-window[data-id="am-window"] afx-button{
|
||||
margin: 3px;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="am-window"] afx-grid-view{
|
||||
padding-left:10px;
|
||||
padding-right: 10px;
|
||||
}
|
12
src/packages/ActivityMonitor/package.json
Normal file
12
src/packages/ActivityMonitor/package.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"app":"ActivityMonitor",
|
||||
"name":"Activity monitor",
|
||||
"description":"Processes monitor and manager",
|
||||
"author":{
|
||||
"name": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"category":"System",
|
||||
"iconclass":"fa fa-heartbeat",
|
||||
"mimes":["*"]
|
||||
}
|
7
src/packages/ActivityMonitor/scheme.html
Normal file
7
src/packages/ActivityMonitor/scheme.html
Normal file
@ -0,0 +1,7 @@
|
||||
<afx-app-window data-id = "am-window" apptitle="" width="400" height="300">
|
||||
<afx-vbox>
|
||||
<afx-hbox>
|
||||
<afx-grid-view data-id = "mygrid"></afx-grid-view>
|
||||
<afx-button data-height="30" data-id = "btkill" text = "Kill process" iconclass="fa fa-times"></afx-button>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
@ -7,27 +7,27 @@ cssfiles = main.css
|
||||
copyfiles = scheme.html package.json
|
||||
|
||||
|
||||
BLUE=\033[0;34m
|
||||
BLUE=\033[1;34m
|
||||
NC=\033[0m
|
||||
|
||||
main: title clean js css copy
|
||||
|
||||
title:
|
||||
- echo "$(BLUE)======= Package NotePad =======$(NC)"
|
||||
@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
|
||||
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
|
||||
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
|
||||
for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
|
||||
|
||||
copy:
|
||||
- cp -rf $(copyfiles) build/
|
||||
cp -rf $(copyfiles) build/
|
||||
clean:
|
||||
- rm -rf build/*
|
@ -1,10 +1,53 @@
|
||||
class NotePad extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "NotePad"
|
||||
event: () ->
|
||||
console.log @scheme
|
||||
@on "btclick", (e)->
|
||||
alert "Happy pola"
|
||||
@on "resize", (w,h)->
|
||||
console.log "resize"
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", "NotePad"
|
||||
|
||||
div = @find "datarea"
|
||||
ace.require "ace/ext/language_tools"
|
||||
@.editor = ace.edit div
|
||||
@.editor.setTheme "ace/theme/monokai"
|
||||
@.editor.getSession().setMode 'ace/mode/text'
|
||||
@.editor.setOptions {
|
||||
enableBasicAutocompletion: true,
|
||||
enableSnippets: true,
|
||||
enableLiveAutocompletion: true,
|
||||
fontSize: "10pt"
|
||||
}
|
||||
@.editor.completers.push {getCompletions:(editor, session, pos, prefix, callback)->}
|
||||
@.editor.getSession().setUseWrapMode true
|
||||
|
||||
list = @find "modelist"
|
||||
@modes = ace.require "ace/ext/modelist"
|
||||
ldata = []
|
||||
ldata.push {text:m.name, mode:m.mode} for m in @modes.modes
|
||||
list.set "items",ldata
|
||||
list.set "onlistselect", (e)->
|
||||
me.editor.session.setMode e.data.mode
|
||||
|
||||
stat = @find "editorstat"
|
||||
#status
|
||||
stup = (e)->
|
||||
c = me.editor.session.selection.getCursor()
|
||||
l = me.editor.session.getLength()
|
||||
$(stat).html "Row #{c.row}, col #{c.column}, lines: #{l}"
|
||||
stup(0)
|
||||
@.editor.getSession().selection.on "changeCursor", (e)->
|
||||
stup(e)
|
||||
|
||||
@on "resize", ()-> me.editor.resize()
|
||||
@on "focus", ()->me.editor.focus()
|
||||
|
||||
menu: ()->
|
||||
menu = [{
|
||||
text:"File",
|
||||
child:[
|
||||
{text:"Open", dataid:"#{@name}-Open"},
|
||||
{text:"Close", dataid:"#{@name}-Close"}
|
||||
]
|
||||
}]
|
||||
menu
|
||||
NotePad.singleton = false
|
||||
this.OS.register "NotePad",NotePad
|
@ -1,3 +1,9 @@
|
||||
fut{
|
||||
background-color: black
|
||||
|
||||
afx-app-window[data-id="notepad"] afx-list-view[data-id="modelist"]{
|
||||
margin:2px;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="notepad"] span[data-id="editorstat"]{
|
||||
padding:5px;
|
||||
display: inline-block;
|
||||
}
|
@ -7,6 +7,6 @@
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"category":"System",
|
||||
"icon":"",
|
||||
"iconclass":"fa fa-pencil-square-o",
|
||||
"mimes":["*"]
|
||||
}
|
@ -1,16 +1,24 @@
|
||||
<afx-app-window apptitle="Preview" width="600" height="400">
|
||||
<afx-vbox>
|
||||
<afx-app-window apptitle="" width="600" height="400" data-id="notepad">
|
||||
<afx-hbox>
|
||||
|
||||
<afx-list-view data-width = "250"> </afx-list-view>
|
||||
|
||||
<!--afx-list-view data-id = "flist" data-width = "150" > </afx-list-view>
|
||||
<afx-hbox>
|
||||
<afx-button data-height="50" onbtclick="alert('im clicked')" text="Read more" icon="fa fa-camera-retro fa-lg" id="button">
|
||||
<afx-button data-height="50" text="Read more" iconclass="fa fa-camera-retro fa-lg" id="button">
|
||||
</afx-button>
|
||||
<div style=" vertical-align: top; width:100%;height:100%;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
||||
<div>
|
||||
big text here
|
||||
</div>
|
||||
<div data-height="100" style=" vertical-align: top; width:100%;height:100%;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
||||
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
|
||||
<div data-width="100">Test</div>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
|
||||
</afx-hbox-->
|
||||
<div data-id="datarea"></div>
|
||||
<afx-vbox data-height="30">
|
||||
<div ><span data-id = "editorstat"></span></div>
|
||||
<afx-list-view data-width="170" data-id = "modelist" dropdown = "true" width="150"></afx-list-view>
|
||||
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
33
src/packages/Terminal/Makefile
Normal file
33
src/packages/Terminal/Makefile
Normal file
@ -0,0 +1,33 @@
|
||||
coffee_files = main.coffee
|
||||
|
||||
jsfiles =
|
||||
|
||||
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 Terminal =======$(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/*
|
80
src/packages/Terminal/main.coffee
Normal file
80
src/packages/Terminal/main.coffee
Normal file
@ -0,0 +1,80 @@
|
||||
class Terminal extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "Terminal"
|
||||
main: () ->
|
||||
self = @
|
||||
@on "btclick", (e)->
|
||||
alert "#{self.name}: Happy pola"
|
||||
@on "resize", (w,h)->
|
||||
console.log "#{self.name}: resize"
|
||||
#@on "listselect", (i)->
|
||||
# console.log self.name, i
|
||||
@on "treeselect", (i) ->
|
||||
console.log self.name,i
|
||||
@on "focus", ()->
|
||||
console.log self.name, "is focused"
|
||||
tree = @find "mytree"
|
||||
|
||||
@scheme.set "apptitle", "Terminal"
|
||||
tdata = {
|
||||
name: 'My Tree',
|
||||
nodes: [
|
||||
{ name: 'hello', icon:'packages/NotePad/icon.png'},
|
||||
{ name: 'wat' },
|
||||
{
|
||||
name: 'child folder',
|
||||
nodes: [
|
||||
{
|
||||
name: 'child folder',
|
||||
nodes: [
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' }
|
||||
]
|
||||
},
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' },
|
||||
{
|
||||
name: 'child folder',
|
||||
nodes: [
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
tree.set "*",tdata
|
||||
|
||||
list = @find "mylist"
|
||||
ldata = [
|
||||
{text:"some thing with avery long text"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"},
|
||||
{text:"some thing"}
|
||||
]
|
||||
list.set "items",ldata
|
||||
list.set "onlistselect", (e)->
|
||||
console.log e
|
||||
|
||||
Terminal.singleton = false
|
||||
this.OS.register "Terminal",Terminal
|
0
src/packages/Terminal/main.css
Normal file
0
src/packages/Terminal/main.css
Normal file
12
src/packages/Terminal/package.json
Normal file
12
src/packages/Terminal/package.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"app":"Terminal",
|
||||
"name":"Unix terminal like",
|
||||
"description":"Access Unix terminal from web",
|
||||
"author":{
|
||||
"name": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"category":"System",
|
||||
"iconclass":"fa fa-terminal",
|
||||
"mimes":["*"]
|
||||
}
|
14
src/packages/Terminal/scheme.html
Normal file
14
src/packages/Terminal/scheme.html
Normal file
@ -0,0 +1,14 @@
|
||||
<afx-app-window apptitle="Preview" width="600" height="400">
|
||||
<afx-vbox>
|
||||
<afx-tree-view data-id="mytree"> </afx-tree-view>
|
||||
<afx-hbox>
|
||||
<afx-button data-height="50" text="Read more" iconclass="fa fa-camera-retro fa-lg" id="button">
|
||||
</afx-button>
|
||||
<afx-list-view data-id = "mylist" dropdown = "true" width="200"></afx-list-view>
|
||||
<div data-height="100" style=" vertical-align: top; width:100%;height:100%;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
||||
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
Reference in New Issue
Block a user