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

View File

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

View File

@ -3039,6 +3039,7 @@ BB - Black backwards
*/ */
var remote = require('remote'), var remote = require('remote'),
dialog = require('electron').remote.dialog, dialog = require('electron').remote.dialog,
notifier = require('node-notifier'),
fs = require('fs'), fs = require('fs'),
uuid = require('node-uuid'), uuid = require('node-uuid'),
moment = require('moment'), moment = require('moment'),
@ -3214,6 +3215,7 @@ seq.run = function () {
} else { } else {
log.info('Sequence completed in ' + humanizeDuration(timeEnd), 'SEQUENCE', true); 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 //clear gui
$('.row input').removeClass('h'); $('.row input').removeClass('h');
$('#numbers div').removeClass('h'); $('#numbers div').removeClass('h');
@ -3939,6 +3941,18 @@ gui.counterFormat = function (t, normal, prevent) {
gui.shootGoto(t); 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) { gui.shootGoto = function (t) {
var elem = $(t), var elem = $(t),
id = elem.attr('id').split('_'), id = elem.attr('id').split('_'),

View File

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