From b2db12e42fa3ff7a32c0fef37fef7c75196560ad Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Tue, 24 Jul 2018 15:17:43 +0200 Subject: [PATCH] improvement & bug fix --- src/core/BaseApplication.coffee | 2 ++ src/core/gui.coffee | 47 ++++++++++++++++-------------- src/packages/AntOSDK/main.coffee | 2 +- src/packages/AntOSDK/package.json | 2 +- src/packages/DummyApp/main.coffee | 31 ++++++++++++++++++-- src/packages/DummyApp/package.json | 2 +- src/packages/Files/main.coffee | 4 +-- src/packages/Files/package.json | 2 +- 8 files changed, 62 insertions(+), 30 deletions(-) diff --git a/src/core/BaseApplication.coffee b/src/core/BaseApplication.coffee index ba009e9..832c7a2 100644 --- a/src/core/BaseApplication.coffee +++ b/src/core/BaseApplication.coffee @@ -69,6 +69,8 @@ class BaseApplication extends this.OS.GUI.BaseModel return false applySetting: (k) -> + applyAllSetting: () -> + @applySetting k for k, v of @setting registry: (k, v) -> @setting[k] = v @publish "appregistry", k diff --git a/src/core/gui.coffee b/src/core/gui.coffee index 88795eb..6a95cb9 100644 --- a/src/core/gui.coffee +++ b/src/core/gui.coffee @@ -27,12 +27,23 @@ self.OS.GUI = META: {} SYS_MENU: [ { - text: "__(Applications)", - child: [], - dataid: "sys-apps" - iconclass: "fa fa-adn", + text: "", + iconclass: "fa fa-eercast", + dataid: "sys-menu-root", + child: [ + { + text: "__(Applications)", + child: [], + dataid: "sys-apps" + iconclass: "fa fa-adn", + onmenuselect: (d) -> + _GUI.launch d.item.data.app + } + ], onmenuselect: (d) -> - _GUI.launch d.item.data.app + return _OS.exit() if d.item.data.dataid is "sys-logout" + return _GUI.toggleFullscreen() if d.item.data.dataid is "os-fullsize" + _GUI.launch d.item.data.app unless d.item.data.dataid } ] htmlToScheme: (html, app, parent) -> @@ -402,31 +413,23 @@ self.OS.GUI = console.log s, e refreshDesktop: () -> ($ "#desktop")[0].fetch() + refreshSystemMenu: () -> - _GUI.SYS_MENU.length = 1 - _GUI.SYS_MENU[0].child.length = 0 - _GUI.SYS_MENU[0].child.push v for k, v of _OS.setting.system.packages when (v and v.app) - _GUI.SYS_MENU.push v for k, v of _OS.setting.system.menu - _GUI.SYS_MENU.push + _GUI.SYS_MENU[0].child.length = 1 + _GUI.SYS_MENU[0].child[0].child.length = 0 + _GUI.SYS_MENU[0].child[0].child.push v for k, v of _OS.setting.system.packages when (v and v.app) + _GUI.SYS_MENU[0].child.push v for k, v of _OS.setting.system.menu + _GUI.SYS_MENU[0].child.push text: "__(Toggle Full screen)", dataid: "os-fullsize", iconclass: "fa fa-tv" - _GUI.SYS_MENU.push + _GUI.SYS_MENU[0].child.push text: "__(Log out)", dataid: "sys-logout", iconclass: "fa fa-user-times" + ($ "[data-id = 'os_menu']", "#syspanel")[0].update() buildSystemMenu: () -> - menu = - text: "" - iconclass: "fa fa-eercast" - dataid: "sys-menu-root" - child: _GUI.SYS_MENU - menu.onmenuselect = (d) -> - return _OS.exit() if d.item.data.dataid is "sys-logout" - return _GUI.toggleFullscreen() if d.item.data.dataid is "os-fullsize" - _GUI.launch d.item.data.app unless d.item.data.dataid - menu = [menu] - ($ "[data-id = 'os_menu']", "#syspanel")[0].set "items", menu + ($ "[data-id = 'os_menu']", "#syspanel")[0].set "items", _GUI.SYS_MENU #console.log menu diff --git a/src/packages/AntOSDK/main.coffee b/src/packages/AntOSDK/main.coffee index 228261c..dd88141 100644 --- a/src/packages/AntOSDK/main.coffee +++ b/src/packages/AntOSDK/main.coffee @@ -684,7 +684,7 @@ class AntOSDK extends this.OS.GUI.BaseApplication me.systemsetting.system.packages[me.prjfile.cache.name] = v # todo: auto matic refresh menu me._gui.refreshSystemMenu() - me._gui.buildSystemMenu() + #me._gui.buildSystemMenu() me.log "INFO", __("Running {0}...", me.prjfile.cache.name) me._gui.forceLaunch me.prjfile.cache.name , "json" diff --git a/src/packages/AntOSDK/package.json b/src/packages/AntOSDK/package.json index f37eca7..c2d1b9c 100644 --- a/src/packages/AntOSDK/package.json +++ b/src/packages/AntOSDK/package.json @@ -6,7 +6,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.0.1-a", + "version":"0.0.2-a", "category":"System", "iconclass":"fa fa-cubes", "mimes":[ diff --git a/src/packages/DummyApp/main.coffee b/src/packages/DummyApp/main.coffee index f1bac69..ee39073 100644 --- a/src/packages/DummyApp/main.coffee +++ b/src/packages/DummyApp/main.coffee @@ -24,7 +24,12 @@ class DummyApp extends this.OS.GUI.BaseApplication self = @ @on "btclick", (e)-> #_GUI.pushService "Budgy" - self.openDialog "ColorPickerDialog", (d) -> console.log d + #self.openDialog "ColorPickerDialog", (d) -> console.log d + self.addMenu() + self.systemsetting.system.menu["test"] = + text: 'Adding system menu' + self._gui.refreshSystemMenu() + "self._gui.buildSystemMenu()" @on "resize", (w,h)-> console.log "#{self.name}: resize" #@on "listselect", (i)-> @@ -122,6 +127,28 @@ class DummyApp extends this.OS.GUI.BaseApplication ] m.set "items", mdata m.show(e) - + + @menu_ = [ + { + text: "__(View)", + child: [ + { text: "__(Refresh)", dataid: "#{@name}-refresh" }, + { text: "__(Sidebar)", dataid: "#{@name}-side" }, + { text: "__(Navigation bar)", dataid: "#{@name}-nav" }, + { text: "__(Hidden files)", dataid: "#{@name}-hidden" }, + { text: "__(Type)", child: [ + { text: "__(Icon view)", dataid: "#{@name}-icon", type: 'icon' }, + { text: "__(List view)", dataid: "#{@name}-list", type: 'list' }, + { text: "__(Tree view)", dataid: "#{@name}-tree", type: 'tree' } + ], onmenuselect: (e) -> + console.log e + }, + ], onmenuselect: (e) ->console.log e + }, + ] + menu: () -> + @menu_ + addMenu: () -> + @menu_[0].child.push {text:'One more menu'} DummyApp.singleton = false this.OS.register "DummyApp",DummyApp \ No newline at end of file diff --git a/src/packages/DummyApp/package.json b/src/packages/DummyApp/package.json index 2f01e8c..2a983e7 100644 --- a/src/packages/DummyApp/package.json +++ b/src/packages/DummyApp/package.json @@ -8,7 +8,7 @@ "credit": "dedicated to some one here", "licences": "GPLv3" }, - "version":"0.0.2-a", + "version":"0.0.3-a", "category":"System", "icon": "icon.png", "mimes":["none"] diff --git a/src/packages/Files/main.coffee b/src/packages/Files/main.coffee index 150c489..5425851 100644 --- a/src/packages/Files/main.coffee +++ b/src/packages/Files/main.coffee @@ -75,13 +75,13 @@ class Files extends this.OS.GUI.BaseApplication @setting.sidebar = true if @setting.sidebar is undefined @setting.nav = true if @setting.nav is undefined @setting.showhidden = false if @setting.showhidden is undefined - + @applyAllSetting() + mntpoints = @systemsetting.VFS.mountpoints el.selected = false for el, i in mntpoints @favo.set "items", mntpoints #@favo.set "selected", -1 - @applySetting() @view.set "view", @setting.view if @setting.view @subscribe "VFS", (d) -> diff --git a/src/packages/Files/package.json b/src/packages/Files/package.json index a3bb1a5..5d53b58 100644 --- a/src/packages/Files/package.json +++ b/src/packages/Files/package.json @@ -6,7 +6,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.0.1-a", + "version":"0.0.2-a", "category":"System", "iconclass":"fa fa-hdd-o", "mimes":["dir"]