Display will now show a meter screen (middle grey) when instructed. Not wired to anything, got distracted by the re-naming shenanigans.

This commit is contained in:
mmcwilliams 2019-06-18 15:47:17 -04:00
parent 22187777e7
commit 49f9f7f160
9 changed files with 208 additions and 10 deletions

View File

@ -65,13 +65,13 @@
//img.src = src //img.src = src
}) })
} }
async function setMeter () { async function onMeter () {
let body = document.querySelector('body') const body = document.querySelector('body')
if (!body.classList.contains('meter')) { if (!body.classList.contains('meter')) {
body.classList.add('meter') body.classList.add('meter')
} }
} }
async function setGrid () { async function onField () {
const can = document.getElementById('can') const can = document.getElementById('can')
const ctx = can.getContext('2d') const ctx = can.getContext('2d')
if (!can.classList.contains('show')) { if (!can.classList.contains('show')) {
@ -82,24 +82,27 @@
can.style.width = `${window.innerWidth}px` can.style.width = `${window.innerWidth}px`
can.style.height = `${window.innerHeight}px` can.style.height = `${window.innerHeight}px`
try{ try{
await drawGrid(can, ctx) await drawField(can, ctx)
} catch (err) { } catch (err) {
alert(JSON.stringify(err)) alert(JSON.stringify(err))
} }
} }
async function drawGrid (can, ctx) { // draw a field guide
async function drawField (can, ctx) {
const count = 20 const count = 20
const half = Math.round(count / 2) const half = Math.round(count / 2)
const w = can.width const w = can.width
const h = can.height const h = can.height
const wsec = w / count const wsec = w / count
const hsec= h / count const hsec= h / count
ctx.moveTo(w / 2, 0) ctx.moveTo(w / 2, 0)
ctx.lineTo(w / 2, h) ctx.lineTo(w / 2, h)
ctx.stroke() ctx.stroke()
ctx.moveTo(0, h / 2) ctx.moveTo(0, h / 2)
ctx.lineTo(w, h / 2) ctx.lineTo(w, h / 2)
ctx.stroke() ctx.stroke()
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
ctx.moveTo(wsec * i, hsec * i) ctx.moveTo(wsec * i, hsec * i)
ctx.lineTo(wsec * i, h - (hsec * i)) ctx.lineTo(wsec * i, h - (hsec * i))
@ -155,6 +158,8 @@
} }
} }
ipcRenderer.on('display', onDigital) ipcRenderer.on('display', onDigital)
ipcRenderer.on('field', onField)
ipcRenderer.on('meter', onMeter)
document.onkeydown = onEscape document.onkeydown = onEscape
</script> </script>
</body> </body>

View File

