Skip to content
Permalink
Browse files

Logs panel and cpp objects wrapping

  • Loading branch information...
Adam Kozłowski Adam Kozłowski
Adam Kozłowski authored and Adam Kozłowski committed Apr 29, 2017
1 parent fe382da commit 84974d028f5b2669e41db8b4c0ecd54b3d4ebb1b
BIN +0 Bytes (100%) .DS_Store
Binary file not shown.
@@ -5,6 +5,7 @@
<title></title>
<link rel="stylesheet" href="stylesheets/application.css" />
<link rel="stylesheet" href="stylesheets/logsWindow.css" />
<link rel="stylesheet" href="stylesheets/logsPanel.css" />

<script src="javascripts/renderer/application.js" type="text/javascript"></script>
</head>
@@ -12,8 +12,11 @@ path = require('path');
json = require('../../package.json');
electron = require('electron');

const {ipcMain} = require('electron')

// Import windows creation logic
prepareMainWindow = require('./mainWindow').prepareMainWindow
prepareLogsWindow = require('./logger').prepareLogsWindow


electron.app.on('ready', function() {
@@ -45,3 +48,12 @@ electron.app.on('ready', function() {

var window = prepareMainWindow(electron.app, _onWindowLoaded);
});


ipcMain.on('logs_detached', (event, args) => {
console.log(args);
// Create window and attach on load
var window = prepareLogsWindow(()=> {
window.webContents.send('attach_logs_node_window', args);
});
});
@@ -5,12 +5,35 @@ json = require('../../package.json');
electron = require('electron');


export function prepareLogsWindow(logsNode)
exports.prepareLogsWindow = function(onLoad)
{
var window;

window = new electron.BrowserWindow({
title: "Logs",
width: 400,
height: 300
});

window.loadURL('file://' + path.join(__dirname, '..', '..') + '/logsWindow.html');

window.webContents.on('did-finish-load', function(){
if (onLoad) {
onLoad();
}
});

window.on('closed', function() {
window = null;

// Re-attach

});

return window;
}

export function prepareLogsNode()
exports.prepareLogsNode = function ()
{

}
@@ -30,6 +30,13 @@ exports.prepareMainWindow = function(app, onLoad)

if (onLoad) {
onLoad();

console.log(cougar);
console.log(cougar.SerialPort());

console.log("TEST");
console.log(cougar.SerialPort().GetDevices());
console.log("TEST END");
}
});

@@ -1,5 +1,5 @@
const { ipcRenderer } = require('electron');
$ = require('jquery');
const $ = require('jquery');

ipcRenderer.on('loaded', function(event, data) {
document.getElementById('title').innerHTML = data.appName + ' App';
@@ -16,6 +16,9 @@ ipcRenderer.on('loaded', function(event, data) {
<button id="logsButtonInfo"><input type="checkbox" checked>INFO</input></button>
<button id="logsButtonDebug"><input type="checkbox" checked>DEBUG</input></button>
<button id="logsButtonDetach">Swap</button>
<table id="logsTable">
<thead>
<th id="logsTableHeader">Timestamp</th>
@@ -35,11 +38,15 @@ ipcRenderer.on('loaded', function(event, data) {
}
};

// Actions
// Actions --------
$("#logsButtonClear").on("click", function(){
$("#logsTable tbody").empty();
});

$("#logsButtonDetach").on("click", function(){
ipcRenderer.send('logs_detached', $("#logsTableContainer").detach());
});

$("#logsButtonError").on("click", function(){ hideWithClass("#logsButtonError", ".logsTableError") });
$("#logsButtonWarning").on("click", function(){ hideWithClass("#logsButtonWarning", ".logsTableWarning") });
$("#logsButtonInfo").on("click", function(){ hideWithClass("#logsButtonInfo", ".logsTableInfo") });
@@ -3,8 +3,8 @@
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="stylesheets/logsWindow.css" />
<!--<script src="javascripts/renderer/application.js" type="text/javascript"></script>-->
<link rel="stylesheet" href="stylesheets/logsPanel.css" />
<script src="javascripts/renderer/logsWindow.js" type="text/javascript"></script>
</head>
<body>
<div class="message">
@@ -4,23 +4,8 @@
font-size: 0.75em;
}

#logsTableContainer {
position: absolute;
left: 0;
bottom: 0;

margin: 2px;
border-top: 1px solid gray;

width: 100%;
height: 200px;
resize: vertical;

overflow-y: auto;
display: block;
}

#logsTableHeader {
color: lightgray;
font-variant: small-caps;
}

@@ -47,4 +32,4 @@

.logsTableInfo {
color: lightgreen;
}
}
Binary file not shown.
@@ -70,7 +70,6 @@ namespace Cougar_Bluetooth {
*/
static NAN_METHOD(GetStatus)
{

Cougar_Bluetooth* obj = Nan::ObjectWrap::Unwrap<Cougar_Bluetooth>(info.Holder());

switch(obj->_cougarBluetooth->GetStatus())
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 84974d0

Please sign in to comment.
You can’t perform that action at this time.