From 04e5a4d50c9b531036fcae3b2813e47689f172c4 Mon Sep 17 00:00:00 2001 From: lxsang Date: Tue, 12 May 2020 21:08:39 +0200 Subject: [PATCH] adapt apps --- Makefile | 2 +- src/core/Announcerment.coffee | 10 +- src/core/BaseDialog.coffee | 2 +- src/core/api.coffee | 73 +++---- src/core/core.coffee | 7 +- src/core/gui.coffee | 3 +- src/core/tags/FileViewTag.coffee | 5 +- src/core/tags/GridViewTag.coffee | 92 ++++++--- src/core/tags/MenuTag.coffee | 10 +- src/core/tags/SystemPanelTag.coffee | 7 +- src/core/tags/tag.coffee | 2 + src/core/vfs.coffee | 84 +++++--- src/packages/ActivityMonitor/main.coffee | 35 ++-- src/packages/ActivityMonitor/main.css | 12 +- src/packages/ActivityMonitor/scheme.html | 13 +- src/packages/DummyApp/Makefile | 11 -- src/packages/DummyApp/icon.png | Bin 1294 -> 0 bytes src/packages/DummyApp/main.coffee | 154 --------------- src/packages/DummyApp/main.css | 7 - src/packages/DummyApp/package.json | 15 -- src/packages/DummyApp/scheme.html | 22 --- src/packages/Files/main.coffee | 231 ++++++++++++---------- src/packages/Files/main.css | 6 + src/packages/MarkOn/main.coffee | 59 ++++-- src/packages/ShowCase/coffees/main.coffee | 2 +- src/themes/antos/afx-calendar-view.css | 4 +- src/themes/antos/afx-file-view.css | 9 +- src/themes/antos/afx-grid-view.css | 17 +- src/themes/antos/afx-sys-panel.css | 1 + 29 files changed, 416 insertions(+), 479 deletions(-) delete mode 100644 src/packages/DummyApp/Makefile delete mode 100644 src/packages/DummyApp/icon.png delete mode 100644 src/packages/DummyApp/main.coffee delete mode 100644 src/packages/DummyApp/main.css delete mode 100644 src/packages/DummyApp/package.json delete mode 100644 src/packages/DummyApp/scheme.html diff --git a/Makefile b/Makefile index 4b9455f..8335db4 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ coffees= src/core/core.coffee \ -packages = CoreServices ActivityMonitor Setting ShowCase DummyApp # Files MarkOn MarketPlace Preview NotePad wTerm +packages = CoreServices ActivityMonitor Files Setting ShowCase MarkOn# Files MarketPlace Preview NotePad wTerm main: initd build_coffees build_themes schemes libs build_packages languages - cp src/index.html $(BUILDDIR)/ diff --git a/src/core/Announcerment.coffee b/src/core/Announcerment.coffee index 82ba3aa..1e5c163 100644 --- a/src/core/Announcerment.coffee +++ b/src/core/Announcerment.coffee @@ -72,12 +72,12 @@ Ant.OS.announcer = Ant.OS.announcer.listeners[a.pid].push { e: e, f: f } Ant.OS.announcer.observable.on e, f trigger: (e, d) -> Ant.OS.announcer.observable.trigger e, d - osfail: (m, e, s) -> - Ant.OS.announcer.ostrigger "fail", { m: m, e: e, s: s } - oserror: (m, e, s) -> - Ant.OS.announcer.ostrigger "error", { m: m, e: e, s: s } + osfail: (m, e) -> + Ant.OS.announcer.ostrigger "fail", { m: m, e: e } + oserror: (m, e) -> + Ant.OS.announcer.ostrigger "error", { m: m, e: e } osinfo: (m) -> - Ant.OS.announcer.ostrigger "info", { m: m, e: null, s: null } + Ant.OS.announcer.ostrigger "info", { m: m, e: null } ostrigger: (e, d) -> Ant.OS.announcer.trigger e, { id: 0, data: d, name: "OS" } unregister: (app) -> diff --git a/src/core/BaseDialog.coffee b/src/core/BaseDialog.coffee index 9eca427..0e432eb 100644 --- a/src/core/BaseDialog.coffee +++ b/src/core/BaseDialog.coffee @@ -233,7 +233,7 @@ class YesNoDialog extends BasicDialog init: () -> super.init() me = @ - @find("lbl").set "text", @data.label if @data and @data.label + @find("lbl").set "*", @data if @data (@find "btnYes").set "onbtclick", (e) -> me.handle(true) if me.handle me.quit() diff --git a/src/core/api.coffee b/src/core/api.coffee index be43cce..d029102 100644 --- a/src/core/api.coffee +++ b/src/core/api.coffee @@ -289,42 +289,47 @@ Ant.OS.API = libready: (l) -> return Ant.OS.API.shared[l] || false - require: (l,f) -> - if not Ant.OS.API.shared[l] - if l.match /^(https?:\/\/[^\s]+)/g - Ant.OS.API.script l, () -> - Ant.OS.API.shared[l] = true - Ant.OS.announcer.trigger "sharedlibraryloaded", l - f() if f - , (e, s) -> - Ant.OS.announcer.oserror __("Cannot load 3rd library at: {0}", l), e, r + requires: (l) -> + new Promise (resolve, reject) -> + if not Ant.OS.API.shared[l] + link = l + if not l.match /^(https?:\/\/[^\s]+)/g + path = "os://scripts/" + cssFile = "#{path}#{l}.css".asFileHandle() + cssFile.onready() + .then () -> + $('', { + rel: 'stylesheet', + type: 'text/css', + 'href': "#{cssFile.getlink()}" + }) + .appendTo 'head' + .catch (e) -> + js = "#{path}#{l}.js" + link = js.asFileHandle().getlink() + Ant.OS.API.script link + .then () -> + Ant.OS.API.shared[l] = true + console.log "loaded:", l + Ant.OS.announcer.trigger "sharedlibraryloaded", l + resolve(l) + .catch (e) -> + reject e else - path = "os://scripts/" - js = "#{path}#{l}.js" - js.asFileHandle().onready (d) -> - Ant.OS.API.shared[l] = true - el = $ '