mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 03:09:45 +02:00
remote handler
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
_PM = this.OS.PM
|
||||
_APP = this.OS.APP
|
||||
class ActivityMonitor extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "ActivityMonitor"
|
||||
constructor: (args) ->
|
||||
super "ActivityMonitor", args
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", "Activity Monitor"
|
||||
|
@ -1,7 +1,7 @@
|
||||
_GUI = this.OS.GUI
|
||||
class DummyApp extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "DummyApp"
|
||||
constructor: (args) ->
|
||||
super "DummyApp", args
|
||||
main: () ->
|
||||
self = @
|
||||
@on "btclick", (e)->
|
||||
@ -83,7 +83,14 @@ class DummyApp extends this.OS.GUI.BaseApplication
|
||||
@scheme.set "apptitle", "AntOS feature showcase"
|
||||
|
||||
@scheme.contextmenuHandler = (e, m) ->
|
||||
mdata = [ { text: " Child 1" }, { text: "child2", child: [{text: "sub child", child:[{text:"sub sub child"}] }]}]
|
||||
mdata = [
|
||||
{ text: " Child 1" },
|
||||
{ text: "child2", child: [
|
||||
{text: "sub child", child:[{text:"sub sub child"}] },
|
||||
{text: "sub child 1" }
|
||||
], onmenuselect: (e) -> console.log e
|
||||
}
|
||||
]
|
||||
m.set "items", mdata
|
||||
m.show(e)
|
||||
|
||||
|
@ -1,62 +1,146 @@
|
||||
class Files extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "Files"
|
||||
constructor: (args) ->
|
||||
super "Files", args
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", "Files manager"
|
||||
@view = @find "fileview"
|
||||
@scheme.contextmenuHandler = (e, m) ->
|
||||
mdata = [ { text: " Child 1" }, { text: "child2", child: [{text: "sub child", child:[{text:"sub sub child"}] }]}]
|
||||
m.set "items", mdata
|
||||
@navinput = @find "navinput"
|
||||
@navbar = @find "nav-bar"
|
||||
@prepaths = []
|
||||
@favo = @find "favouri"
|
||||
@loadSetting()
|
||||
|
||||
@view.contextmenuHandler = (e, m) ->
|
||||
m.set "items", [ me.mnFile(), me.mnEdit() ]
|
||||
m.show(e)
|
||||
@on "fileselect", (d) -> console.log d
|
||||
#load home directory
|
||||
p = 'home:///'
|
||||
@_api.VFS.scandir p,
|
||||
#@on "fileselect", (d) -> console.log d
|
||||
@on "filedbclick", (e) ->
|
||||
#if e.data.type is 'dir' then me.chdir e.data.path, true
|
||||
@favo.set "onlistselect", (e) -> me.chdir e.data.path, true
|
||||
|
||||
($ @find "btback").click () ->
|
||||
return if me.prepaths.length is 0
|
||||
p = me.prepaths.pop()
|
||||
me.favo.set "selected", -1
|
||||
me.chdir p, false
|
||||
|
||||
($ @navinput).keyup (e) ->
|
||||
me.chdir ($ me.navinput).val() if e.keyCode is 13 #enter
|
||||
|
||||
@view.set "chdir", (p) -> me.chdir p, true
|
||||
@view.set "fetch", (e, f) ->
|
||||
return unless e.child
|
||||
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},
|
||||
{ text: "OS", path: 'os:///', iconclass:"fa fa-inbox" },
|
||||
{ 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
|
||||
@toggleNav @setting.nav
|
||||
|
||||
chdir: (p, push) ->
|
||||
me = @
|
||||
me._api.handler.scandir p,
|
||||
(d) ->
|
||||
if(d.error)
|
||||
return me.error "Resource not found #{p}"
|
||||
v = ($ me.navinput).val()
|
||||
me.prepaths.push v if push and v isnt ""
|
||||
($ me.navinput).val p
|
||||
me.view.set "path", p
|
||||
me.view.set "data", d.result
|
||||
, (e, s) ->
|
||||
alert "cannot open dir"
|
||||
me.error "Cannot chdir #{p}"
|
||||
|
||||
mnFile:() ->
|
||||
{
|
||||
text: "File",
|
||||
child: [
|
||||
{ text: "New file", dataid: "#{@name}-mkf" },
|
||||
{ text: "New folder", dataid: "#{@name}-mkdir" },
|
||||
{ text: "Upload", dataid: "#{@name}-upload" }
|
||||
]
|
||||
}
|
||||
mnEdit: () ->
|
||||
me = @
|
||||
{
|
||||
text: "Edit",
|
||||
child: [
|
||||
{ text: "Rename", dataid: "#{@name}-mv" },
|
||||
{ text: "Delete", dataid: "#{@name}-rm" },
|
||||
{ text: "Information", dataid: "#{@name}-info" },
|
||||
{ text: "Open with", dataid: "#{@name}-open" },
|
||||
{ text: "Download", dataid: "#{@name}-download" },
|
||||
], onmenuselect: (e) -> me.actionEdit e
|
||||
}
|
||||
menu: () ->
|
||||
me = @
|
||||
menu = [
|
||||
{
|
||||
text: "File",
|
||||
child: [
|
||||
{ text: "New file", dataid: "#{@name}-mkf" },
|
||||
{ text: "New folder", dataid: "#{@name}-mkdir" },
|
||||
{ text: "Upload", dataid: "#{@name}-upload" }
|
||||
]
|
||||
},
|
||||
{
|
||||
text: "Edit",
|
||||
child: [
|
||||
{ text: "Rename", dataid: "#{@name}-mv" },
|
||||
{ text: "Delete", dataid: "#{@name}-rm" },
|
||||
{ text: "Information", dataid: "#{@name}-info" },
|
||||
{ text: "Open with", dataid: "#{@name}-open" },
|
||||
{ text: "Download", dataid: "#{@name}-download" },
|
||||
]
|
||||
},
|
||||
@mnFile(),
|
||||
@mnEdit(),
|
||||
{
|
||||
text: "View",
|
||||
child: [
|
||||
{ text: "Refresh", dataid: "#{@name}-refresh" },
|
||||
{ text: "Sidebar", switch: true, dataid: "#{@name}-side" },
|
||||
{ text: "Navigation bar", switch: true , dataid: "#{@name}-nav" },
|
||||
{ text: "Hidden files", switch: true, dataid: "#{@name}-hidden" },
|
||||
{ text: "Sidebar", switch: true, checked: @setting.sidebar, dataid: "#{@name}-side" },
|
||||
{ text: "Navigation bar", switch: true, checked: @setting.nav, dataid: "#{@name}-nav" },
|
||||
{ text: "Hidden files", switch: true, checked: @setting.showhidden, dataid: "#{@name}-hidden" },
|
||||
{ text: "Type", child: [
|
||||
{ text: "Icon view", radio: true, dataid: "#{@name}-icon", type: 'icon' },
|
||||
{ text: "List view", radio:true, checked: true, dataid: "#{@name}-list", type: 'list' },
|
||||
{ text: "Tree view", radio:true, dataid: "#{@name}-tree", type: 'tree' }
|
||||
{ text: "Icon view", radio: true, checked: @setting.view is 'icon', dataid: "#{@name}-icon", type: 'icon' },
|
||||
{ text: "List view", radio:true, checked: @setting.view is 'list' or not @setting.view, dataid: "#{@name}-list", type: 'list' },
|
||||
{ text: "Tree view", radio:true, checked: @setting.view is 'tree', dataid: "#{@name}-tree", type: 'tree' }
|
||||
], onmenuselect: (e) ->
|
||||
me.view.set 'view', e.item.data.type
|
||||
me.setting.view = e.item.data.type
|
||||
},
|
||||
]
|
||||
], onmenuselect: (e) -> me.actionView e
|
||||
},
|
||||
]
|
||||
menu
|
||||
|
||||
this.OS.register "Files",Files
|
||||
toggleSidebar: (b) ->
|
||||
if b then ($ @favo).show() else ($ @favo).hide()
|
||||
@trigger "resize"
|
||||
|
||||
toggleNav: (b) ->
|
||||
if b then ($ @navbar).show() else ($ @navbar).hide()
|
||||
@trigger "resize"
|
||||
|
||||
actionView: (e) ->
|
||||
switch e.item.data.dataid
|
||||
when "#{@name}-hidden"
|
||||
@.view.set "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
|
||||
when "#{@name}-nav"
|
||||
@setting.nav = e.item.data.checked
|
||||
@toggleNav e.item.data.checked
|
||||
|
||||
actionEdit: (e) ->
|
||||
switch e.item.data.dataid
|
||||
when "#{@.name}-info"
|
||||
file = @view.get "selectedFile"
|
||||
return unless file
|
||||
@openDialog "InfoDialog", null, file
|
||||
else
|
||||
@_api.handler.setting()
|
||||
|
||||
this.OS.register "Files", Files
|
@ -0,0 +1,36 @@
|
||||
afx-app-window[data-id ='files-app-window'] afx-list-view{
|
||||
border-top:1px solid #A6A6A6;
|
||||
}
|
||||
afx-app-window[data-id ='files-app-window'] afx-list-view[data-id='favouri']{
|
||||
background-color: #f6F6F6;
|
||||
border-right: 1px solid #cbcbcb;
|
||||
border-top:1px solid #A6A6A6;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
afx-app-window[data-id ='files-app-window'] afx-list-view[data-id='favouri'] li{
|
||||
background-color: transparent;
|
||||
}
|
||||
afx-app-window[data-id ='files-app-window'] afx-list-view[data-id='favouri'] li.selected {
|
||||
background-color: #cecece;
|
||||
color:#414339;
|
||||
}
|
||||
afx-app-window[data-id ='files-app-window'] .afx-window-top{
|
||||
border-bottom: 0;
|
||||
}
|
||||
afx-app-window[data-id ='files-app-window'] afx-vbox[data-id = "nav-bar"]{
|
||||
background-color: #dfdfdf;
|
||||
}
|
||||
afx-app-window[data-id ='files-app-window'] afx-grid-view afx-grid-row.grid_row_header div{
|
||||
border-top:1px solid #A6A6A6;
|
||||
}
|
||||
afx-app-window[data-id ='files-app-window'] button{
|
||||
height: 23px;
|
||||
border-radius: 3px;
|
||||
padding-top:2px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
afx-app-window[data-id ='files-app-window'] input{
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
@ -1,5 +1,14 @@
|
||||
<afx-app-window apptitle="Files" width="600" height="400">
|
||||
<afx-vbox>
|
||||
<afx-file-view data-id = "fileview"></afx-file-view>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
||||
<afx-app-window data-id = "files-app-window" apptitle="Files" width="600" height="400">
|
||||
<afx-hbox>
|
||||
<afx-vbox data-height = "30" data-id = "nav-bar">
|
||||
<afx-button data-width = "30" data-id = "btback" iconclass = "fa fa-arrow-left"></afx-button>
|
||||
<input type = "text" data-id = "navinput"></input>
|
||||
<div data-width = "5"></div>
|
||||
</afx-vbox>
|
||||
<afx-vbox>
|
||||
<afx-list-view data-id = "favouri" data-width = "150">
|
||||
</afx-list-view>
|
||||
<afx-file-view data-id = "fileview"></afx-file-view>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
@ -1,10 +1,12 @@
|
||||
class NotePad extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "NotePad"
|
||||
constructor: (args) ->
|
||||
super "NotePad", args
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", "NotePad"
|
||||
|
||||
@sidebar = @find "sidebar"
|
||||
@location = @find "location"
|
||||
@fileview = @find "fileview"
|
||||
div = @find "datarea"
|
||||
ace.require "ace/ext/language_tools"
|
||||
@.editor = ace.edit div
|
||||
@ -52,7 +54,32 @@ class NotePad extends this.OS.GUI.BaseApplication
|
||||
|
||||
@on "resize", () -> me.editor.resize()
|
||||
@on "focus", () -> me.editor.focus()
|
||||
|
||||
@fileview.set "chdir", (d) -> me.chdir d
|
||||
@fileview.set "fetch", (e, f) ->
|
||||
return unless e.child
|
||||
me._api.handler.scandir e.child.path,
|
||||
(d) -> f d.result
|
||||
, (e, s) -> me.error "Cannot fetch child dir #{e.child.path}"
|
||||
|
||||
@location.set "onlistselect", (e) -> me.chdir e.data.path
|
||||
@location.set "items", [
|
||||
{ text: "Home", path: 'home:///', iconclass:"fa fa-home", selected:true},
|
||||
{ text: "OS", path: 'os:///', iconclass:"fa fa-inbox" },
|
||||
{ text: "Desktop", path: 'home:///.desktop', iconclass: "fa fa-desktop" },
|
||||
]
|
||||
|
||||
chdir: (p) ->
|
||||
me = @
|
||||
me._api.handler.scandir p,
|
||||
(d) ->
|
||||
if(d.error)
|
||||
return me.error "Resource not found #{p}"
|
||||
me.fileview.set "path", p
|
||||
me.fileview.set "data", d.result
|
||||
, (e, s) ->
|
||||
me.error "Cannot chdir #{p}"
|
||||
|
||||
menu: ()->
|
||||
menu = [{
|
||||
text:"File",
|
||||
|
@ -13,4 +13,7 @@ afx-app-window[data-id="notepad"] span[data-id="editorstat"]{
|
||||
}
|
||||
afx-app-window[data-id="notepad"] afx-vbox[data-id="bottom-vbox"]{
|
||||
background-color: #dfdfdf;
|
||||
}
|
||||
afx-app-window[data-id="notepad"] .afx-window-content {
|
||||
background-color: #f6F6F6;
|
||||
}
|
@ -1,25 +1,17 @@
|
||||
<afx-app-window apptitle="" width="600" height="400" data-id="notepad">
|
||||
<afx-hbox>
|
||||
|
||||
<!--afx-list-view data-id = "flist" data-width = "150" > </afx-list-view>
|
||||
<afx-vbox>
|
||||
<afx-hbox data-width = "175" data-id = "sidebar">
|
||||
<afx-list-view data-id = "location" dropdown = "true" data-height= "30" width = "150"></afx-list-view>
|
||||
<afx-file-view data-id = "fileview" view='tree' status = false></afx-file-view>
|
||||
</afx-hbox>
|
||||
<afx-hbox>
|
||||
<afx-button data-height="50" text="Read more" iconclass="fa fa-camera-retro fa-lg" id="button">
|
||||
</afx-button>
|
||||
<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>
|
||||
|
||||
</afx-hbox-->
|
||||
<div data-id="datarea"></div>
|
||||
<afx-vbox data-height="30" data-id="bottom-vbox">
|
||||
<div ><span data-id = "editorstat"></span></div>
|
||||
<afx-list-view data-width="170" data-id = "themelist" dropdown = "true" width="150"></afx-list-view>
|
||||
<afx-list-view data-width="170" data-id = "modelist" dropdown = "true" width="150"></afx-list-view>
|
||||
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
<div data-id="datarea"></div>
|
||||
<afx-vbox data-height="30" data-id="bottom-vbox">
|
||||
<div ><span data-id = "editorstat"></span></div>
|
||||
<afx-list-view data-width="160" data-id = "themelist" dropdown = "true" width="135"></afx-list-view>
|
||||
<afx-list-view data-width="125" data-id = "modelist" dropdown = "true" width="100"></afx-list-view>
|
||||
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
@ -1,6 +1,6 @@
|
||||
class wTerm extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "wTerm"
|
||||
constructor: (args) ->
|
||||
super "wTerm", args
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
|
Reference in New Issue
Block a user