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 return false
applySetting: (k) -> applySetting: (k) ->
applyAllSetting: () ->
@applySetting k for k, v of @setting
registry: (k, v) -> registry: (k, v) ->
@setting[k] = v @setting[k] = v
@publish "appregistry", k @publish "appregistry", k

View File

@ -27,12 +27,23 @@ self.OS.GUI =
META: {} META: {}
SYS_MENU: [ SYS_MENU: [
{ {
text: "__(Applications)", text: "",
child: [], iconclass: "fa fa-eercast",
dataid: "sys-apps" dataid: "sys-menu-root",
iconclass: "fa fa-adn", child: [
{
text: "__(Applications)",
child: [],
dataid: "sys-apps"
iconclass: "fa fa-adn",
onmenuselect: (d) ->
_GUI.launch d.item.data.app
}
],
onmenuselect: (d) -> 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) -> htmlToScheme: (html, app, parent) ->
@ -402,31 +413,23 @@ self.OS.GUI =
console.log s, e console.log s, e
refreshDesktop: () -> refreshDesktop: () ->
($ "#desktop")[0].fetch() ($ "#desktop")[0].fetch()
refreshSystemMenu: () -> refreshSystemMenu: () ->
_GUI.SYS_MENU.length = 1 _GUI.SYS_MENU[0].child.length = 1
_GUI.SYS_MENU[0].child.length = 0 _GUI.SYS_MENU[0].child[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[0].child[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[0].child.push v for k, v of _OS.setting.system.menu
_GUI.SYS_MENU.push _GUI.SYS_MENU[0].child.push
text: "__(Toggle Full screen)", text: "__(Toggle Full screen)",
dataid: "os-fullsize", dataid: "os-fullsize",
iconclass: "fa fa-tv" iconclass: "fa fa-tv"
_GUI.SYS_MENU.push _GUI.SYS_MENU[0].child.push
text: "__(Log out)", text: "__(Log out)",
dataid: "sys-logout", dataid: "sys-logout",
iconclass: "fa fa-user-times" iconclass: "fa fa-user-times"
($ "[data-id = 'os_menu']", "#syspanel")[0].update()
buildSystemMenu: () -> buildSystemMenu: () ->
menu = ($ "[data-id = 'os_menu']", "#syspanel")[0].set "items", _GUI.SYS_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
#console.log 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 me.systemsetting.system.packages[me.prjfile.cache.name] = v
# todo: auto matic refresh menu # todo: auto matic refresh menu
me._gui.refreshSystemMenu() me._gui.refreshSystemMenu()
me._gui.buildSystemMenu() #me._gui.buildSystemMenu()
me.log "INFO", __("Running {0}...", me.prjfile.cache.name) me.log "INFO", __("Running {0}...", me.prjfile.cache.name)
me._gui.forceLaunch me.prjfile.cache.name me._gui.forceLaunch me.prjfile.cache.name
, "json" , "json"

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"email": "xsang.le@gmail.com" "email": "xsang.le@gmail.com"
}, },
"version":"0.0.1-a", "version":"0.0.2-a",
"category":"System", "category":"System",
"iconclass":"fa fa-cubes", "iconclass":"fa fa-cubes",
"mimes":[ "mimes":[

View File

@ -24,7 +24,12 @@ class DummyApp extends this.OS.GUI.BaseApplication
self = @ self = @
@on "btclick", (e)-> @on "btclick", (e)->
#_GUI.pushService "Budgy" #_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)-> @on "resize", (w,h)->
console.log "#{self.name}: resize" console.log "#{self.name}: resize"
#@on "listselect", (i)-> #@on "listselect", (i)->
@ -122,6 +127,28 @@ class DummyApp extends this.OS.GUI.BaseApplication
] ]
m.set "items", mdata m.set "items", mdata
m.show(e) 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 DummyApp.singleton = false
this.OS.register "DummyApp",DummyApp this.OS.register "DummyApp",DummyApp

View File

@ -8,7 +8,7 @@
"credit": "dedicated to some one here", "credit": "dedicated to some one here",
"licences": "GPLv3" "licences": "GPLv3"
}, },
"version":"0.0.2-a", "version":"0.0.3-a",
"category":"System", "category":"System",
"icon": "icon.png", "icon": "icon.png",
"mimes":["none"] "mimes":["none"]

View File

@ -75,13 +75,13 @@ class Files extends this.OS.GUI.BaseApplication
@setting.sidebar = true if @setting.sidebar is undefined @setting.sidebar = true if @setting.sidebar is undefined
@setting.nav = true if @setting.nav is undefined @setting.nav = true if @setting.nav is undefined
@setting.showhidden = false if @setting.showhidden is undefined @setting.showhidden = false if @setting.showhidden is undefined
@applyAllSetting()
mntpoints = @systemsetting.VFS.mountpoints mntpoints = @systemsetting.VFS.mountpoints
el.selected = false for el, i in mntpoints el.selected = false for el, i in mntpoints
@favo.set "items", mntpoints @favo.set "items", mntpoints
#@favo.set "selected", -1 #@favo.set "selected", -1
@applySetting()
@view.set "view", @setting.view if @setting.view @view.set "view", @setting.view if @setting.view
@subscribe "VFS", (d) -> @subscribe "VFS", (d) ->

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"email": "xsang.le@gmail.com" "email": "xsang.le@gmail.com"
}, },
"version":"0.0.1-a", "version":"0.0.2-a",
"category":"System", "category":"System",
"iconclass":"fa fa-hdd-o", "iconclass":"fa fa-hdd-o",
"mimes":["dir"] "mimes":["dir"]