Skip to content

Commit

Permalink
Merge pull request #3 from Bob620/beta
Browse files Browse the repository at this point in the history
Pull beta into master
  • Loading branch information
Bob620 authored Jul 31, 2020
2 parents eff2b8b + 58533ad commit 668ec99
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 174 deletions.
3 changes: 2 additions & 1 deletion constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"LOWERCENTER": "lc",
"BELOWLEFT": "bl",
"BELOWRIGHT": "br",
"BELOWCENTER": "bc"
"BELOWCENTER": "bc",
"JEOL": "jeol"
},
"pointTypes": {
"THERMOLIKE": "thermo",
Expand Down
263 changes: 102 additions & 161 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "probelab-reimager-app",
"productName": "Probelab ReImager",
"version": "1.1.0-stable",
"version": "1.4.0-stable",
"description": "Visual UI for Probelab ReImager using Electron",
"main": "./src/backend/main.js",
"scripts": {
Expand All @@ -13,7 +13,7 @@
"compile": "npm run build-prod && node package.js && cd ./bin/unpackaged && npm install --production && npm run rebuild",
"package": "npm run compile && electron-packager ./bin/unpackaged --out ./bin --overwrite",
"win-package": "npm run compile && electron-packager ./bin/unpackaged --out ./bin --overwrite --platform=win32 --arch=x64",
"postpack": "electron-builder --pd ./dist/win-unpacked"
"postpack": "electron-builder --pd \"./bin/Probelab ReImager-win32-x64\""
},
"browserify": {
"transform": [
Expand Down Expand Up @@ -71,6 +71,17 @@
]
}
]
},
"mac": {
"target": [
{
"sign": false,
"target": "dmg",
"arch": [
"x64"
]
}
]
}
},
"author": "Bob620",
Expand All @@ -89,14 +100,14 @@
"bakadux": "^1.1.0",
"browserify": "^16.5.1",
"browserify-css": "^0.15.0",
"electron": "^9.1.0",
"electron": "^9.1.2",
"electron-builder": "^22.8.0",
"electron-packager": "^15.0.0",
"electron-rebuild": "^1.11.0",
"envify": "^4.1.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-svg": "^11.0.31",
"react-svg": "^11.0.32",
"scssify": "^3.0.1",
"uglify-js": "^3.10.0",
"uglifyify": "^5.0.2"
Expand Down
14 changes: 11 additions & 3 deletions src/backend/children/reimager/functions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs');
const fsPromise = fs.promises;
const { PointShoot, ExtractedMap, constants, JeolImage, PFEImage, getPFEExpectedImages } = require('thermo-reimager');
const {PointShoot, ExtractedMap, constants, JeolImage, PFEImage, getPFEExpectedImages} = require('thermo-reimager');

const appConstants = require('../../../../constants.json');

