refactory code

This commit is contained in:
lxsang 2020-05-11 19:52:31 +02:00
parent f5e5d8501b
commit c53fd8bd88
32 changed files with 554 additions and 655 deletions

View File

@ -54,13 +54,13 @@ coffees= src/core/core.coffee \
packages = CoreServices ActivityMonitor Setting ShowCase DummyApp # Files MarkOn MarketPlace Preview NotePad wTerm
main: initd build_coffees build_tags build_themes schemes libs build_packages languages
main: initd build_coffees build_themes schemes libs build_packages languages
- cp src/index.html $(BUILDDIR)/
initd:
- mkdir -p $(BUILDDIR)
lite: build_coffees build_tags build_themes schemes build_packages
lite: build_coffees build_themes schemes build_packages
#%.js: %.coffee
# coffee --compile $<
@ -87,11 +87,6 @@ testdata:
@echo "$(BLUE)Copy JSON test files$(NC)"
- mkdir -p $(BUILDDIR)/resources/jsons
cp src/core/handlers/jsons/* $(BUILDDIR)/resources/jsons
build_tags:
@echo "$(BLUE)Building tag files$(NC)"
-mkdir -p $(BUILDDIR)/resources
-rm $(BUILDDIR)/resources/antos_tags.js
for f in src/core/tags/*.tag; do (cat "$${f}"; echo) >> $(BUILDDIR)/resources/antos_tags.js; done
languages:
-mkdir -p $(BUILDDIR)/resources
@ -144,12 +139,6 @@ uglify:
# npm install uglify-js -g
uglifyjs $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
# uglify tags
# npm install riot-cli -g
riot --ext js $(BUILDDIR)/resources/antos_tags.js $(BUILDDIR)/resources/antos_tags.js
uglifyjs $(BUILDDIR)/resources/antos_tags.js --compress --mangle --output $(BUILDDIR)/resources/antos_tags.js
$(GSED) -i 's/resources\/antos_tags.js/scripts\/riot.min.js/g' $(BUILDDIR)/index.html
$(GSED) -i 's/scripts\/riot.compiler.min.js/resources\/antos_tags.js/g' $(BUILDDIR)/index.html
$(GSED) -i 's/type=\"riot\/tag\"/ /g' "$(BUILDDIR)/index.html"
# npm install uglifycss -g
# uglify the css
uglifycss --output $(BUILDDIR)/resources/themes/antos/antos.css $(BUILDDIR)/resources/themes/antos/antos.css

View File

@ -61,6 +61,8 @@ class BasicDialog extends BaseDialog
init: () ->
@scheme.set "apptitle", @data.title if @data and @data.title
@scheme.set "resizable", false
@scheme.set "minimizable", false
this.OS.GUI.BasicDialog = BasicDialog
@ -343,42 +345,41 @@ AboutDialog.scheme = """
"""
this.OS.register "AboutDialog", AboutDialog
class FileDiaLog extends BaseDialog
class FileDialog extends BasicDialog
constructor: () ->
super "FileDiaLog"
super "FileDialog", FileDialog.scheme
init: () ->
@render "os://resources/schemes/filedialog.html"
main: () ->
super.init()
fileview = @find "fileview"
location = @find "location"
filename = @find "filename"
me = @
@scheme.set "apptitle", @title
fileview.set "fetch", (e, f) ->
return unless e.child
e.child.path.asFileHandle().read (d) ->
return me.error __("Resource not found: {0}", e.child.path) if d.error
f d.result
fileview.set "fetch", (path) ->
new Promise (resolve, reject) ->
path.asFileHandle().read()
.then (d) ->
return reject d if d.error
resolve d.result
.catch (e) -> reject e
setroot = (path) ->
path.asFileHandle().read (d) ->
path.asFileHandle().read().then (d) ->
if(d.error)
return me.error __("Resource not found: {0}", path)
fileview.set "path", path
fileview.set "data", d.result
if not @data or not @data.root
location.set "onlistselect", (e) ->
return unless e and e.data.path
setroot e.data.path
location.set "items", ( i for i in @systemsetting.VFS.mountpoints when i.type isnt "app" )
location.set "selected", 0 unless location.get "selected"
return unless e and e.data.item
setroot e.data.item.get("data").path
location.set "data", ( i for i in @systemsetting.VFS.mountpoints when i.type isnt "app" )
location.set "selected", 0 if location.get("selectedItem") is undefined
else
$(location).hide()
@trigger "calibrate"
@trigger "resize"
setroot @data.root
fileview.set "onfileselect", (f) ->
($ filename).val f.filename if f.type is "file"
fileview.set "onfileselect", (e) ->
($ filename).val e.data.filename if e.data.type is "file"
(@find "bt-ok").set "onbtclick", (e) ->
f = fileview.get "selectedFile"
return me.notify __("Please select a file/fofler") unless f
@ -392,11 +393,9 @@ class FileDiaLog extends BaseDialog
m = true
break
return me.notify __("Only {0} could be selected", me.data.mimes.join(",")) unless m
d = f.path
d = f.path.asFileHandle().parent() if f.type is "file"
me.handle d, ($ filename).val(), f.path, f if me.handle
#sel = if me.data and me.data.selection then me.data.selection else "file"
#me.handle f, ($ filename).val() if me.handle and ((f.type is sel) or (sel is "*"))
name = $(filename).val()
me.handle { file: f, name: name } if me.handle
me.quit()
(@find "bt-cancel").set "onbtclick", (e) ->
@ -406,4 +405,20 @@ class FileDiaLog extends BaseDialog
@trigger "resize"
fileview.set "showhidden", @data.hidden if @data and @data.hidden
this.OS.register "FileDiaLog", FileDiaLog
FileDialog.scheme = """
<afx-app-window width='400' height='300'>
<afx-hbox>
<afx-list-view data-id = "location" dropdown = "false" data-width = "120"></afx-list-view>
<afx-vbox>
<afx-file-view data-id = "fileview" view="tree" status = "false"></afx-file-view>
<input data-height = '26' type = "text" data-id = "filename" style="margin-left:5px; margin-right:5px;display:none;" />
<div data-height = '30' style=' text-align:right;padding:3px;'>
<afx-button data-id = "bt-ok" text = "__(Ok)"></afx-button>
<afx-button data-id = "bt-cancel" text = "__(Cancel)"></afx-button>
</div>
</afx-vbox>
</afx-hbox>
</afx-app-window>
"""
this.OS.register "FileDialog", FileDialog

View File

@ -91,7 +91,7 @@ Ant.OS or=
delete Ant.OS.announcer.observable
($ "#wrapper").empty()
Ant.OS.GUI.clearTheme()
Ant.OS.announcer.observable = riot.observable()
Ant.OS.announcer.observable = new Ant.OS.API.Announcer()
Ant.OS.announcer.quota = 0
Ant.OS.APP = {}
Ant.OS.setting =
@ -128,6 +128,7 @@ Ant.OS or=
.then (r) ->
Ant.OS.cleanup()
Ant.OS.API.handle.logout()
.then (d) -> Ant.OS.boot()
.catch (e) ->
console.error e

View File

@ -26,27 +26,6 @@ Ant.OS.GUI =
CTRL: {}
SHIFT: {}
META: {}
SYS_MENU: [
{
text: "",
iconclass: "fa fa-eercast",
dataid: "sys-menu-root",
children: [
{
text: "__(Applications)",
children: [],
dataid: "sys-apps"
iconclass: "fa fa-adn",
onchildselect: (d) ->
Ant.OS.GUI.launch d.data.item.get("data").name
}
],
onchildselect: (d) ->
id = d.data.item.get("data").dataid
return Ant.OS.exit() if id is "sys-logout"
return Ant.OS.GUI.toggleFullscreen() if id is "os-fullsize"
}
]
htmlToScheme: (html, app, parent) ->
scheme = $.parseHTML html
@ -80,20 +59,21 @@ Ant.OS.GUI =
Ant.OS.GUI.pushServices srvs
Ant.OS.GUI.pushService srvs[0]
openDialog: (d, f, title, data) ->
if Ant.OS.GUI.dialog
Ant.OS.GUI.dialog.show()
return
if not Ant.OS.GUI.subwindows[d]
ex = Ant.OS.API.throwe "Dialog"
return Ant.OS.announcer.oserror __("Dialog {0} not found", d), ex, null
Ant.OS.GUI.dialog = new Ant.OS.GUI.subwindows[d]()
Ant.OS.GUI.dialog.parent = Ant.OS.GUI
Ant.OS.GUI.dialog.handle = f
Ant.OS.GUI.dialog.pid = -1
Ant.OS.GUI.dialog.data = data
Ant.OS.GUI.dialog.title = title
Ant.OS.GUI.dialog.init()
openDialog: (d, data) ->
new Promise (resolve, reject) ->
if Ant.OS.GUI.dialog
Ant.OS.GUI.dialog.show()
return resolve()
if not Ant.OS.GUI.subwindows[d]
ex = Ant.OS.API.throwe "Dialog"
return reject(ex)
Ant.OS.GUI.dialog = new Ant.OS.GUI.subwindows[d]()
Ant.OS.GUI.dialog.parent = Ant.OS.GUI
Ant.OS.GUI.dialog.handle = resolve
Ant.OS.GUI.dialog.reject = reject
Ant.OS.GUI.dialog.pid = -1
Ant.OS.GUI.dialog.data = data
Ant.OS.GUI.dialog.init()
pushService: (ph) ->
arr = ph.split "/"
@ -213,7 +193,7 @@ Ant.OS.GUI =
app.applySetting m.data.m if (m.name is app.name)
toggleFullscreen: () ->
el = ($ "body")[0]
el = document.documentElement
if Ant.OS.GUI.fullscreen
return document.exitFullscreen() if document.exitFullscreen
return document.mozCancelFullScreen() if document.mozCancelFullScreen
@ -263,10 +243,11 @@ Ant.OS.GUI =
showTooltip: (el, text, e) ->
el = el[0]
label = ($ "#systooltip")[0]
$("#workspace").on "mousemove", (ev) ->
cb = (ev) ->
if $(ev.target).closest(el).length is 0
$(label).hide()
$("#workspace").off "mousemove"
$(document).off "mousemove", cb
$(document).on "mousemove", cb
arr = text.split /:(.+)/
tip = text
tip = arr[1] if arr.length > 1
@ -279,167 +260,139 @@ Ant.OS.GUI =
when "cr" # center right of the element
left = offset.left + w + 5
top = offset.top + h / 2 - $(label).height() / 2
$(label).css "top", top + "px"
.css "left", left + "px"
when "ct" #ceter top
left = offset.left + w / 2 - $(label).width() / 2
top = offset.top - $(label).height() - 5
else
return unless e
$(label).css "top", e.clientY + 5 + "px"
.css "left", e.clientX + 5 + "px"
top = e.clientY + 5
left = e.clientX + 5
$(label).css "top", top + "px"
.css "left", left + "px"
initDM: ->
# check login first
Ant.OS.API.resource("schemes/dm.html")
.then (x) ->
return null unless x
scheme = $.parseHTML x
($ "#wrapper").append scheme
scheme = $.parseHTML Ant.OS.GUI.schemes.ws
($ "#wrapper").append scheme
Ant.OS.announcer.observable.one "sysdockloaded", () ->
($ window).bind 'keydown', (event) ->
dock = ($ "#sysdock")[0]
return unless dock
app = dock.get "selectedApp"
#return true unless app
c = String.fromCharCode(event.which).toUpperCase()
fnk = undefined
if event.ctrlKey
fnk = "CTRL"
else if event.metaKey
fnk = "META"
else if event.shiftKey
fnk = "SHIFT"
else if event.altKey
fnk = "ALT"
Ant.OS.announcer.observable.one "sysdockloaded", () ->
($ window).bind 'keydown', (event) ->
dock = ($ "#sysdock")[0]
return unless dock
app = dock.get "selectedApp"
#return true unless app
c = String.fromCharCode(event.which).toUpperCase()
fnk = undefined
if event.ctrlKey
fnk = "CTRL"
else if event.metaKey
fnk = "META"
else if event.shiftKey
fnk = "SHIFT"
else if event.altKey
fnk = "ALT"
return unless fnk
r = if app then app.shortcut fnk, c, event else true
return event.preventDefault() if not r
return unless Ant.OS.GUI.shortcut[fnk]
return unless Ant.OS.GUI.shortcut[fnk][c]
Ant.OS.GUI.shortcut[fnk][c](event)
event.preventDefault()
# system menu and dock
$("#syspanel")[0].uify()
$("#sysdock")[0].uify()
$("#systooltip")[0].uify()
$("#contextmenu")[0].uify()
#riot.mount ($ "#syspanel", $ "#wrapper")
#riot.mount ($ "#sysdock", $ "#workspace"), { items: [] }
#riot.mount ($ "#systooltip", $ "#wrapper")
# context menu
#riot.mount ($ "#contextmenu", $ "#wrapper")
($ "#workspace").contextmenu (e) -> Ant.OS.GUI.bindContextMenu e
# tooltip
($ "#workspace").mouseover (e) ->
el = $(e.target).closest "[tooltip]"
return unless el.length > 0
Ant.OS.GUI.showTooltip el, ($(el).attr "tooltip"), e
# desktop default file manager
desktop = $ Ant.OS.GUI.workspace
desktop[0].fetch = () ->
fp = Ant.OS.setting.desktop.path.asFileHandle()
fn = () ->
fp.read().then (d) ->
return Ant.OS.announcer.osfail d.error, (Ant.OS.API.throwe "OS.VFS"), d.error if d.error
items = []
$.each d.result, (i, v) ->
return if v.filename[0] is '.' and not Ant.OS.setting.desktop.showhidden
v.text = v.filename
#v.text = v.text.substring(0,9) + "..." ifv.text.length > 10
v.iconclass = v.type
items.push(v)
desktop[0].set "data", items
desktop[0].refresh()
return unless fnk
r = if app then app.shortcut fnk, c, event else true
return event.preventDefault() if not r
return unless Ant.OS.GUI.shortcut[fnk]
return unless Ant.OS.GUI.shortcut[fnk][c]
Ant.OS.GUI.shortcut[fnk][c](event)
event.preventDefault()
# system menu and dock
$("#syspanel")[0].uify()
$("#sysdock")[0].uify()
$("#systooltip")[0].uify()
$("#contextmenu")[0].uify()
($ "#workspace").contextmenu (e) -> Ant.OS.GUI.bindContextMenu e
# tooltip
($ document).mouseover (e) ->
el = $(e.target).closest "[tooltip]"
return unless el.length > 0
Ant.OS.GUI.showTooltip el, ($(el).attr "tooltip"), e
# desktop default file manager
desktop = $ Ant.OS.GUI.workspace
desktop[0].fetch = () ->
fp = Ant.OS.setting.desktop.path.asFileHandle()
fn = () ->
fp.read().then (d) ->
return Ant.OS.announcer.osfail d.error, (Ant.OS.API.throwe "OS.VFS"), d.error if d.error
items = []
$.each d.result, (i, v) ->
return if v.filename[0] is '.' and not Ant.OS.setting.desktop.showhidden
v.text = v.filename
#v.text = v.text.substring(0,9) + "..." ifv.text.length > 10
v.iconclass = v.type
items.push(v)
desktop[0].set "data", items
desktop[0].refresh()
fp.onready()
.then () -> fn()
.catch ( e ) -> # try to create the path
console.log "#{fp.path} not found"
name = fp.basename
fp.parent().asFileHandle().mk(name).then (r) ->
ex = Ant.OS.API.throwe "OS.VFS"
if r.error then Ant.OS.announcer.osfail d.error, ex, d.error else fn()
desktop[0].ready = (e) ->
e.observable = Ant.OS.announcer
window.onresize = () ->
Ant.OS.announcer.trigger "desktopresize"
e.refresh()
fp.onready()
.then () -> fn()
.catch ( e ) -> # try to create the path
console.log "#{fp.path} not found"
name = fp.basename
fp.parent().asFileHandle().mk(name).then (r) ->
ex = Ant.OS.API.throwe "OS.VFS"
if r.error then Ant.OS.announcer.osfail d.error, ex, d.error else fn()
desktop[0].ready = (e) ->
e.observable = Ant.OS.announcer
window.onresize = () ->
Ant.OS.announcer.trigger "desktopresize"
e.refresh()
desktop[0].set "onlistselect", (d) ->
($ "#sysdock").get(0).set "selectedApp", null
desktop[0].set "onlistdbclick", ( d ) ->
($ "#sysdock").get(0).set "selectedApp", null
it = desktop[0].get "selectedItem"
Ant.OS.GUI.openWith it.get("data")
desktop[0].set "onlistselect", (d) ->
($ "#sysdock").get(0).set "selectedApp", null
desktop[0].set "onlistdbclick", ( d ) ->
($ "#sysdock").get(0).set "selectedApp", null
it = desktop[0].get "selectedItem"
Ant.OS.GUI.openWith it.get("data")
#($ "#workingenv").on "click", (e) ->
# desktop[0].set "selected", -1
#($ "#workingenv").on "click", (e) ->
# desktop[0].set "selected", -1
desktop.on "click", (e) ->
return unless e.target.tagName.toUpperCase() is "UL"
desktop[0].unselect()
($ "#sysdock").get(0).set "selectedApp", null
desktop[0].contextmenuHandle = (e, m) ->
desktop[0].unselect() if e.target.tagName.toUpperCase() is "UL"
($ "#sysdock").get(0).set "selectedApp", null
menu = [
{ text: __("Open"), dataid: "desktop-open" },
{ text: __("Refresh"), dataid: "desktop-refresh" }
]
menu = menu.concat ( v for k, v of Ant.OS.setting.desktop.menu)
m.set "items", menu
m.set "onmenuselect", (evt) ->
item = evt.data.item.get("data")
switch item.dataid
when "desktop-open"
it = desktop[0].get "selectedItem"
return Ant.OS.GUI.openWith it.get("data") if it
it = Ant.OS.setting.desktop.path.asFileHandle()
it.mime = "dir"
Ant.OS.GUI.openWith it
when "desktop-refresh"
desktop[0].fetch()
else
Ant.OS.GUI.launch item.app, item.args if item.app
m.show(e)
desktop[0].fetch()
Ant.OS.announcer.observable.on "VFS", (d) ->
desktop[0].fetch() if d.data.file.hash() is fp.hash() or d.data.file.parent().hash() is fp.hash()
Ant.OS.announcer.ostrigger "desktoploaded"
# mount it
desktop[0].uify()
# riot.mount desktop
.catch (e) ->
console.log e
alert __("System fail: Cannot init desktop manager")
desktop.on "click", (e) ->
return unless e.target.tagName.toUpperCase() is "UL"
desktop[0].unselect()
($ "#sysdock").get(0).set "selectedApp", null
desktop[0].contextmenuHandle = (e, m) ->
desktop[0].unselect() if e.target.tagName.toUpperCase() is "UL"
($ "#sysdock").get(0).set "selectedApp", null
menu = [
{ text: __("Open"), dataid: "desktop-open" },
{ text: __("Refresh"), dataid: "desktop-refresh" }
]
menu = menu.concat ( v for k, v of Ant.OS.setting.desktop.menu)
m.set "items", menu
m.set "onmenuselect", (evt) ->
item = evt.data.item.get("data")
switch item.dataid
when "desktop-open"
it = desktop[0].get "selectedItem"
return Ant.OS.GUI.openWith it.get("data") if it
it = Ant.OS.setting.desktop.path.asFileHandle()
it.mime = "dir"
Ant.OS.GUI.openWith it
when "desktop-refresh"
desktop[0].fetch()
else
Ant.OS.GUI.launch item.app, item.args if item.app
m.show(e)
desktop[0].fetch()
Ant.OS.announcer.observable.on "VFS", (d) ->
desktop[0].fetch() if d.data.file.hash() is fp.hash() or d.data.file.parent().hash() is fp.hash()
Ant.OS.announcer.ostrigger "desktoploaded"
# mount it
desktop[0].uify()
refreshDesktop: () ->
($ Ant.OS.GUI.workspace)[0].fetch()
refreshSystemMenu: () ->
Ant.OS.GUI.SYS_MENU[0].children.length = 1
Ant.OS.GUI.SYS_MENU[0].children[0].children.length = 0
Ant.OS.GUI.SYS_MENU[0].children[0].children.push v for k, v of Ant.OS.setting.system.packages when (v and v.app)
Ant.OS.GUI.SYS_MENU[0].children.push v for k, v of Ant.OS.setting.system.menu
Ant.OS.GUI.SYS_MENU[0].children.push
text: "__(Toggle Full screen)",
dataid: "os-fullsize",
iconclass: "fa fa-tv"
Ant.OS.GUI.SYS_MENU[0].children.push
text: "__(Log out)",
dataid: "sys-logout",
iconclass: "fa fa-user-times"
# Ant.OS.GUI.buildSystemMenu()
buildSystemMenu: () ->
($ "[data-id = 'osmenu']", "#syspanel")[0].set "items", Ant.OS.GUI.SYS_MENU
#console.log menu
mkdialog: (conf) ->
return new Ant.OS.GUI.BasicDialog conf.name, conf.layout
@ -455,7 +408,8 @@ Ant.OS.GUI =
password: ($ "#txtpass").val()
Ant.OS.API.handle.login data
.then (d) ->
if d.error then ($ "#login_error").html d.error else Ant.OS.GUI.startAntOS d.result
return ($ "#login_error").html d.error if d.error
Ant.OS.GUI.startAntOS d.result
.catch (e) ->
($ "#login_error").html "Login: server error"
($ "#txtpass").keyup (e) ->
@ -489,8 +443,8 @@ Ant.OS.GUI =
v.icon = "#{v.path}/#{v.icon}" if v.icon
v.iconclass = "fa fa-adn" unless v.iconclass or v.icon
Ant.OS.setting.system.packages = if r.result then r.result else
Ant.OS.GUI.refreshSystemMenu()
Ant.OS.GUI.buildSystemMenu()
# Ant.OS.GUI.refreshSystemMenu()
# Ant.OS.GUI.buildSystemMenu()
# push startup services
# TODO: get services list from user setting
Ant.OS.GUI.pushServices (v for v in Ant.OS.setting.system.startup.services)
@ -499,4 +453,19 @@ Ant.OS.GUI =
# initDM
Ant.OS.API.setLocale Ant.OS.setting.system.locale
.then () ->
Ant.OS.GUI.initDM()
Ant.OS.GUI.initDM()
Ant.OS.GUI.schemes = {}
Ant.OS.GUI.schemes.ws = """
<afx-sys-panel id = "syspanel"></afx-sys-panel>
<div id = "workspace">
<afx-apps-dock id="sysdock"></afx-apps-dock>
<afx-float-list id = "desktop" dir="vertical" ></afx-float-list>
</div>
<afx-menu id="contextmenu" data-id="contextmenu" context="true" style="display:none;"></afx-menu>
<afx-label id="systooltip" data-id="systooltip" style="display:none;position:absolute;"></afx-label>
"""
Ant.OS.GUI.schemes.login = """
"""

View File

@ -1,11 +0,0 @@
<afx-app-window data-id = 'about-window' width='300' height='200'>
<afx-vbox>
<div style="text-align:center; margin-top:10px;" data-height="50">
<h3 style = "margin:0;padding:0;">
<afx-label data-id = 'mylabel'></afx-label>
</h3>
<i><p style = "margin:0; padding:0" data-id = 'mydesc'></p></i>
</div>
<afx-grid-view data-id = 'mygrid'></afx-grid-view>
</afx-vbox>
</afx-app-window>

View File

@ -1,10 +1,8 @@
<afx-sys-panel id = "syspanel"></afx-sys-panel>
<!--div class = "afx-clear"></div-->
<div id = "workspace">
<afx-apps-dock id="sysdock"></afx-apps-dock>
<afx-float-list id = "desktop" dir="vertical" ></afx-float-list>
<!--div id = "workingenv"></div-->
</div>
<afx-menu id="contextmenu" data-id="contextmenu" context="true" style="display:none;"></afx-menu>
<afx-label id="systooltip" data-id="systooltip" style="display:none;position:absolute;"></afx-label>

View File

@ -1,13 +0,0 @@
<afx-app-window data-id = 'file-dialog-window' width='400' height='300'>
<afx-hbox>
<afx-list-view data-id = "location" dropdown = "false" data-width = "120"></afx-list-view>
<afx-vbox>
<afx-file-view data-id = "fileview" view='tree' status = false></afx-file-view>
<input data-height = '26' type = "text" data-id = "filename" style="margin-left:5px; margin-right:5px;display:none;" />
<div data-height = '30' style=' text-align:right;padding:3px;'>
<afx-button data-id = "bt-ok" text = "__(Ok)"></afx-button>
<afx-button data-id = "bt-cancel" text = "__(Cancel)"></afx-button>
</div>
</afx-vbox>
</afx-hbox>
</afx-app-window>

View File

@ -44,9 +44,7 @@
Ant.OS.setting.system.startup = {
services: [
"CoreServices/PushNotification",
"CoreServices/UserService",
"CoreServices/Calendar",
"CoreServices/Spotlight"
"CoreServices/Calendar"
],
apps: []
} if not Ant.OS.setting.system.startup

View File

@ -109,7 +109,6 @@ class CalendarTag extends Ant.OS.GUI.BaseTag
for i in [ 0..7 - row.length ]
row.push { text: "" }
rows.push(row)
console.log rows
@refs.grid.set "rows", rows
@refs.mlbl.set "text", "#{months[@month]} #{@year}"

View File

@ -4,12 +4,12 @@ class FileViewTag extends Ant.OS.GUI.BaseTag
@setopt "onfileselect", ()->
@setopt "onfileopen", () ->
@setopt "selectedFile", undefined
@setopt "view", "list"
@setopt "data", []
@setopt "status", true
@setopt "showhidden", false
@setopt "fetch", undefined
@setopt "path", undefined
@setopt "view", "list"
@preventUpdate = false
@header = [
{ text: "__(File name)" },
@ -22,6 +22,10 @@ class FileViewTag extends Ant.OS.GUI.BaseTag
__view__: (v) ->
@switchView()
__status__: (v) ->
return $(@refs.status).show() if v
$(@refs.status).hide()
__path__: (v) ->
return unless v
me = @
@ -147,6 +151,7 @@ class FileViewTag extends Ant.OS.GUI.BaseTag
e.filename,
if e.size then e.size else "0" )
evt = { id: @aid(), data: e }
@set "selectedFile", e
@get("onfileselect") evt
@observable.trigger "fileselect", evt
@ -183,78 +188,14 @@ class FileViewTag extends Ant.OS.GUI.BaseTag
@refs.treeview.set "ontreedbclick", (e) ->
me.filedbclick e.data.item.get("data")
@switchView()
### self.refs.listview.onlistselect = function(data)
{
data.id = self.rid
self.root.observable.trigger("fileselect",data)
}
self.refs.listview.onlistdbclick = function(data)
{
data.id = self.rid
self.root.observable.trigger("filedbclick",data)
}
self.refs.gridview.root.observable = self.root.observable
self.refs.gridview.ongridselect = function(d)
{
var data = {id:self.rid, data:self.data[d.data.child[3].idx], idx:d.data.child[3].idx}
self.root.observable.trigger("fileselect",data)
}
self.refs.gridview.ongriddbclick = function(d)
{
var data = {id:self.rid, data:self.data[d.data.child[3].idx], idx:d.data.child[3].idx}
self.root.observable.trigger("filedbclick",data)
}
self.refs.treeview.ontreeselect = function(d)
{
if(!d) return;
var data;
var el = d;
if(d.treepath == 0)// select the root
{
el = self.path.asFileHandler()
el.size = 0
el.filename = el.path
}
var data = {id:self.rid, data:el}
self.root.observable.trigger("fileselect",data)
}
self.refs.treeview.ontreedbclick = function(d)
{
if(!d || d.treepath == 0) return;
var data = {id:self.rid, data:d}
self.root.observable.trigger("filedbclick",data)
}
self.root.observable.on("fileselect", function(e){
if(e.id != self.rid) return
self.selectedFile = e.data
if(self.onfileselect)
self.onfileselect(e.data)
if(self.refs.stbar)
self.refs.stbar.root.set("text", __("Selected: {0} ({1} bytes)", e.data.filename, e.data.size?e.data.size:"0"))//.html()
})
self.root.observable.on("filedbclick", function(e){
if(e.id != self.rid ) return
if(e.data.type != "dir" && self.onfileopen)
self.onfileopen(e.data)
else if(self.chdir && e.data.type == "dir")
self.chdir(e.data.path)
})
calibre_size()
self.root.observable.on("resize", function(e){
calibre_size()
})
self.root.observable.on("calibrate", function(e){
calibre_size()
})
}) ###
layout: () ->
[
{ el: "afx-list-view", ref: "listview" },
{ el: "afx-grid-view", ref: "gridview" },
{ el: "div", class: "treecontainer", ref: "treecontainer", children: [
{ el: "afx-tree-view", ref: "treeview" }
] },
{ el: "afx-grid-view", ref: "gridview" },
{ el: "afx-label", class: "status", ref: "status" }
]

View File

@ -172,8 +172,6 @@ class GridViewTag extends Ant.OS.GUI.BaseTag
me = @
$(@root)
.css "overflow", "hidden"
.css "display", "block"
.css "padding", "5px"
$(@refs.grid).css "display", "grid"
$(@refs.header).css "display", "grid"

View File

@ -4,12 +4,17 @@ class LabelTag extends Ant.OS.GUI.BaseTag
@setopt "color", undefined
@setopt "icon", undefined
@setopt "iconclass", undefined
@setopt "class", undefined
@refs.text = document.createTextNode ""
$(@refs.container).append @refs.text
@setopt "text", ""
mount: () ->
__class__: (v) ->
$(@root).removeClass()
$(@root).addClass v if v
__color__: (v) ->
return unless v
$(@refs.container).css "color", v
@ -29,6 +34,7 @@ class LabelTag extends Ant.OS.GUI.BaseTag
$(@refs.iclass).removeClass()
if v
$(@refs.iclass).addClass v
$(@refs.iclass).css "margin-right", "5px"
$(@refs.iclass).show()
else
$(@refs.iclass).hide()

View File

@ -76,6 +76,7 @@ class ListViewTag extends Ant.OS.GUI.BaseTag
@setopt "multiselect", false
@setopt "selectedItem", undefined
@setopt "selectedItems", []
@setopt "selected", -1
$(@root)
.css "display", "flex"
.css "flex-direction", "column"
@ -84,6 +85,8 @@ class ListViewTag extends Ant.OS.GUI.BaseTag
@root.remove = (e) -> me.remove e
@root.unshift = (e) -> me.unshift e
@root.unselect = () -> me.unselect()
@root.selectNext = () -> me.selectNext()
@root.selectPrev = () -> me.selectPrev()
multiselect: () ->
return false if @get "dropdown"
@ -130,6 +133,26 @@ class ListViewTag extends Ant.OS.GUI.BaseTag
data.splice data.indexOf(el), 1
$(item).remove()
selectNext: () ->
return if @multiselect()
el = @get "selectedItem"
idx = 0
idx = $(el).index() + 1 if el
@set "selected", idx
selectPrev: () ->
return if @multiselect()
el = @get "selectedItem"
idx = 0
idx = $(el).index() - 1 if el
@set "selected", idx
__selected__: (idx) ->
return @unselect() if idx < 0
data = @get "data"
return if idx >= data.length
data[idx].domel.set "selected", true
__buttons__: (v) ->
return if @get "dropdown"

View File

@ -1,24 +1,34 @@
class OverlayTag extends Ant.OS.GUI.BaseTag
constructor: (r, o) ->
super r, o
@setopt "width", 200
@setopt "height", 400
@setopt "width", undefined
@setopt "height", undefined
$(@refs.yield)
.css("position", "relative")
.css("width", "100%" )
.css("height", "100%")
$(@root)
.css("position", "absolute")
.css "z-index", 1000000
#.css "display", "flex"
#.css "flex-direction", "column"
#$(@refs.yield).css "flex", "1"
__width__: (v) ->
return unless v
@calibrate()
__height__: (v) ->
return unless v
@calibrate()
mount: () ->
$(@root)
.css("position", "absolute")
@calibrate()
calibrate: () ->
$(@root)
.css("width", @get("width") + "px")
.css("height", @get("height") + "px")
.css("width", @get("width") )
.css("height", @get("height"))
@observable.trigger "resize", {
id: @aid(),
data: {
@ -28,6 +38,7 @@ class OverlayTag extends Ant.OS.GUI.BaseTag
}
layout: () ->
@refs.yield = @roots
[]
[{
el: "afx-vbox", ref: "yield"
}]
Ant.OS.GUI.define "afx-overlay", OverlayTag

View File

@ -2,11 +2,15 @@ class SystemPanelTag extends Ant.OS.GUI.BaseTag
constructor: (r, o) ->
super r, o
me = @
@setopt "osmenu", { children: [] }
@setopt "osmenu", {
text: __("Start"),
iconclass: "fa fa-eercast"
}
@setopt "appmenu", []
@setopt "systray", []
@root.attachservice = (s) -> me.attachservice s
@root.detachservice = (s) -> me.detachservice s
@view = false
__osmenu__: (v) ->
@refs.osmenu.set "items", [v]
@ -15,28 +19,144 @@ class SystemPanelTag extends Ant.OS.GUI.BaseTag
@refs.appmenu.set "items", v
__systray__: (v) ->
@refs.systray.set "items", [v]
@refs.systray.set "items", v
attachservice: (s) ->
@refs.systray.unshift s
s.attach @refs.systray
open: () ->
el = @refs.applist.get "selectedItem"
return unless el
data = el.get("data")
return if not data or data.dataid is "header"
@toggle false
# launch the app or open the file
Ant.OS.GUI.openWith data
search: (e) ->
switch e.which
when 37
e.preventDefault()
when 38
@refs.applist.selectPrev()
e.preventDefault()
when 39
e.preventDefault()
when 40
@refs.applist.selectNext()
e.preventDefault()
when 13
e.preventDefault()
@open()
else
text = @refs.search.value
return @refreshAppList() unless text.length >= 3
result = Ant.OS.API.search text
return if result.length is 0
@refs.applist.set "data", result
detachservice: (s) ->
@refs.systray.remove s
@refs.systray.remove s.domel
layout: () ->
[{
el: "div", children: [
{ el: "afx-menu", id: "osmenu", ref: "osmenu", class: "afx-panel-os-menu" },
{ el: "afx-menu", id: "appmenu", ref: "appmenu", class: "afx-panel-os-app" },
{ el: "afx-menu", id: "systray", ref: "systray", class: "afx-panel-os-stray" }
]
}]
[
{
el: "div", ref: "panel", children: [
{ el: "afx-menu", ref: "osmenu", class: "afx-panel-os-menu" },
{ el: "afx-menu", id: "appmenu", ref: "appmenu", class: "afx-panel-os-app" },
{ el: "afx-menu", id: "systray", ref: "systray", class: "afx-panel-os-stray" }
]
},
{
el: "afx-overlay", id: "start-panel", ref: "overlay", children: [
{
el: "afx-hbox", height: 30, children: [
{ el: "div", width: 30, id: "searchicon" },
{ el: "input", ref: "search" }
]
},
{ el: "afx-list-view", id: "applist", ref: "applist" },
{
el: "afx-hbox", id: "btlist", height: 30, children: [
{
el: "afx-button",
ref: "btscreen",
tooltip: __("ct:Toggle fullscreen")
},
{
el: "afx-button",
ref: "btuser",
tooltip: __("ct:User: {0}", Ant.OS.setting.user.username)
},
{ el: "afx-button", ref: "btlogout", tooltip: __("ct:Logout") }
]
}
]
}
]
refreshAppList: () ->
list = []
list.push v for k, v of Ant.OS.setting.system.packages when (v and v.app)
list.push v for k, v of Ant.OS.setting.system.menu
@refs.applist.set "data", list
toggle: (flag) ->
if flag
@refreshAppList()
$(@refs.overlay).show()
@calibrate()
$(document).on "click", @cb
@refs.search.value = ""
$(@refs.search).focus()
else
$(@refs.overlay).hide()
$(document).unbind "click", @cb
calibrate: () ->
@refs.overlay.set "height", "#{$(window).height() - $(@refs.panel).height()}px"
mount: () ->
$(@refs.osmenu).css("z-index", 1000000)
me = @
@cb = (e) ->
if not ($ e.target).closest($ me.refs.overlay).length and not ($ e.target).closest(me.refs.osmenu).length
me.toggle false
else
$(me.refs.search).focus()
$(@refs.appmenu).css("z-index", 1000000)
$(@refs.systray).css("z-index", 1000000)
@refs.btscreen.set "*", {
iconclass: "fa fa-tv",
onbtclick: (e) ->
me.toggle false
Ant.OS.GUI.toggleFullscreen()
}
@refs.btuser.set "*", {
iconclass: "fa fa-user-circle-o",
onbtclick: (e) ->
me.toggle false
Ant.OS.GUI.openDialog("InfoDialog", Ant.OS.setting.user)
}
@refs.btlogout.set "*", {
iconclass: "fa fa-power-off",
onbtclick: (e) ->
me.toggle false
Ant.OS.exit()
}
@refs.osmenu.set "onmenuselect", (e) ->
me.toggle true
($ @refs.overlay).css "left", 0
.css "top", "#{$(@refs.panel).height()}px"
.css "bottom", "0"
.hide()
($ @refs.search).keyup (e) ->
me.search e
$(@refs.applist).click (e) ->
me.open()
Ant.OS.announcer.trigger("syspanelloaded")
Ant.OS.GUI.define "afx-sys-panel", SystemPanelTag

View File

@ -15,9 +15,10 @@ class Ant.OS.GUI.BaseTag
@root.sync = () -> me.sync()
@refs = {}
@setopt "data-id", (Math.floor(Math.random() * 100000) + 1).toString()
@setopt "tooltip", undefined
#$(@root).attr "data-id", @get("data-id")
@children = $(@root).children()
for obj in @layout()
dom = @mkui obj
if dom
@ -32,6 +33,10 @@ class Ant.OS.GUI.BaseTag
@set k, v if v
@get k
__tooltip__: (v) ->
return unless v
$(@root).attr "tooltip", v
setopt: (name, val) ->
value = val
if ($(@root).attr name)
@ -78,6 +83,9 @@ class Ant.OS.GUI.BaseTag
dom = $("<#{tag.el}>")
$(dom).addClass tag.class if tag.class
$(dom).attr "data-id", tag.id if tag.id
$(dom).attr "data-height", tag.height if tag.height
$(dom).attr "data-width", tag.width if tag.width
$(dom).attr "tooltip", tag.tooltip if tag.tooltip
if tag.children
$(@mkui(v)).appendTo(dom) for v in tag.children
if tag.ref

View File

@ -27,8 +27,6 @@
<link id="ostheme" rel="stylesheet" href="">
<!--link href="theme/antos/style.css" rel="stylesheet"-->
<script src="scripts/jquery-3.2.1.min.js"></script>
<script src="resources/antos_tags.js" type="riot/tag"></script>
<script src="scripts/riot.compiler.min.js"> </script>
<script src="scripts/antos.js"></script>
</head>
<body>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -24,18 +24,34 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication
me = @
@scheme.set "apptitle", "Activity Monitor"
@grid = @find "mygrid"
@on "btclick", (e)->
@on "btclick", (e) ->
return unless e.id == "btkill"
item = me.grid.get "selected"
return unless item
app = _PM.appByPid item[0].value
app.quit(true) if app
header = [{width:50,value: "__(Pid)"},{value:"__(Name)"}, {value:"__(Type)", width:80},{width:75,value: "__(Alive (ms))"}]
@gdata =
processes:{}
alive:[]
@grid.set "header",header
header = [
{
width: 50,
text: "__(Pid)"
},
{
text: "__(Name)"
},
{
text: "__(Type)",
width: 80
},
{
width: 75,
text: "__(Alive (ms))"
}
]
@gdata =
processes: {}
alive: []
@grid.set "header", header
@monitor()
monitor: () ->
@ -43,34 +59,40 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication
#get all current running process
me.gdata.alive = []
now = (new Date).getTime()
$.each _PM.processes, (i,d)->
$.each d , (j,a)->
$.each _PM.processes, (i, d) ->
$.each d , (j, a) ->
if me.gdata.processes[a.pid] #update it
me.gdata.processes[a.pid][3].value = now - a.birth
else #add it
me.gdata.processes[a.pid] = [
{value:a.pid},
{icon:if _APP[a.name].type == 1 then _APP[a.name].meta.icon else a.icon,
iconclass:if _APP[a.name].type == 1 then _APP[a.name].meta.iconclass else a.iconclass,
value:a.name},
{value: if _APP[a.name].type == 1 then "__(Application)" else "__(Service)"}
{value: now - a.birth}
{ text: a.pid },
{
icon: if _APP[a.name].type == 1 then _APP[a.name].meta.icon else a.icon,
iconclass: if _APP[a.name].type == 1 then _APP[a.name].meta.iconclass else a.iconclass,
text: a.name
},
{
text: if _APP[a.name].type == 1 then "__(Application)" else "__(Service)"
}
{
text: now - a.birth
}
]
me.gdata.alive.push a.pid
me.gdata.alive.push a.pid
@refreshGrid()
@timer = setTimeout (()-> me.monitor()),500#one second
@timer = setTimeout (() -> me.monitor()), 500
refreshGrid: ()->
refreshGrid: () ->
activeList = []
me = @
$.each @gdata.processes, (i,e) ->
if ($.inArray (Number i),me.gdata.alive) >= 0
$.each @gdata.processes, (i, e) ->
if ($.inArray (Number i), me.gdata.alive) >= 0
activeList.push e
else
else
me.gdata.processes[i] = undefined
@grid.set "rows",activeList
@grid.set "rows", activeList
cleanup: (e) ->
clearTimeout @timer if @timer
ActivityMonitor.singleton = true
this.OS.register "ActivityMonitor",ActivityMonitor
this.OS.register "ActivityMonitor", ActivityMonitor

View File

@ -1,4 +1,4 @@
coffee_files = Calendar.coffee PushNotification.coffee Spotlight.coffee UserService.coffee
coffee_files = Calendar.coffee PushNotification.coffee
jsfiles =

View File

@ -25,8 +25,6 @@ class PushNotification extends this.OS.GUI.BaseService
init: ->
@view = false
@_gui.htmlToScheme PushNotification.scheme, @, @host
#path = path = "#{@meta().path}/notifications.html"
#@render path
spin: (b) ->
if b and @iconclass is "fa fa-bars"
@ -60,24 +58,19 @@ class PushNotification extends this.OS.GUI.BaseService
i = me.pending.indexOf o.id
me.pending.splice i, 1 if i >= 0
me.spin false if me.pending.length is 0
@nzone.set "height", "100%"
@fzone.set "height", "100%"
($ @nzone).css "right", 0
.css "top", "-3px"
.css "height", "100%"
.css "bottom", "0"
.css "z-index", 1000000
.css "display", "flex"
.css "flex-direction", "column"
.hide()
($ @mlist).css "flex", "1"
($ @fzone)
#.css("z-index", 99999)
.css("bottom", "0")
.css("height", "100%")
.css "display", "flex"
.css "flex-direction", "column"
.css "bottom", "0"
.hide()
($ @mfeed).css "flex", "1"
pushout: (s, o, mfeed) ->
d = {
@ -96,6 +89,7 @@ class PushNotification extends this.OS.GUI.BaseService
($ @fzone).show()
timer = setTimeout () ->
me.mfeed.remove d.domel
($ me.fzone).hide() if me.mfeed.get("data").length is 0
clearTimeout timer
, 3000
@ -117,9 +111,9 @@ class PushNotification extends this.OS.GUI.BaseService
cleanup: (evt) ->
# do nothing
PushNotification.scheme = """
<divs>
<afx-overlay data-id = "notifyzone" width = "250">
<afx-button text = "__(Clear all)" data-id = "btclear" ></afx-button>
<div>
<afx-overlay data-id = "notifyzone" width = "250px">
<afx-button text = "__(Clear all)" data-id = "btclear" data-height="30"></afx-button>
<afx-list-view data-id="notifylist"></afx-list-view>
</afx-overlay>
<afx-overlay data-id = "feedzone" width = "250">

View File

@ -1,134 +0,0 @@
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
# AnTOS Web desktop is is licensed under the GNU General Public
# License v3.0, see the LICENCE file for more information
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
#along with this program. If not, see https://www.gnu.org/licenses/.
class SpotlightDialog extends this.OS.GUI.BaseDialog
constructor: () ->
super "SpotlightDialog"
init: () ->
#@render "#{@path()}/spotlight.html"
@_gui.htmlToScheme SpotlightDialog.scheme, @, @host
main: () ->
me = @
@height = ($ @scheme).css("height")
@container = @find "container"
($ @scheme).css("height", "45px")
@fn = (e) ->
if e.which is 27
($ document).unbind "click", me.fn1
($ document).unbind "keyup", me.fn
me.handler(e) if me.handler
me.quit()
($ document).keyup @fn
@fn1 = (e) ->
return if $(e.target).closest(me.parent.holder).length
if not $(e.target).closest(me.scheme).length
($ document).unbind "click", me.fn1
($ document).unbind "keyup", me.fn
me.handler(e) if me.handler
me.quit()
($ document).click @fn1
@searchbox = @find "searchbox"
($ @searchbox).focus()
($ @searchbox).keyup (e) ->
me.search e
@container.set "onlistdbclick", (e) ->
return if e.data.dataid and e.data.dataid is "header"
me.handler(e) if me.handler
me._gui.openWith e.data
($ document).unbind "click", me.fn1
($ document).unbind "keyup", me.fn
me.quit()
search: (e) ->
switch e.which
when 37
e.preventDefault()
when 38
@container.selectPrev()
e.preventDefault()
when 39
e.preventDefault()
when 40
@container.selectNext()
e.preventDefault()
when 13
e.preventDefault()
sel = @container.get "selected"
return unless sel
return if sel.dataid and sel.dataid is "header"
@.handler(e) if @.handler
@._gui.openWith sel
($ document).unbind "click", @fn1
($ document).unbind "keyup", @fn
@.quit()
else
text = @searchbox.value
($ @scheme).css("height", "45px")
return unless text.length >= 3
result = @_api.search text
return if result.length is 0
@container.set "data", result
console.log result
($ @scheme).css("height", @height)
SpotlightDialog.scheme = """
<afx-app-window data-id = "spotlight-win"
apptitle="" minimizable="false"
resizable = "false" width="500" height="300">
<afx-vbox>
<afx-hbox data-height="45">
<div data-id = "searchicon" data-width="45"></div>
<input type = "text" data-id="searchbox"/>
</afx-hbox>
<afx-list-view data-id="container"></afx-list-view>
</afx-vbox>
</afx-app-window>
"""
this.OS.register "SpotlightDialog", SpotlightDialog
class Spotlight extends this.OS.GUI.BaseService
constructor: (args) ->
super "Spotlight", args
@iconclass = "fa fa-search"
@show = false
init: ->
me = @
@_gui.bindKey "CTRL- ", (e) ->
me.awake(e)
main: ->
awake: (e) ->
me = @
if not @show
me.show = true
@openDialog "SpotlightDialog", (d) ->
me.show = false
me.dialog = undefined
else
me.show = false
@dialog.quit() if @dialog
cleanup: (evt) ->
# do nothing
this.OS.register "Spotlight", Spotlight

View File

@ -1,45 +0,0 @@
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
# AnTOS Web desktop is is licensed under the GNU General Public
# License v3.0, see the LICENCE file for more information
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
#along with this program. If not, see https://www.gnu.org/licenses/.
class UserService extends this.OS.GUI.BaseService
constructor: (args) ->
super "UserService", args
@text = @systemsetting.user.username
@iconclass = undefined
me = @
@children = [
{
text: "__(About)", dataid: "user-about",
iconclass: "fa fa-user-circle-o"
},
{
text: "__(Logout)", dataid: "sys-logout",
iconclass: "fa fa-user-times",
onmenuselect: (d) ->
me.notify __("This feature is not implemented yet")
}
]
init: ->
awake: (e) ->
cleanup: (evt) ->
this.OS.register "UserService", UserService

View File

@ -48,53 +48,4 @@ afx-list-view[data-id = "notifeed"] li{
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word;
}
afx-app-window[data-id = "spotlight-win"] .afx-window-wrapper{
background-color: white;
border-radius: 0px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
afx-app-window[data-id = "spotlight-win"] .afx-window-top{
height: 0;
border:0;
}
afx-app-window[data-id = "spotlight-win"] input{
border:0;
font-size: 25px;
color:#afafaf;
height: 45px;
}
afx-app-window[data-id = "spotlight-win"] div[data-id="searchicon"]:before{
content: "\f002";
padding-top:5px;
padding-left: 10px;
display: block;
background-color: #F6F6F6;
color:#afafaf;
width:40px;
height: 40px;
font-family: "FontAwesome";
font-size: 30px;
}
afx-app-window[data-id = "spotlight-win"] .afx-window-content{
border-radius: 10px;
}
afx-app-window[data-id = "spotlight-win"] afx-list-view[data-id="container"]{
border-top:1px solid #cacaca;
}
afx-app-window[data-id = "spotlight-win"] afx-list-view[data-id="container"] afx-label.search-header{
font-weight: bold;
}
afx-app-window[data-id = "spotlight-win"] afx-resizer{
background-color: transparent;
border-left: 1px solid #cacaca;
}
afx-app-window[data-id = "spotlight-win"] afx-list-view[data-id="container"] ul.complex-content li{
/*padding-left: 20px;*/
font-style: italic;
color: #b1b1b1;
font-size: 11px;
}

