1
0
mirror of https://github.com/fazo96/telecommander.git synced 2025-01-10 11:34:20 +01:00

usability and style update

This commit is contained in:
Enrico Fasoli 2015-08-31 13:32:39 +00:00
parent 411dd8af42
commit 99c302ac35
2 changed files with 38 additions and 16 deletions

View File

@ -40,11 +40,24 @@ module.exports = function(data){
}) })
data.screen.title = "Telecommander" data.screen.title = "Telecommander"
data.defaultStyle = { data.getDefaultStyle = function(){
fg: 'white', return {
border: { fg: 'grey' }, fg: 'white',
scrollbar: { border: { fg: 'grey' },
ch: '*' focus: {
border: { fg: 'white' }
},
selected: { bold: true },
scrollbar: {
style: {
ch: '#',
fg: 'white'
},
track : {
ch: '|',
fg: 'grey'
}
}
} }
} }
@ -59,9 +72,8 @@ module.exports = function(data){
border: { type: 'line' }, border: { type: 'line' },
mouse: true, mouse: true,
invertSelected: true, invertSelected: true,
style: data.defaultStyle, style: data.getDefaultStyle(),
}) })
data.chats.style.selected = { bold: true }
// Function to create a log box // Function to create a log box
data.mkBox = function(label){ data.mkBox = function(label){
@ -75,21 +87,21 @@ module.exports = function(data){
border: { type: 'line' }, border: { type: 'line' },
scrollable: true, scrollable: true,
//draggable: true, //draggable: true,
style: data.defaultStyle style: data.getDefaultStyle()
}) })
} }
// Command line prompt // Command line prompt
data.cmdline = blessed.textbox({ data.cmdline = blessed.textbox({
keys: true, keys: false,
mouse: true,
label: 'Command for Telecommander', label: 'Command for Telecommander',
inputOnFocus: true,
bottom: 0, bottom: 0,
left: 'center', left: 'center',
width: '100%', width: '100%',
height: 3, height: 3,
border: { type: 'line' }, border: { type: 'line' },
style: data.defaultStyle style: data.getDefaultStyle()
}) })
// mgsBox holds the chat boxes for every list entry // mgsBox holds the chat boxes for every list entry
@ -187,15 +199,24 @@ module.exports = function(data){
data.chats.on('select',function(selected){ data.chats.on('select',function(selected){
//data.log('SELECT:',selected.content) //data.log('SELECT:',selected.content)
data.switchToBox(selected.content) data.switchToBox(selected.content)
data.screen.focusPush(data.cmdline) data.cmdline.focus()
data.screen.render() data.screen.render()
}) })
/*
data.cmdline.on('click',function(){
data.cmdline.focus()
data.screen.render()
})
*/
// Catch ctrl-c or escape event and close program // Catch ctrl-c or escape event and close program
data.screen.key(['escape','C-c'], function(ch,key){ data.screen.key(['escape','C-c'], function(ch,key){
data.quit() data.quit()
}); });
data.cmdline.on('focus',function(){
data.cmdline.readInput()
})
// What happens when the user submits a command in the prompt // What happens when the user submits a command in the prompt
data.cmdline.on('submit',function(value){ data.cmdline.on('submit',function(value){
data.getMsgBox(data.statusWindow).add('< '+value) data.getMsgBox(data.statusWindow).add('< '+value)
@ -211,6 +232,7 @@ module.exports = function(data){
} }
data.cmdline.clearValue() data.cmdline.clearValue()
data.cmdline.focus() data.cmdline.focus()
}) })
} }

View File

@ -245,10 +245,10 @@ data.appendToUserBox = function(msg,context){
} }
} }
if(goesto === undefined){ if(goesto === undefined){
if(context.users.list[0].user_id == user.id){ if(context.users.list[0].user_id == data.user.id){
goesto = data.getMsgBox(getName(context.users.list[1].id,'user')) goesto = data.getMsgBox(data.getName(context.users.list[1].id,'user'))
} else{ } else{
goesto = data.getMsgBox(getName(context.users.list[0].id,'user')) goesto = data.getMsgBox(data.getName(context.users.list[0].id,'user'))
} }
} }
data.appendMsg(msg,goesto,true) data.appendMsg(msg,goesto,true)