Ajout police Sawaasdee, rename js to src

This commit is contained in:
wpetit 2015-10-16 15:12:49 +02:00
parent 39399a5c08
commit 2d8f9bd903
40 changed files with 97 additions and 34 deletions

View File

@ -1,3 +1,10 @@
@font-face {
font-family: 'sawasdeeregular';
src: url('../fonts/sawasdee-webfont.woff2') format('woff2');
font-weight: normal;
font-style: normal;
}
* {
box-sizing: border-box;
}
@ -5,7 +12,7 @@
html, body {
padding: 0;
margin: 0;
font-family: 'Droid Sans', 'Ubuntu Sans', sans-serif;
font-family: 'sawasdeeregular';
background-size: contain;
background-position: center;
background-color: rgb(34, 107, 160);
@ -15,11 +22,21 @@ html, body {
overflow-x: hidden;
}
/* Common */
.alert.alert-default {
border-radius: 4px;
border: 1px solid #ddd;
}
.app-icon {
background-position: center center;
background-size: contain;
background-repeat: no-repeat;
transition: background-image 250ms ease-in-out;
}
.full-width {
width: 100%;
}
@ -28,14 +45,17 @@ html, body {
.launcher {
display: flex;
width: 100%;
height: 100%;
flex-direction: column;
background: url('../img/background.png');
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
transition: background-image 250ms ease-in-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
}
.launcher .main {
@ -48,7 +68,7 @@ html, body {
justify-content: center;
align-items: center;
display: flex;
width: 50px;
width: 60px;
}
.launcher .nav a.goback {
@ -56,6 +76,7 @@ html, body {
color: white;
font-size: 60px;
text-shadow: 1px 1px #444;
font-family: sans-serif;
}
.launcher .nav a.goback:hover {
@ -79,7 +100,7 @@ html, body {
.launcher ul.apps-list {
margin: 0;
padding: 0;
padding: 0 20%;
display: flex;
flex-direction: row;
list-style: none;
@ -91,7 +112,7 @@ html, body {
}
.launcher .nav ~ ul.apps-list {
margin-left: -50px;
margin-left: -60px;
}
.launcher li.app-item {
@ -127,8 +148,9 @@ html, body {
}
.launcher li.app-item > .app-icon {
width: 70%;
height: auto;
width: 90px;
height: 90px;
margin: auto;
}
.launcher li.app-item > .app-label {
@ -237,7 +259,7 @@ html, body {
.edit .desktop-app > .app-icon {
height: 20px;
width: auto;
width: 20px;
display: inline-block;
vertical-align: middle;
margin-right: 10px;
@ -268,7 +290,10 @@ html, body {
.edit .profile-tree .tree-item .app-icon {
height: 25px;
width: 25px;
margin-right: 5px;
display: inline-block;
vertical-align: middle;
}
.edit .app-item-edit {

Binary file not shown.

View File

@ -2,7 +2,6 @@
<head>
<title>Lanceur - Pitaya</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
</head>
<body>
@ -20,12 +19,11 @@
if(isDev) {
// Auto transform JSX
require('node-jsx').install({extension: '.js'});
// Launch application
require('./js/app.js');
} else {
require('./js-compiled/app.js');
}
// Launch app
require('./'+(isDev ? 'src' : 'dist')+'/app.js');
</script>
</body>

View File

@ -2,7 +2,7 @@ var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.
var Menu = require('menu');
var isDev = process.env.NODE_ENV === 'development';
var constants = require('./'+(isDev ? 'js': 'js-compiled')+'/util/const');
var constants = require('./'+(isDev ? 'src': 'dist')+'/util/const');
var mainWindow = null;
@ -14,7 +14,7 @@ app.on('window-all-closed', function() {
app.on('ready', function() {
// Create the browser window.
var electronScreen = require('screen');
var size = electronScreen.getPrimaryDisplay().workAreaSize;
var size = electronScreen.getPrimaryDisplay().size;
var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;
@ -29,7 +29,7 @@ app.on('ready', function() {
y: asDesktop ? 0 : undefined,
});
if(process.env.NODE_ENV === 'development') {
if(isDev) {
mainWindow.openDevTools();
}

View File

@ -13,9 +13,9 @@
"scripts": {
"test": "./node_modules/.bin/nodeunit test",
"start": "./node_modules/.bin/electron .",
"compile": "./node_modules/.bin/jsx -x js js js-compiled",
"clean": "rm -rf js-compiled/* build/*",
"package": "./node_modules/.bin/electron-packager ./ pitaya --prune --ignore=js/ --platform=linux --arch=ia32 --version=0.33.6 --out=build --overwrite --app-version 0.0.0",
"compile": "./node_modules/.bin/jsx -x js src dist",
"clean": "rm -rf dist/* build/*",
"package": "./node_modules/.bin/electron-packager ./ pitaya --prune --ignore=res/ --platform=linux --arch=ia32,x64 --version=0.33.6 --out=build --overwrite --app-version 0.0.0",
"build": "npm run clean && npm run compile && npm run package"
},
"dependencies": {

View File

@ -41,8 +41,12 @@ module.exports = React.createClass({
var icon = this.state.icon;
var style = {
backgroundImage: 'url('+icon+')'
};
return (
<img src={icon} className="app-icon" />
<div className="app-icon" style={style}></div>
);
},
@ -60,6 +64,13 @@ module.exports = React.createClass({
}
return iconPath;
})
.then(function(iconPath) {
return Util.System.exists(iconPath)
.then(function(exists) {
return exists ? iconPath : DEFAULT_ICON;
})
;
})
.then(function(iconPath) {
self.setState({ icon: iconPath });
})

View File

@ -21,6 +21,7 @@ var EditView = React.createClass({
return (
<div className="edit">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css" />
<div className="menu-bar">
<div className="left">
<ProfileMenu />
@ -76,6 +77,16 @@ var EditView = React.createClass({
handleItemChange: function(item, key, value) {
this.props.dispatch(actions.edit.updateProfileItem(item, key, value));
},
handleAddNewNode: function() {
var newItem = {
label: 'Nouveau noeud',
icon: '',
exec: '',
background: ''
};
this.props.dispatch(actions.edit.addProfileItem(newItem, this.props.profile));
}
});

View File

@ -1,5 +1,6 @@
var Util = require('../../util');
var path = require('path');
var _ = require('lodash');
// Action types
var LOAD_DESKTOP_APPS = exports.LOAD_PROFILE = 'LOAD_DESKTOP_APPS';
@ -45,7 +46,14 @@ exports.saveProfile = function(destPath, profile) {
dispatch({ type: SAVE_PROFILE, profile: profile, path: destPath });
return Util.System.saveJSON(destPath, profile)
var cleanedProfile = _.cloneDeep(profile);
Util.Tree.walk(cleanedProfile, function(item) {
delete item.selected;
delete item._key;
});
return Util.System.saveJSON(destPath, cleanedProfile)
.then(function() {
dispatch({ type: SAVE_PROFILE_SUCCESS, profile: profile, path: destPath });
})

View File

@ -4,33 +4,40 @@ var tree = require('../../util/tree');
module.exports = function(oldProfile, action) {
var newProfile = oldProfile || { items: [] };
switch(action.type) {
case actions.common.LOAD_PROFILE_SUCCESS:
var newProfile = _.cloneDeep(action.profile);
tree.walk(newProfile, ensureItemKey);
return newProfile;
newProfile = _.cloneDeep(action.profile);
break;
case actions.edit.MOVE_PROFILE_ITEM:
return moveProfileItem(oldProfile, action.movedItem, action.targetItem);
newProfile = moveProfileItem(oldProfile, action.movedItem, action.targetItem);
break;
case actions.edit.REMOVE_PROFILE_ITEM:
return removeProfileItem(oldProfile, action.removedItem);
newProfile = removeProfileItem(oldProfile, action.removedItem);
break;
case actions.edit.ADD_PROFILE_ITEM:
return addProfileItem(oldProfile, action.newItem, action.targetItem);
newProfile = addProfileItem(oldProfile, action.newItem, action.targetItem);
break;
case actions.edit.UPDATE_PROFILE_ITEM:
return updateProfileItem(oldProfile, action.item, action.key, action.value);
newProfile = updateProfileItem(oldProfile, action.item, action.key, action.value);
break;
case actions.edit.SELECT_PROFILE_ITEM:
return selectProfileItem(oldProfile, action.item);
default:
return oldProfile || null;
newProfile = selectProfileItem(oldProfile, action.item);
break;
}
if(newProfile) tree.walk(newProfile, ensureItemKey);
return newProfile;
};
function selectProfileItem(oldProfile, item) {

View File

@ -46,7 +46,7 @@ exports.findAllDesktopFiles = function(baseDirs) {
if(!Array.isArray(baseDirs)) {
baseDirs = [baseDirs];
}
return promises.seq(baseDirs, function(baseDir) {
return System.findFiles('**/*.desktop', {cwd: baseDir, realpath: true});
})

View File

@ -2,3 +2,6 @@ exports.System = require('./system');
exports.DesktopApps = require('./desktop-apps');
exports.Cache = require('./cache');
exports.Debug = require('./debug');
exports.Tree = require('./tree');
exports.Const = require('./const');
exports.Promises = require('./promises');