remote handler

This commit is contained in:
Xuan Sang LE
2017-08-27 23:40:02 +02:00
parent fc406be924
commit 6f298fc52b
42 changed files with 714 additions and 205 deletions

View File

@ -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",

View 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;
}

View File

@ -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>