@ -64,6 +64,43 @@ class WebView {
await delay_1.delay(100); await delay_1.delay(100);
return true; return true;
} }
async focus() {
if (!this.digitalWindow) {
console.warn(`Cannot show focus screen because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('focus', { focus: true });
}
catch (err) {
console.error(err);
}
}
async field() {
if (!this.digitalWindow) {
console.warn(`Cannot show field guide because window does not exist`);
return false;
}
//aspect ratio
try {
this.digitalWindow.webContents.send('field', { field: true });
}
catch (err) {
console.error(err);
}
}
async meter() {
if (!this.digitalWindow) {
console.warn(`Cannot show meter screen because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('meter', { meter: true });
}
catch (err) {
console.error(err);
}
}
hide() { hide() {
if (this.digitalWindow) { if (this.digitalWindow) {
this.digitalWindow.hide(); this.digitalWindow.hide();
@ -135,6 +172,9 @@ class Display {
//await this.eog.show(tmppath); //await this.eog.show(tmppath);
//} //}
} }
async showPath(pathStr) {
return await this.wv.show(pathStr);
}
hide() { hide() {
//if (this.platform !== 'nix') { //if (this.platform !== 'nix') {
//don't hide between frames //don't hide between frames
@ -150,6 +190,15 @@ class Display {
//this.eog.close() //this.eog.close()
//} //}
} }
async focus() {
return await this.wv.focus();
}
async field() {
return await this.wv.field();
}
async meter() {
return await this.wv.meter();
}
} }
module.exports = function (sys) { module.exports = function (sys) {
return new Display(sys); return new Display(sys);

File diff suppressed because one or more lines are too long

View File

@ -42,7 +42,7 @@ devices.listen = function () {
'use strict'; 'use strict';
ipcRenderer.on('ready', devices.ready); ipcRenderer.on('ready', devices.ready);
ipcRenderer.on('intval', devices.intvalCb); ipcRenderer.on('intval', devices.intvalCb);
ipcRenderer.on('digital', devices.digitalCb); ipcRenderer.on('filmout', devices.digitalCb);
}; };
devices.ready = function (event, arg) { devices.ready = function (event, arg) {
'use strict'; 'use strict';
@ -209,7 +209,7 @@ devices.digital = function () {
if (proceed) { if (proceed) {
gui.overlay(true); gui.overlay(true);
gui.spinner(true, `Getting info about ${fileName}`); gui.spinner(true, `Getting info about ${fileName}`);
ipcRenderer.send('digital', obj) ipcRenderer.send('filmout', obj)
} else { } else {
$('#projector_type_digital').prop('checked', 'checked'); $('#projector_type_digital').prop('checked', 'checked');
$('#digital').removeClass('active'); $('#digital').removeClass('active');

View File

@ -64,6 +64,43 @@ class WebView {
await delay_1.delay(100); await delay_1.delay(100);
return true; return true;
} }
async focus() {
if (!this.digitalWindow) {
console.warn(`Cannot show focus screen because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('focus', { focus: true });
}
catch (err) {
console.error(err);
}
}
async field() {
if (!this.digitalWindow) {
console.warn(`Cannot show field guide because window does not exist`);
return false;
}
//aspect ratio
try {
this.digitalWindow.webContents.send('field', { field: true });
}
catch (err) {
console.error(err);
}
}
async meter() {
if (!this.digitalWindow) {
console.warn(`Cannot show meter screen because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('meter', { meter: true });
}
catch (err) {
console.error(err);
}
}
hide() { hide() {
if (this.digitalWindow) { if (this.digitalWindow) {
this.digitalWindow.hide(); this.digitalWindow.hide();
@ -135,6 +172,9 @@ class Display {
//await this.eog.show(tmppath); //await this.eog.show(tmppath);
//} //}
} }
async showPath(pathStr) {
return await this.wv.show(pathStr);
}
hide() { hide() {
//if (this.platform !== 'nix') { //if (this.platform !== 'nix') {
//don't hide between frames //don't hide between frames
@ -150,6 +190,15 @@ class Display {
//this.eog.close() //this.eog.close()
//} //}
} }
async focus() {
return await this.wv.focus();
}
async field() {
return await this.wv.field();
}
async meter() {
return await this.wv.meter();
}
} }
module.exports = function (sys) { module.exports = function (sys) {
return new Display(sys); return new Display(sys);

File diff suppressed because one or more lines are too long

View File

@ -64,6 +64,43 @@ class WebView {
await delay_1.delay(100); await delay_1.delay(100);
return true; return true;
} }
async focus() {
if (!this.digitalWindow) {
console.warn(`Cannot show focus screen because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('focus', { focus: true });
}
catch (err) {
console.error(err);
}
}
async field() {
if (!this.digitalWindow) {
console.warn(`Cannot show field guide because window does not exist`);
return false;
}
//aspect ratio
try {
this.digitalWindow.webContents.send('field', { field: true });
}
catch (err) {
console.error(err);
}
}
async meter() {
if (!this.digitalWindow) {
console.warn(`Cannot show meter screen because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('meter', { meter: true });
}
catch (err) {
console.error(err);
}
}
hide() { hide() {
if (this.digitalWindow) { if (this.digitalWindow) {
this.digitalWindow.hide(); this.digitalWindow.hide();
@ -135,6 +172,9 @@ class Display {
//await this.eog.show(tmppath); //await this.eog.show(tmppath);
//} //}
} }
async showPath(pathStr) {
return await this.wv.show(pathStr);
}
hide() { hide() {
//if (this.platform !== 'nix') { //if (this.platform !== 'nix') {
//don't hide between frames //don't hide between frames
@ -150,6 +190,15 @@ class Display {
//this.eog.close() //this.eog.close()
//} //}
} }
async focus() {
return await this.wv.focus();
}
async field() {
return await this.wv.field();
}
async meter() {
return await this.wv.meter();
}
} }
module.exports = function (sys) { module.exports = function (sys) {
return new Display(sys); return new Display(sys);

File diff suppressed because one or more lines are too long

View File

@ -69,6 +69,40 @@ class WebView {
await delay(100); await delay(100);
return true; return true;
} }
async focus () {
if (!this.digitalWindow) {
console.warn(`Cannot show focus screen because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('focus', { focus : true });
} catch (err) {
console.error(err);
}
}
async field () {
if (!this.digitalWindow) {
console.warn(`Cannot show field guide because window does not exist`);
return false;
}
//aspect ratio
try {
this.digitalWindow.webContents.send('field', { field : true });
} catch (err) {
console.error(err);
}
}
async meter () {
if (!this.digitalWindow) {
console.warn(`Cannot show meter screen because window does not exist`);
return false;
}
try {
this.digitalWindow.webContents.send('meter', { meter : true });
} catch (err) {
console.error(err);
}
}
hide () { hide () {
if (this.digitalWindow) { if (this.digitalWindow) {
this.digitalWindow.hide(); this.digitalWindow.hide();
@ -155,6 +189,9 @@ class Display {
//await this.eog.show(tmppath); //await this.eog.show(tmppath);
//} //}
} }
public async showPath (pathStr : string) {
return await this.wv.show(pathStr);
}
public hide () { public hide () {
//if (this.platform !== 'nix') { //if (this.platform !== 'nix') {
//don't hide between frames //don't hide between frames
@ -170,6 +207,15 @@ class Display {
//this.eog.close() //this.eog.close()
//} //}
} }
public async focus () {
return await this.wv.focus();
}
public async field () {
return await this.wv.field();
}
public async meter () {
return await this.wv.meter();
}
} }
module.exports = function (sys : any) { module.exports = function (sys : any) {