mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-21 00:09:45 +02:00
add setting package
This commit is contained in:
@ -240,7 +240,7 @@ class AboutDialog extends BaseDialog
|
||||
super "AboutDialog"
|
||||
|
||||
init: () ->
|
||||
@render "os:///resources/schemes/about.html"
|
||||
@render "os://resources/schemes/about.html"
|
||||
|
||||
main: () ->
|
||||
mt = @meta()
|
||||
@ -260,7 +260,7 @@ class FileDiaLog extends BaseDialog
|
||||
super "FileDiaLog"
|
||||
|
||||
init: () ->
|
||||
@render "os:///resources/schemes/filedialog.html"
|
||||
@render "os://resources/schemes/filedialog.html"
|
||||
|
||||
main: () ->
|
||||
fileview = @find "fileview"
|
||||
|
@ -242,7 +242,7 @@ self.OS.API =
|
||||
, (e, s) ->
|
||||
_courrier.oserror __("Cannot load 3rd library at: {0}", l), e, r
|
||||
else
|
||||
path = "os:///scripts/"
|
||||
path = "os://scripts/"
|
||||
js = "#{path}#{l}.js"
|
||||
js.asFileHandler().onready (d) ->
|
||||
_API.shared[l] = true
|
||||
|
@ -118,7 +118,7 @@ self.OS.GUI =
|
||||
_GUI.launch app, args
|
||||
|
||||
loadApp: (app, ok, err) ->
|
||||
path = "os:///packages/#{app}"
|
||||
path = "os://packages/#{app}"
|
||||
path = _OS.setting.system.packages[app].path if _OS.setting.system.packages[app].path
|
||||
js = path + "/main.js"
|
||||
|
||||
@ -210,7 +210,15 @@ self.OS.GUI =
|
||||
c = arr[1].toUpperCase()
|
||||
return unless _GUI.shortcut[fnk]
|
||||
_GUI.shortcut[fnk][c] = f
|
||||
|
||||
|
||||
wallpaper: (obj) ->
|
||||
if obj
|
||||
_OS.setting.appearance.wp = obj
|
||||
wp = _OS.setting.appearance.wp
|
||||
$("body").css("background-image", "url(#{_API.handler.get}/#{wp.url})" )
|
||||
.css("background-size", wp.size)
|
||||
.css("ackground-repeat", wp.repeat)
|
||||
|
||||
initDM: ->
|
||||
($ document).on 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', ()->
|
||||
_GUI.fullscreen = not _GUI.fullscreen
|
||||
@ -388,6 +396,7 @@ self.OS.GUI =
|
||||
#console.log _OS.setting
|
||||
# load theme
|
||||
_GUI.loadTheme _OS.setting.appearance.theme
|
||||
_GUI.wallpaper()
|
||||
_courrier.observable.one "syspanelloaded", () ->
|
||||
# TODO load packages list then build system menu
|
||||
_courrier.observable.on "systemlocalechange", (name) ->
|
||||
|
@ -2,18 +2,23 @@
|
||||
_OS.setting.desktop = conf.desktop if conf.desktop
|
||||
_OS.setting.applications = conf.applications if conf.applications
|
||||
_OS.setting.appearance = conf.appearance if conf.appearance
|
||||
_OS.setting.appearance.wp = {
|
||||
url: "os://resources/themes/system/wp/wp2.png",
|
||||
size: "cover",
|
||||
repeat: "repeat"
|
||||
} unless _OS.setting.appearance.wp
|
||||
_OS.setting.user = conf.user
|
||||
_OS.setting.VFS = conf.VFS if conf.VFS
|
||||
_OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path
|
||||
_OS.setting.desktop.path = "home://.desktop" unless _OS.setting.desktop.path
|
||||
_OS.setting.desktop.menu = {} unless _OS.setting.desktop.menu
|
||||
_OS.setting.VFS.mountpoints = [
|
||||
#TODO: multi app try to write to this object, it neet to be cloned
|
||||
{ text: __("Applications"), path: 'app:///', iconclass: "fa fa-adn", type: "app" },
|
||||
{ text: __("Home"), path: 'home:///', iconclass: "fa fa-home", type: "fs" },
|
||||
{ text: __("Applications"), path: 'app://', iconclass: "fa fa-adn", type: "app" },
|
||||
{ text: __("Home"), path: 'home://', iconclass: "fa fa-home", type: "fs" },
|
||||
{ text: __("Desktop"), path: _OS.setting.desktop.path , iconclass: "fa fa-desktop", type: "fs" },
|
||||
{ text: __("OS"), path: 'os:///', iconclass: "fa fa-inbox", type: "fs" },
|
||||
{ text: __("Google Drive"), path: 'gdv:///', iconclass: "fa fa-inbox", type: "fs" },
|
||||
{ text: __("Shared"), path: 'shared:///' , iconclass: "fa fa-share-square", type: "fs" }
|
||||
{ text: __("OS"), path: 'os://', iconclass: "fa fa-inbox", type: "fs" },
|
||||
{ text: __("Google Drive"), path: 'gdv://', iconclass: "fa fa-inbox", type: "fs" },
|
||||
{ text: __("Shared"), path: 'shared://' , iconclass: "fa fa-share-square", type: "fs" }
|
||||
] if not _OS.setting.VFS.mountpoints
|
||||
|
||||
_OS.setting.system = conf.system if conf.system
|
||||
@ -28,8 +33,8 @@
|
||||
} if not _OS.setting.system.startup
|
||||
|
||||
_OS.setting.system.pkgpaths = {
|
||||
user: "home:///.packages",
|
||||
system: "os:///packages"
|
||||
user: "home://.packages",
|
||||
system: "os://packages"
|
||||
} unless _OS.setting.system.pkgpaths
|
||||
_OS.setting.system.locale = "en_GB" unless _OS.setting.system.locale
|
||||
_OS.setting.system.menu = {} unless _OS.setting.system.menu
|
||||
|
@ -20,7 +20,7 @@
|
||||
return self[k]
|
||||
}
|
||||
|
||||
this.on("mount", function (e) {
|
||||
this.on("mount", function (e) {
|
||||
self.refs.grid.root.observable = self.root.observable
|
||||
calendar(null)
|
||||
self.root.observable.on("gridcellselect", function(d){
|
||||
|
@ -6,6 +6,7 @@
|
||||
var self = this
|
||||
this.rid = $(self.root).attr("data-id") || Math.floor(Math.random() * 100000) + 1
|
||||
this.on('mount', function(){
|
||||
self.root.observable = (self.parent && self.parent.root && self.parent.root.observable) || opts.observable || riot.observable()
|
||||
$(self.refs.container)
|
||||
.css("display","flex")
|
||||
.css("flex-direction","row")
|
||||
@ -29,6 +30,16 @@
|
||||
var csize, ocwidth = 0, avaiheight;
|
||||
avaiheight = $(self.root).height()
|
||||
avaiWidth = $(self.root).width()
|
||||
/*if(avaiheight == 0)
|
||||
{
|
||||
avaiheight = $(self.parent.root).height()
|
||||
$(self.root).css("height", avaiheight+"px")
|
||||
}
|
||||
if(avaiWidth == 0)
|
||||
{
|
||||
avaiWidth = $(self.parent.root).width()
|
||||
$(self.root).css("height", avaiWidth+"px")
|
||||
}*/
|
||||
$(self.refs.container).css("height",avaiheight + "px")
|
||||
$(self.refs.container)
|
||||
.children()
|
||||
|
@ -112,6 +112,7 @@
|
||||
}
|
||||
|
||||
this.on("mount", function(){
|
||||
self.root.observable = opts.observable || (self.parent && self.parent.root && self.parent.root.observable) || riot.observable()
|
||||
if(opts.dropdown == "true")
|
||||
{
|
||||
$(document).click(function(event) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
else
|
||||
this.swon = false
|
||||
var self = this
|
||||
this.root.observable = opts.observable
|
||||
//this.root.observable = opts.observable
|
||||
if(opts.enable != undefined)
|
||||
this.enable = opts.enable
|
||||
else
|
||||
@ -31,6 +31,9 @@
|
||||
opts.swon = !self.swon
|
||||
self.update()
|
||||
}
|
||||
/*this.on("mount", function(){
|
||||
self.root.observable = (self.parent && self.parent.root && self.parent.root.observable) || opts.observable || riot.observable()
|
||||
})*/
|
||||
this.on("update", function(e){
|
||||
self.swon = opts.swon
|
||||
self.onchange = opts.onchange
|
||||
|
@ -3,7 +3,6 @@
|
||||
<script>
|
||||
var self = this
|
||||
this.closable = opts.closable || false
|
||||
self.root.observable = opts.observable || riot.observable()
|
||||
self.ontabselect = opts.ontabselect
|
||||
get_observable(){
|
||||
return self.root.observable
|
||||
@ -17,6 +16,7 @@
|
||||
self.update(true)
|
||||
}
|
||||
self.on("mount", function(){
|
||||
self.root.observable = opts.observable || (self.parent && self.parent.root && self.parent.root.observable) || riot.observable()
|
||||
self.refs.list.root.observable = self.root.observable
|
||||
/*self.root.observable.on("listselect", function(){
|
||||
console.log("list select")
|
||||
|
84
src/core/tags/afx-tab-container.tag
Normal file
84
src/core/tags/afx-tab-container.tag
Normal file
@ -0,0 +1,84 @@
|
||||
<afx-tab-container>
|
||||
<afx-hbox ref = "mybox" if = {bar == "left"}>
|
||||
<afx-tab-bar data-ref="tabbar" ></afx-tab-bar>
|
||||
<div data-ref="container"></div>
|
||||
</afx-hbox>
|
||||
<afx-vbox ref = "mybox" if = { bar == "top"}>
|
||||
<afx-tab-bar data-ref="tabbar" ></afx-tab-bar>
|
||||
<div data-ref="container"></div>
|
||||
</afx-vbox>
|
||||
<script>
|
||||
this.bar = opts.bar || "top"
|
||||
this.barwidth = opts.barwidth
|
||||
this.barheight = opts.barheight
|
||||
var schemes = []
|
||||
var self = this
|
||||
var calibrate = function()
|
||||
{
|
||||
$(self.refs.mybox.root).css("width", $(self.root).width()+"px")
|
||||
$(self.refs.mybox.root).css("height", $(self.root).height()+"px")
|
||||
self.root.observable.trigger("calibrate")
|
||||
}
|
||||
self.on("mount", function () {
|
||||
self.tabbar = $("[data-ref='tabbar']", self.root)[0]
|
||||
self.container = $("[data-ref='container']", self.root)[0]
|
||||
if(self.barwidth)
|
||||
$(self.tabbar).attr("data-width", self.barwidth)
|
||||
if(self.barheight)
|
||||
$(self.tabbar).attr("data-height", self.barheight)
|
||||
self.root.observable = (self.parent && self.parent.root && self.parent.root.observable) || opts.observable || riot.observable()
|
||||
self.tabbar.set("ontabselect", function(e){
|
||||
$(self.container).children().each(function(el){
|
||||
$(this).hide()
|
||||
})
|
||||
$(e.data.scheme).show()
|
||||
e.data.f()
|
||||
calibrate()
|
||||
})
|
||||
self.root.observable.on("resize", function(){
|
||||
calibrate()
|
||||
})
|
||||
})
|
||||
var render = function(el)
|
||||
{
|
||||
var sch = $.parseHTML(el.scheme)
|
||||
$(self.container).append(sch)
|
||||
el.scheme = sch
|
||||
riot.mount(sch, {observable: self.root.observable})
|
||||
$(sch).hide()
|
||||
el.f()
|
||||
self.root.observable.trigger("tabrendered")
|
||||
//self.root.observable.trigger("calibrate")
|
||||
}
|
||||
var addTab = function(el)
|
||||
{
|
||||
if(!el.f)
|
||||
el.f = (function(){})
|
||||
self.tabbar.push(el)
|
||||
if(el.url)
|
||||
{
|
||||
el.url.asFileHandler().read(function(d){
|
||||
el.scheme = d
|
||||
render(el)
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
render(el)
|
||||
}
|
||||
}
|
||||
self.root.setTabs = function(arr)
|
||||
{
|
||||
if(arr.length <= 0)
|
||||
{
|
||||
self.tabbar.set("selected", 0)
|
||||
return
|
||||
}
|
||||
self.root.observable.one("tabrendered", function(){
|
||||
arr.splice(0,1)
|
||||
self.root.setTabs(arr)
|
||||
})
|
||||
addTab(arr[0])
|
||||
}
|
||||
</script>
|
||||
</afx-tab-container>
|
@ -6,6 +6,7 @@
|
||||
var self = this
|
||||
this.rid = $(self.root).attr("data-id") || Math.floor(Math.random() * 100000) + 1
|
||||
this.on('mount', function(){
|
||||
self.root.observable = (self.parent && self.parent.root && self.parent.root.observable) || opts.observable || riot.observable()
|
||||
$(self.refs.container)
|
||||
.css("display","flex")
|
||||
.css("flex-direction","column")
|
||||
@ -32,6 +33,16 @@
|
||||
var csize, ocheight = 0, avaiheight;
|
||||
avaiheight = $(self.root).height()
|
||||
avaiwidth = $(self.root).width()
|
||||
/*if(avaiheight == 0)
|
||||
{
|
||||
avaiheight = $(self.parent.root).height()
|
||||
$(self.root).css("height", avaiheight+"px")
|
||||
}
|
||||
if(avaiwidth == 0)
|
||||
{
|
||||
avaiwidth = $(self.parent.root).width()
|
||||
$(self.root).css("height", avaiwidth+"px")
|
||||
}*/
|
||||
$(self.refs.container).css("height",avaiheight + "px")
|
||||
$(self.refs.container)
|
||||
.children()
|
||||
|
@ -1,5 +1,5 @@
|
||||
String.prototype.asFileHandler = () ->
|
||||
list = @split ":///"
|
||||
list = @split "://"
|
||||
handlers = _API.VFS.findHandlers list[0]
|
||||
if not handlers or handlers.length is 0
|
||||
_courrier.osfail __("VFS unknown handler: {0}", @), (_API.throwe "OS.VFS"), @
|
||||
@ -25,7 +25,7 @@ class BaseFileHandler
|
||||
@ready = false
|
||||
return unless p
|
||||
@path = p.toString()
|
||||
list = @path.split ":///"
|
||||
list = @path.split "://"
|
||||
@protocol = list[0]
|
||||
return unless list.length > 1
|
||||
re = list[1].replace(/^\/+|\/+$/g, '')
|
||||
@ -67,7 +67,7 @@ class BaseFileHandler
|
||||
return _courrier.osfail __("VFS Cannot encode file: {0}", me.path), (_API.throwe "OS.VFS"), e
|
||||
parent: () ->
|
||||
return @ if @isRoot()
|
||||
return (@protocol + ":///" + (@genealogy.slice 0 , @genealogy.length - 1).join "/")
|
||||
return (@protocol + "://" + (@genealogy.slice 0 , @genealogy.length - 1).join "/")
|
||||
|
||||
onready: (f, err) ->
|
||||
# read meta data
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
# GoogleDrive File Handler
|
||||
G_CACHE = {"gdv:///":{ id: "root", mime: 'dir' } }
|
||||
G_CACHE = {"gdv://":{ id: "root", mime: 'dir' } }
|
||||
|
||||
class GoogleDriveHandler extends this.OS.API.VFS.BaseFileHandler
|
||||
constructor: (path) ->
|
||||
@ -17,7 +17,7 @@ class GoogleDriveHandler extends this.OS.API.VFS.BaseFileHandler
|
||||
fn = (r) ->
|
||||
return f() if r
|
||||
# perform the login
|
||||
G_CACHE = {"gdv:///":{ id: "root", mime: 'dir' } }
|
||||
G_CACHE = {"gdv://":{ id: "root", mime: 'dir' } }
|
||||
gapi.auth2.getAuthInstance().signIn()
|
||||
|
||||
if _API.libready @setting.apilink
|
||||
@ -316,7 +316,7 @@ self.OS.API.onsearch "Google Drive", (t) ->
|
||||
return arr
|
||||
|
||||
self.OS.onexit "cleanUpGoogleDrive", () ->
|
||||
G_CACHE = { "gdv:///": { id: "root", mime: 'dir' } }
|
||||
G_CACHE = { "gdv://": { id: "root", mime: 'dir' } }
|
||||
return unless _OS.setting.VFS.gdrive and _API.libready _OS.setting.VFS.gdrive.apilink
|
||||
auth2 = gapi.auth2.getAuthInstance()
|
||||
return unless auth2
|
||||
|
Reference in New Issue
Block a user