Add notification handler to gui

This commit is contained in:
Matt 2016-04-22 14:33:49 -04:00
parent a31335ee3a
commit 47f0003123
4 changed files with 18 additions and 3 deletions

View File

@ -104,7 +104,7 @@ footer {
border-radius: 15px;
}
#light-status {
width: 388px;
width: 360px;
float: right;
margin-top: -25px;
}
@ -476,6 +476,8 @@ button:focus {
}
#console textarea {
font-family: 'Menlo', monospace;
font-size: 12px;
line-height: 17px;
outline: none !important;
border: none;
box-sizing: border-box;

View File

@ -157,7 +157,7 @@ footer{
border-radius: 15px;
}
#light-status{
width: 388px;
width: 360px;
float: right;
margin-top: -25px;
h3{

View File

@ -3039,6 +3039,7 @@ BB - Black backwards
*/
var remote = require('remote'),
dialog = require('electron').remote.dialog,
notifier = require('node-notifier'),
fs = require('fs'),
uuid = require('node-uuid'),
moment = require('moment'),
@ -3214,6 +3215,7 @@ seq.run = function () {
} else {
log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true);
}
gui.notify('Sequence done!', (mcopy.state.sequence.arr.length * mcopy.loop) + ' actions completed in ' + humanizeDuration(timeEnd));
//clear gui
$('.row input').removeClass('h');
$('#numbers div').removeClass('h');
@ -3939,6 +3941,18 @@ gui.counterFormat = function (t, normal, prevent) {
gui.shootGoto(t);
}
};
gui.notify = function (title, message) {
'use strict';
notifier.notify({
title: title,
message: message,
//icon: path.join(__dirname, 'coulson.jpg'), // Absolute path (doesn't work on balloons)
sound: true, // Only Notification Center or Windows Toasters
wait: true // Wait with callback, until user action is taken against notification
}, function (err, response) {
// Response is response from notification
});
};
gui.shootGoto = function (t) {
var elem = $(t),
id = elem.attr('id').split('_'),

View File

@ -2,7 +2,6 @@ var electron = require('electron'),
fs = require('fs'),
Menu = require('menu'),
MenuItem = require('menu-item'),
notifier = require('node-notifier'),
ipcMain = require('electron').ipcMain,
app = electron.app,
BrowserWindow = electron.BrowserWindow,