2015-05-06 19:32:19 +00:00
|
|
|
var blessed = require('../')
|
|
|
|
, screen;
|
|
|
|
|
|
|
|
screen = blessed.screen({
|
|
|
|
dump: __dirname + '/logs/layout.log',
|
|
|
|
smartCSR: true,
|
|
|
|
autoPadding: true
|
|
|
|
});
|
|
|
|
|
|
|
|
var layout = blessed.layout({
|
|
|
|
parent: screen,
|
|
|
|
top: 'center',
|
|
|
|
left: 'center',
|
|
|
|
width: '50%',
|
|
|
|
height: '50%',
|
|
|
|
border: 'line',
|
2015-05-08 00:41:59 +00:00
|
|
|
layout: process.argv[2] === 'grid' ? 'grid' : 'inline',
|
2015-05-06 19:32:19 +00:00
|
|
|
style: {
|
|
|
|
bg: 'red',
|
|
|
|
border: {
|
|
|
|
fg: 'blue'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var box1 = blessed.box({
|
|
|
|
parent: layout,
|
|
|
|
top: 'center',
|
|
|
|
left: 'center',
|
|
|
|
width: 20,
|
|
|
|
height: 10,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '1'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var box2 = blessed.box({
|
|
|
|
parent: layout,
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: 10,
|
|
|
|
height: 5,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '2'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
2015-05-08 00:25:23 +00:00
|
|
|
var box3 = blessed.box({
|
2015-05-06 19:32:19 +00:00
|
|
|
parent: layout,
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: 10,
|
|
|
|
height: 5,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '3'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
2015-05-08 00:25:23 +00:00
|
|
|
var box4 = blessed.box({
|
2015-05-06 19:32:19 +00:00
|
|
|
parent: layout,
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: 10,
|
|
|
|
height: 5,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '4'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
2015-05-08 00:25:23 +00:00
|
|
|
var box5 = blessed.box({
|
2015-05-06 19:32:19 +00:00
|
|
|
parent: layout,
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: 10,
|
|
|
|
height: 5,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '5'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
2015-05-08 00:25:23 +00:00
|
|
|
var box6 = blessed.box({
|
2015-05-06 19:32:19 +00:00
|
|
|
parent: layout,
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: 10,
|
|
|
|
height: 5,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '6'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
2015-05-08 00:25:23 +00:00
|
|
|
var box7 = blessed.box({
|
2015-05-06 19:32:19 +00:00
|
|
|
parent: layout,
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: 10,
|
|
|
|
height: 5,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '7'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
2015-05-08 00:25:23 +00:00
|
|
|
var box8 = blessed.box({
|
2015-05-06 19:32:19 +00:00
|
|
|
parent: layout,
|
|
|
|
top: 'center',
|
|
|
|
left: 'center',
|
|
|
|
width: 20,
|
|
|
|
height: 10,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '8'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
2015-05-08 00:25:23 +00:00
|
|
|
var box9 = blessed.box({
|
2015-05-06 19:32:19 +00:00
|
|
|
parent: layout,
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: 10,
|
|
|
|
height: 5,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '9'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
2015-05-08 00:25:23 +00:00
|
|
|
var box10 = blessed.box({
|
2015-05-06 19:32:19 +00:00
|
|
|
parent: layout,
|
|
|
|
top: 'center',
|
|
|
|
left: 'center',
|
|
|
|
width: 20,
|
|
|
|
height: 10,
|
2015-05-08 00:25:23 +00:00
|
|
|
border: 'line',
|
|
|
|
content: '10'
|
|
|
|
});
|
|
|
|
|
|
|
|
var box11 = blessed.box({
|
|
|
|
parent: layout,
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
width: 10,
|
|
|
|
height: 5,
|
|
|
|
border: 'line',
|
|
|
|
content: '11'
|
|
|
|
});
|
|
|
|
|
|
|
|
var box12 = blessed.box({
|
|
|
|
parent: layout,
|
|
|
|
top: 'center',
|
|
|
|
left: 'center',
|
|
|
|
width: 20,
|
|
|
|
height: 10,
|
|
|
|
border: 'line',
|
|
|
|
content: '12'
|
2015-05-06 19:32:19 +00:00
|
|
|
});
|
|
|
|
|
2015-05-08 05:18:05 +00:00
|
|
|
if (process.argv[2] !== 'grid') {
|
|
|
|
for (var i = 0; i < 10; i++) {
|
|
|
|
blessed.box({
|
|
|
|
parent: layout,
|
|
|
|
// width: i % 2 === 0 ? 10 : 20,
|
|
|
|
// height: i % 2 === 0 ? 5 : 10,
|
|
|
|
width: Math.random() > 0.5 ? 10 : 20,
|
|
|
|
height: Math.random() > 0.5 ? 5 : 10,
|
|
|
|
border: 'line',
|
|
|
|
content: (i + 1 + 12) + ''
|
|
|
|
});
|
|
|
|
}
|
2015-05-06 19:32:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
screen.key('q', function() {
|
|
|
|
return process.exit(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
screen.render();
|