View File

@ -1,6 +1,6 @@
{
"app":null,
"services": [ "Calendar", "PushNotification", "Spotlight", "UserService" ],
"services": [ "Calendar", "PushNotification" ],
"name":"CoreServices",
"description":"This is the core services",
"info":{

View File

@ -27,18 +27,13 @@
</afx-hbox>
</afx-vbox>
</afx-hbox>
<afx-hbox tabname="Virtual desktop">
<afx-float-list data-id = "flist"/>
</afx-hbox>
<afx-hbox tabname="Calendar">
<afx-hbox tabname="Calendar & color picker">
<afx-calendar-view data-id = "cal"/>
</afx-hbox>
<afx-hbox tabname="Color picker">
<afx-color-picker data-id = "cpk"/>
</afx-hbox>
<afx-hbox tabname="File view">
<afx-vbox>
<afx-file-view data-id = "fileview"/>
<afx-file-view data-id = "fileview" view="icon" />
<afx-list-view data-id = "viewoption" data-height="30" dropdown="true" />
</afx-vbox>
</afx-hbox>

View File

@ -114,14 +114,6 @@ class ShowCase extends this.OS.GUI.BaseApplication
slider.set "onchanging", (v) ->
console.log v
flist = @find 'flist'
flist.set "data", [
{ text: "File.txt" },
{ text: "FileB.doc" },
{ text: "Data.doc", iconclass: "fa fa-camera-retro fa-lg" }
]
cal = @find 'cal'
cal.set "ondateselect", (e) ->
console.log e
@ -220,6 +212,15 @@ class ShowCase extends this.OS.GUI.BaseApplication
when "about"
me.openDialog("AboutDialog" )
.then (d) ->
when "file"
me.openDialog("FileDialog", {
title: "Select file ?",
#root: "home:///",
mimes: ["text/*", "dir"],
file: "Untitled".asFileHandle()
})
.then (f, name) ->
console.log f, name
else return

View File

@ -1,14 +0,0 @@
afx-app-window[data-id="example-show-case"] afx-grid-view div.afx-grid-row:nth-child(even) .afx-grid-cell
{
background-color: #f5F5F5;
}
afx-app-window[data-id="example-show-case"] afx-grid-view div.afx-grid-row-selected .afx-grid-cell
{
background-color: #116cd6;
color:white;
}
afx-app-window[data-id="example-show-case"] afx-grid-view div.afx-grid-row-selected .afx-grid-cell-selected
{
font-weight: bold;
}

View File

@ -1,6 +1,10 @@
afx-label i.icon-style {
width: 16px;
height: 16px;
display: inline-block;
float: left;
}
afx-label i
{
margin-right: 3px;
}

View File

@ -3,7 +3,7 @@ afx-sys-panel{
padding:0;
margin: 0;
}
afx-sys-panel div{
afx-sys-panel > div{
width: 100%;
height: 23px;
margin:0;
@ -13,11 +13,21 @@ afx-sys-panel div{
box-shadow: 1px 1px 1px #9F9F9F;
position:absolute;
}
afx-sys-panel .afx-panel-os-menu{
afx-sys-panel .afx-panel-os-menu {
padding:0;
margin: 0;
float:left;
}
afx-sys-panel .afx-panel-os-menu li
{
font-weight: bold;
background-color: #e7414d;
border-top-right-radius: 9px;
border-bottom-right-radius: 9px;
}
afx-sys-panel .afx-panel-os-menu a {
color: white;
}
afx-sys-panel .afx-panel-os-stray{
float:right;
position: relative;
@ -56,4 +66,68 @@ afx-sys-panel afx-menu.afx-panel-os-stray afx-menu ul{
}
afx-sys-panel afx-menu.afx-panel-os-stray afx-menu li{
min-width: 150px;
}
afx-sys-panel afx-overlay
{
background-color: #e7e7e7;
overflow-y: auto;
overflow-x: hidden;
border: 1px solid #9c9C9C;
width: 250px;
margin: 0;
}
afx-sys-panel afx-list-view[data-id="applist"]
{
border-top: 1px solid #afafaf;
border-bottom: 1px solid #afafaf;
}
afx-sys-panel afx-list-view[data-id="applist"] > div.list-container > ul li
{
padding-top: 5px;
padding-bottom: 5px;
background-color: transparent;
color: #414339;
}
afx-sys-panel afx-hbox[data-id="btlist"] afx-button button
{
width: 100%;
height: 100%;
border-radius: 0;
border: 0px;
border-left: 1px solid #afafaf;
}
afx-sys-panel afx-list-view[data-id="applist"] > div.list-container > ul li:hover,
afx-sys-panel afx-list-view[data-id="applist"] > div.list-container > ul li.selected
{
background-color: #116cd6;
color:white;
}
afx-sys-panel afx-list-view[data-id="applist"] afx-label.search-header {
font-weight: bold;
}
afx-sys-panel afx-list-view[data-id="applist"] afx-label i,
afx-sys-panel afx-list-view[data-id="applist"] afx-label i::before {
margin-right: 10px;
}
afx-sys-panel div[data-id="searchicon"]:before{
content: "\f002";
display: block;
background-color:transparent;
color:#afafaf;
font-family: "FontAwesome";
padding-left:3px;
font-size: 25px;
}
afx-sys-panel input{
border:0;
height: 25px;
color:#afafaf;
background-color: transparent;
}

View File

@ -7,6 +7,11 @@ html,body{
height: 100%;
overflow: hidden;
}
/*
*:fullscreen, *:-webkit-full-screen, *:-moz-full-screen {
background-color: transparent;
background: transparent;
}*/
#wrapper{
margin: 0;
padding: 0;
@ -90,7 +95,7 @@ html,body{
/*box-shadow: 2px 2px 2px #cbcbcb;*/
box-shadow: 1px 1px 1px #9f9F9F;
background-color: #e7e7e7;
z-index: 99999;
z-index: 1000000;
}
input {
outline: none;