style popup update, settings handling fixed

This commit is contained in:
jean-emmanuel 2016-03-01 00:10:52 +01:00
parent 0cd31c48e5
commit 0713ca6690
6 changed files with 29 additions and 25 deletions

File diff suppressed because one or more lines are too long

View file

@ -524,6 +524,8 @@ a {
right:0;
bottom:0;
padding:10%;
display: flex;
align-items: center;
background:rgba($color-text,.5);
z-index:1000000;
.popup-title {
@ -540,8 +542,10 @@ a {
}
}
.popup-wrapper {
display: flex;
flex-direction: column;
align-items: stretch;
background:$color-fg;
height:100%;
width:100%;
max-width:600rem;
margin:0 auto;

View file

@ -68,7 +68,7 @@ module.exports = function(settings,fs,ipc,osc,dialog) {
if (data.path) this.sessionAddToHistory(data.path)
ipc.send('sessionOpen',JSON.stringify(session),clientId)
} else {
ipc.send('error',{title:'Error: invalid session file',text:error})
ipc.send('error',{title:'Error: invalid session file',text:'<p>'+error+'</p>'})
}
},

View file

@ -2,13 +2,13 @@ var fs = require('fs'),
settings = require('./settings')(fs)
if (settings.compileScss) {
if (settings.read('compileScss')) {
var sass = require(__dirname + '/../browser/js/sass/sass.sync.js')
var filenames = fs.readdirSync(__dirname + '/../browser/scss/')
for (i in filenames) {
if (filenames[i].indexOf('.scss')!=-1)
var file = __dirname + '/../browser/scss/' + filenames[i]
var light = settings.lightTheme?'$theme:\'light\';':'$theme:\'dark\';'
var light = settings.read('lightTheme')?'$theme:\'light\';':'$theme:\'dark\';'
var content = fs.readFileSync(file,'utf8')
sass.compile(light+content,{style: sass.style.compact,linefeed: ''}, function(result) {
fs.writeFileSync(__dirname + '/../browser/css/'+filenames[i].replace('.scss','.css'),result.text,'utf8')
@ -18,7 +18,7 @@ if (settings.compileScss) {
if (!settings.noGui) {
if (!settings.read('noGui')) {
var app = require('app'),
browserWindow = require('browser-window'),

View file

@ -27,7 +27,7 @@ module.exports = function(settings) {
io.listen(server);
server.listen(settings.noGui)
server.listen(settings.read('noGui'))
ipc.send = function(name,data,clientId) {
if (clientId) {
@ -52,7 +52,7 @@ module.exports = function(settings) {
}
console.log('Headless mode: app available at http://127.0.0.1:'+settings.noGui)
console.log('Headless mode: app available at http://127.0.0.1:'+settings.read('noGui'))
return {
ipc:ipc,

View file

@ -20,29 +20,29 @@ var argv = require('yargs')
.argv
module.exports = function(fs) {
var config = function(){try {return JSON.parse(fs.readFileSync(configFile,'utf-8'))} catch(err) {return {}}}(),
defaultConfig = {
presetPath : process.cwd(),
sessionPath: process.cwd(),
recentSessions: [],
appName: 'Open Stage Control',
syncTargets: argv.s || false,
oscInPort: argv.p || false,
compileScss: argv.c!==undefined || false,
lightTheme: argv.c && argv.c.match(/light/),
sessionFile: argv.l || false,
noGui: argv.n || false,
}
return {
presetPath : process.cwd(),
sessionPath: process.cwd(),
recentSessions: [],
appName: 'OSC Controller',
syncTargets: argv.s || false,
oscInPort: argv.p || false,
compileScss: argv.c!==undefined || false,
lightTheme: argv.c && argv.c.match(/light/),
sessionFile: argv.l || false,
noGui: argv.n || false,
persistent: function(){var c = {};try {c=require(configFile)} finally {return c}}(),
read:function(key){
var x = this.persistent[key] || this[key]
var x = config[key] || defaultConfig[key]
return x
},
write:function(key,value) {
this.persistent[key] = value
fs.writeFile(configFile,JSON.stringify(this.persistent,null,4), function (err, data) {
config[key] = value
fs.writeFile(configFile,JSON.stringify(config,null,4), function (err, data) {
if (err) throw err
})
}