From 176643f148c8339af32d746300eb5f75ed4b1fce Mon Sep 17 00:00:00 2001 From: mattmcw Date: Sun, 6 Aug 2023 14:36:31 -0400 Subject: [PATCH] Manual merge from capper branch: all changes to display library. --- app/data/cfg.json | 2 +- app/lib/display/index.js | 21 +++++++++++++-------- app/lib/display/index.js.map | 2 +- app/package-lock.json | 2 +- app/package.json | 2 +- data/cfg.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- processing/mcopy/cfg.json | 2 +- src/display/index.ts | 23 +++++++++++++++-------- 10 files changed, 37 insertions(+), 25 deletions(-) diff --git a/app/data/cfg.json b/app/data/cfg.json index f19ba21..ab04d88 100644 --- a/app/data/cfg.json +++ b/app/data/cfg.json @@ -1,5 +1,5 @@ { - "version": "1.7.22", + "version": "1.7.23", "ext_port": 1111, "profiles": { "mcopy": { diff --git a/app/lib/display/index.js b/app/lib/display/index.js index bb2ef5f..f736439 100644 --- a/app/lib/display/index.js +++ b/app/lib/display/index.js @@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = require("path"); const url_1 = require("url"); const delay_1 = require("delay"); +const Log = require("log"); const { BrowserWindow } = require('electron'); class WebView { constructor(platform, display) { @@ -31,6 +32,7 @@ class WebView { pathname: pagePath, protocol: 'file:' }); + this.init(); if (!display.primary) { prefs.x = display.x + 50; prefs.y = display.y + 50; @@ -51,6 +53,9 @@ class WebView { this.ipc = require('electron').ipcMain; this.ipc.on('display_load', this.onLoad.bind(this)); } + async init() { + this.log = await Log({ label: 'devices' }); + } async open() { this.digitalWindow.show(); this.showing = true; @@ -64,14 +69,14 @@ class WebView { async show(src) { const normalSrc = path_1.normalize(path_1.join(src)); if (!this.digitalWindow) { - console.warn(`Cannot show "${src}" because window does not exist`); + this.log.warn(`Cannot show "${src}" because window does not exist`); return false; } try { this.digitalWindow.webContents.send('display', { src: normalSrc }); } catch (err) { - console.error(err); + this.log.error(err); } this.showing = true; return new Promise(function (resolve) { @@ -86,7 +91,7 @@ class WebView { } async focus() { if (!this.digitalWindow) { - console.warn(`Cannot show focus screen because window does not exist`); + this.log.warn(`Cannot show focus screen because window does not exist`); return false; } await delay_1.delay(500); @@ -94,12 +99,12 @@ class WebView { this.digitalWindow.webContents.send('focus', { focus: true }); } catch (err) { - console.error(err); + this.log.error(err); } } async field(ratio) { if (!this.digitalWindow) { - console.warn(`Cannot show field guide because window does not exist`); + this.log.warn(`Cannot show field guide because window does not exist`); return false; } await delay_1.delay(500); @@ -107,12 +112,12 @@ class WebView { this.digitalWindow.webContents.send('field', { field: true, ratio }); } catch (err) { - console.error(err); + this.log.error(err); } } async meter() { if (!this.digitalWindow) { - console.warn(`Cannot show meter screen because window does not exist`); + this.log.warn(`Cannot show meter screen because window does not exist`); return false; } await delay_1.delay(500); @@ -120,7 +125,7 @@ class WebView { this.digitalWindow.webContents.send('meter', { meter: true }); } catch (err) { - console.error(err); + this.log.error(err); } } hide() { diff --git a/app/lib/display/index.js.map b/app/lib/display/index.js.map index 4587ffd..5ba7231 100644 --- a/app/lib/display/index.js.map +++ b/app/lib/display/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/display/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;IAGI;AAEJ,+BAAoE;AACpE,6BAA0C;AAC1C,iCAA8B;AAE9B,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE9C,MAAM,OAAO;IASZ,YAAa,QAAiB,EAAE,OAAa;QAPtC,WAAM,GAAa,KAAK,CAAC;QACzB,YAAO,GAAa,KAAK,CAAC;QAGzB,aAAQ,GAAS,EAAE,CAAC;QAI3B,MAAM,KAAK,GAAS;YACnB,cAAc,EAAE;gBACV,eAAe,EAAE,IAAI;gBACrB,2BAA2B,EAAE,KAAK;gBAClC,kBAAkB,EAAE,IAAI;gBACxB,gBAAgB,EAAE,KAAK;aACzB;YACJ,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG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Q,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACnD,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;SACrB;IACF,CAAC;IACM,KAAK,CAAC,IAAI,CAAE,GAAY;QAC9B,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACM,KAAK,CAAC,QAAQ,CAAE,OAAgB;QACtC,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IACM,IAAI;IAEX,CAAC;IACM,KAAK,CAAC,KAAK;QACjB,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAA;IAC7B,CAAC;IACM,KAAK,CAAC,KAAK;QACjB,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;IACM,KAAK,CAAC,KAAK,CAAG,KAAc;QAClC,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IACM,KAAK,CAAC,KAAK;QACjB,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;IACM,MAAM,CAAE,EAAQ;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAa,EAAE,EAAE;YACnD,IAAI,OAAO,CAAC,EAAE,IAAI,EAAE;gBAAE,OAAO,IAAI,CAAC;QACnC,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,GAAS;IACnC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC,CAAA"} \ No newline at end of file diff --git a/app/package-lock.json b/app/package-lock.json index ca01dcd..51b8871 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,6 +1,6 @@ { "name": "mcopy-app", - "version": "1.7.22", + "version": "1.7.23", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/app/package.json b/app/package.json index 36393a7..c6d50ae 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "mcopy-app", - "version": "1.7.22", + "version": "1.7.23", "description": "GUI for the mcopy small gauge film optical printer platform", "main": "main.js", "scripts": { diff --git a/data/cfg.json b/data/cfg.json index f19ba21..ab04d88 100644 --- a/data/cfg.json +++ b/data/cfg.json @@ -1,5 +1,5 @@ { - "version": "1.7.22", + "version": "1.7.23", "ext_port": 1111, "profiles": { "mcopy": { diff --git a/package-lock.json b/package-lock.json index 9c1ea77..6b6a67a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mcopy", - "version": "1.7.22", + "version": "1.7.23", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mcopy", - "version": "1.7.22", + "version": "1.7.23", "license": "MIT", "dependencies": { "arduino": "file:app/lib/arduino", diff --git a/package.json b/package.json index d5f29d0..344b1a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mcopy", - "version": "1.7.22", + "version": "1.7.23", "description": "Small gauge film optical printer platform", "main": "build.js", "directories": { diff --git a/processing/mcopy/cfg.json b/processing/mcopy/cfg.json index f19ba21..ab04d88 100644 --- a/processing/mcopy/cfg.json +++ b/processing/mcopy/cfg.json @@ -1,5 +1,5 @@ { - "version": "1.7.22", + "version": "1.7.23", "ext_port": 1111, "profiles": { "mcopy": { diff --git a/src/display/index.ts b/src/display/index.ts index 44e03b2..01da311 100644 --- a/src/display/index.ts +++ b/src/display/index.ts @@ -8,6 +8,7 @@ import { join as pathJoin, normalize as pathNormalize } from 'path'; import { format as urlFormat } from 'url'; import { delay } from 'delay'; +import Log = require('log'); const { BrowserWindow } = require('electron'); @@ -19,6 +20,7 @@ class WebView { public display : any; private loadWait : any = {}; private ipc : any; + private log : any; constructor (platform : string, display : any) { const prefs : any = { @@ -39,6 +41,8 @@ class WebView { pathname : pagePath, protocol : 'file:' }); + + this.init(); if (!display.primary) { prefs.x = display.x + 50; prefs.y = display.y + 50; @@ -61,6 +65,9 @@ class WebView { this.ipc.on('display_load', this.onLoad.bind(this)); } + async init () { + this.log = await Log({ label : 'devices' }) + } async open () { this.digitalWindow.show(); this.showing = true; @@ -74,13 +81,13 @@ class WebView { async show (src : string) { const normalSrc : string = pathNormalize(pathJoin(src)); if (!this.digitalWindow) { - console.warn(`Cannot show "${src}" because window does not exist`); + this.log.warn(`Cannot show "${src}" because window does not exist`) return false; } try { this.digitalWindow.webContents.send('display', { src : normalSrc }); } catch (err) { - console.error(err); + this.log.error(err); } this.showing = true; @@ -97,38 +104,38 @@ class WebView { } async focus () { if (!this.digitalWindow) { - console.warn(`Cannot show focus screen because window does not exist`); + this.log.warn(`Cannot show focus screen because window does not exist`); return false; } await delay(500); try { this.digitalWindow.webContents.send('focus', { focus : true }); } catch (err) { - console.error(err); + this.log.error(err); } } async field (ratio : number) { if (!this.digitalWindow) { - console.warn(`Cannot show field guide because window does not exist`); + this.log.warn(`Cannot show field guide because window does not exist`); return false; } await delay(500); try { this.digitalWindow.webContents.send('field', { field : true, ratio }); } catch (err) { - console.error(err); + this.log.error(err); } } async meter () { if (!this.digitalWindow) { - console.warn(`Cannot show meter screen because window does not exist`); + this.log.warn(`Cannot show meter screen because window does not exist`); return false; } await delay(500); try { this.digitalWindow.webContents.send('meter', { meter : true }); } catch (err) { - console.error(err); + this.log.error(err); } } hide () {