Expand All @@ -24,6 +24,8 @@ const Functions = {
return constants.scale.types.BELOWRIGHT;
case appConstants.settings.scalePositions.BELOWCENTER:
return constants.scale.types.BELOWCENTER;
case appConstants.settings.scalePositions.JEOL:
return constants.scale.types.JEOL;
}
},
sanitizeColor: inputColor => {
Expand Down Expand Up @@ -72,7 +74,7 @@ const Functions = {

if (inputSettings.png)
settings.png = inputSettings.png;
if(inputSettings.jpeg)
if (inputSettings.jpeg)
settings.jpeg = inputSettings.jpeg;
if (inputSettings.tiff)
settings.tiff = inputSettings.tiff;
Expand Down Expand Up @@ -119,11 +121,17 @@ const Functions = {
return [];
}
},
createThermo: (file, canvas, uuid=undefined) => {
createThermo: (file, canvas, uuid = undefined) => {
if (file.isFile()) {
let thermo;
const fileName = file.name.toLowerCase();

if (fileName.endsWith(constants.jeol.fileFormats.ENTRY))
try {
thermo = new JeolImage(file, canvas);
} catch(err) {
}

if (fileName.endsWith(constants.pointShoot.fileFormats.ENTRY))
thermo = new PointShoot(file, canvas);

Expand Down
4 changes: 2 additions & 2 deletions src/backend/createwindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const template = [
]
},
*/
/*

// { role: 'viewMenu' }
{
label: 'View',
Expand All @@ -71,7 +71,7 @@ const template = [
{ role: 'togglefullscreen' }
]
},
*/

// { role: 'windowMenu' }
{
label: 'Window',
Expand Down
10 changes: 10 additions & 0 deletions src/components/general/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import GenerateUuid from './generateuuid.js';
import constants from '../../../constants';

import settingStore from '../settings/store.js';
import generalStore from './store.js';
import settingActions from '../settings/actions.js';

const comms = new Communications(new IPC(ipcRenderer));

Expand Down Expand Up @@ -191,6 +193,7 @@ const actions = CreateActions([
//settingStore.set('activePoints', settingStore.get('activePoints').filter(name => image.points[name] !== undefined));
generalStore.set('selectedUuid', uuid);
generalStore.set('selectedImage', undefined);
generalStore.set('jeolImage', false);

settingStore.set('layers', sortLayers(Array.from(image.layers.values()), settingStore.get('layerOrder')));

Expand Down Expand Up @@ -295,11 +298,18 @@ const actions = CreateActions([

generalStore.set('selectedUuids', new Set([uuid]));

if (settingStore.get('scalePosition') === constants.settings.scalePositions.JEOL && !image.jeolFile) {
data.settings.scalePosition = constants.settings.scalePositions.LOWERCENTER;
settingActions.setScalePosition(constants.settings.scalePositions.LOWERCENTER)
}

comms.send('loadImage', data).then(([{uuid, image, data}]) => {
if (generalStore.get('selectedUuid') === uuid)
generalStore.set('selectedImage', image);
if (images.has(uuid))
images.get(uuid).output = data.output;

generalStore.set('jeolImage', data.jeolFile);
actions.navigateHome();
}).catch(() => {
});
Expand Down
31 changes: 31 additions & 0 deletions src/components/miniposition/miniposition.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,35 @@
height: 8px;
}
}

&.jeol {
justify-content: center;
align-items: flex-end;

> :first-child {
background-color: rgba(0,0,0,0);
border-top-width: 2px;
border-top-style: solid;
border-top-color: white;
height: 8px;
display: block;
}

> :last-child {
background-color: rgba(0,0,0,0);
border-top-width: 2px;
border-top-style: solid;
border-top-color: white;
height: 8px;
display: block;
}

> .pos {
background-color: rgba(0,0,0,0);
border-top-width: 2px;
border-top-style: solid;
border-top-color: white;
height: 8px;
}
}
}
6 changes: 6 additions & 0 deletions src/components/options/options.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Options extends Component {
const currentPos = settingStore.get('scalePosition');
const interactable = generalStore.get('interactable');
const optionsList = generalStore.get('optionsList');
const jeolImage = generalStore.get('jeolImage');

return (
<section id='options'>
Expand Down Expand Up @@ -73,6 +74,11 @@ class Options extends Component {
>
<p>Below Right</p>
</div>
<div className={`jeol ${interactable && jeolImage ? 'selectable' : ''} ${currentPos === constants.settings.scalePositions.JEOL ? 'selected' : ''}`}
onClick={interactable && jeolImage ? settingActions.setScalePosition.bind(undefined, constants.settings.scalePositions.JEOL) : () => {}}
>
<p>Jeol-like</p>
</div>
</div>
<div className='toggleables'>
<div>
Expand Down
13 changes: 12 additions & 1 deletion src/components/options/options.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
display: grid;
grid-template-columns: 1fr 10px 1fr 10px 1fr;
grid-template-rows: 1fr 10px 1fr 10px 1fr;
grid-template-areas: "ul . . . ur" ". . . . ." "ll . lc . lr" "f f f f f" "bl fl bc fr br";
grid-template-areas: "ul . . . ur" ". . . . ." "ll . lc . lr" "f f f f f" "bl fl bc fr br""jeol jeol jeol jeol jeol";
height: 200px;
width: calc(90% - 4px);
margin-left: 5%;
Expand Down Expand Up @@ -120,6 +120,17 @@
background-color: white;
color: black;
}

> .jeol {
grid-area: jeol;
background-color: white;
color: black;

> p {
width: fit-content;
padding: 10px;
}
}
}

> .toggleables {
Expand Down
4 changes: 2 additions & 2 deletions tests/reimager.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ outsideComm.send({
type: 'getDir',
uuid: 'get',
data: {
uri: '../../thermo-reimager/tests/data/'
uri: '../../thermo-reimager/test/data/'
}
});

Expand Down Expand Up @@ -109,7 +109,7 @@ setTimeout(() => {
type: 'writeImage',
uuid: 'write',
data: {
uri: '../../thermo-reimager/tests/data/1024(1).PS.EDS/1024(1).p_s',
uri: '../../thermo-reimager/test/data/1024.PS.EDS/1024.p_s',
operations: [{
command: 'addLayer',
args: [{name: 'base'}]
Expand Down

0 comments on commit 668ec99

Please sign in to comment.