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

View File

@ -64,6 +64,43 @@ class WebView {
await delay_1.delay(100);
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() {
if (this.digitalWindow) {
this.digitalWindow.hide();
@ -135,6 +172,9 @@ class Display {
//await this.eog.show(tmppath);
//}
}
async showPath(pathStr) {
return await this.wv.show(pathStr);
}
hide() {
//if (this.platform !== 'nix') {
//don't hide between frames
@ -150,6 +190,15 @@ class Display {
//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) {
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';
ipcRenderer.on('ready', devices.ready);
ipcRenderer.on('intval', devices.intvalCb);
ipcRenderer.on('digital', devices.digitalCb);
ipcRenderer.on('filmout', devices.digitalCb);
};
devices.ready = function (event, arg) {
'use strict';
@ -209,7 +209,7 @@ devices.digital = function () {
if (proceed) {
gui.overlay(true);
gui.spinner(true, `Getting info about ${fileName}`);
ipcRenderer.send('digital', obj)
ipcRenderer.send('filmout', obj)
} else {
$('#projector_type_digital').prop('checked', 'checked');
$('#digital').removeClass('active');

View File

@ -64,6 +64,43 @@ class WebView {
await delay_1.delay(100);
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() {
if (this.digitalWindow) {
this.digitalWindow.hide();
@ -135,6 +172,9 @@ class Display {
//await this.eog.show(tmppath);
//}
}
async showPath(pathStr) {
return await this.wv.show(pathStr);
}
hide() {
//if (this.platform !== 'nix') {
//don't hide between frames
@ -150,6 +190,15 @@ class Display {
//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) {
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);
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() {
if (this.digitalWindow) {
this.digitalWindow.hide();
@ -135,6 +172,9 @@ class Display {
//await this.eog.show(tmppath);
//}
}
async showPath(pathStr) {
return await this.wv.show(pathStr);
}
hide() {
//if (this.platform !== 'nix') {
//don't hide between frames
@ -150,6 +190,15 @@ class Display {
//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) {
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);
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 () {
if (this.digitalWindow) {
this.digitalWindow.hide();
@ -155,6 +189,9 @@ class Display {
//await this.eog.show(tmppath);
//}
}
public async showPath (pathStr : string) {
return await this.wv.show(pathStr);
}
public hide () {
//if (this.platform !== 'nix') {
//don't hide between frames
@ -170,6 +207,15 @@ class Display {
//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) {