improvement & bug fix

This commit is contained in:
Xuan Sang LE 2018-07-24 15:17:43 +02:00
parent 3cad7be3bf
commit b2db12e42f
8 changed files with 62 additions and 30 deletions

View File

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

View File

@ -26,6 +26,11 @@ self.OS.GUI =
SHIFT: {}
META: {}
SYS_MENU: [
{
text: "",
iconclass: "fa fa-eercast",
dataid: "sys-menu-root",
child: [
{
text: "__(Applications)",
child: [],
@ -34,6 +39,12 @@ self.OS.GUI =
onmenuselect: (d) ->
_GUI.launch d.item.data.app
}
],
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
}
]
htmlToScheme: (html, app, parent) ->
scheme = $.parseHTML html
@ -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

View File

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

View File

@ -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":[

View File

@ -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)->
@ -123,5 +128,27 @@ 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

View File

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

View File

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

View File

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