Skip to content

Commit

Permalink
Add option to use colours in HAL
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed May 29, 2024
1 parent 7a7ce42 commit 761f9df
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "José Sánchez-Gallego",
"email": "gallegoj@uw.edu"
},
"version": "0.4.6",
"version": "0.4.7",
"description": "SDSS observer graphical user interface",
"repository": "github:albireox/boson",
"homepage": "https://github.com/albireox/boson",
Expand Down
3 changes: 3 additions & 0 deletions src/main/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ const store = new Store({
'STUI_Silence.wav',
]);
},
'>=0.4.7': (st) => {
st.set('hal.useColours', false);
},
},
});

Expand Down
61 changes: 48 additions & 13 deletions src/main/store/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
},
"hal": {
"allowGotoFieldAutoMode": true,
"syncStages": false
"syncStages": false,
"useColours": false
},
"log": {
"wrap": false,
Expand All @@ -53,18 +54,52 @@
"exposure_start": "woodblock.wav",
"exposure_end": "bell_soft_long.wav"
},
"user_sounds": ["bar_long.wav", "bell_soft_long.wav", "bell_soft_short.wav",
"buzz_error_long.wav", "buzz_error_short.wav", "chime_long.wav",
"click.wav", "cowbell_high.wav", "cowbell_low.wav", "error.wav",
"high_buzz_error.wav", "hit_long.wav", "jingle_bell.wav", "low_error.wav",
"marimba.wav", "marimba_sharp.wav", "synth_error_long.wav",
"synth_soft_short.wav","synth_string_echo.wav", "synth_strings_long.wav",
"synth_strings_short.wav","woodblock.wav","AxisHalt.wav", "ExposureEnds.wav",
"MessageReceived.wav", "AxisSlew.wav", "STUI_AxisHalt.wav","STUI_AxisSlew.wav",
"STUI_AxisTrack.wav","STUI_CommandDone.wav","STUI_CommandFailed.wav","STUI_CriticalAlert.wav",
"STUI_ExposureBegins.wav","STUI_ExposureEnds.wav","STUI_FiducialCrossing.wav","STUI_Glass.wav",
"STUI_GuidingBegins.wav","STUI_GuidingEnds.wav","STUI_GuidingFailed.wav","STUI_LogHighlightedText.wav",
"STUI_MessageReceived.wav","STUI_NoGuideStar.wav","STUI_SeriousAlert.wav","STUI_Silence.wav"]
"user_sounds": [
"bar_long.wav",
"bell_soft_long.wav",
"bell_soft_short.wav",
"buzz_error_long.wav",
"buzz_error_short.wav",
"chime_long.wav",
"click.wav",
"cowbell_high.wav",
"cowbell_low.wav",
"error.wav",
"high_buzz_error.wav",
"hit_long.wav",
"jingle_bell.wav",
"low_error.wav",
"marimba.wav",
"marimba_sharp.wav",
"synth_error_long.wav",
"synth_soft_short.wav",
"synth_string_echo.wav",
"synth_strings_long.wav",
"synth_strings_short.wav",
"woodblock.wav",
"AxisHalt.wav",
"ExposureEnds.wav",
"MessageReceived.wav",
"AxisSlew.wav",
"STUI_AxisHalt.wav",
"STUI_AxisSlew.wav",
"STUI_AxisTrack.wav",
"STUI_CommandDone.wav",
"STUI_CommandFailed.wav",
"STUI_CriticalAlert.wav",
"STUI_ExposureBegins.wav",
"STUI_ExposureEnds.wav",
"STUI_FiducialCrossing.wav",
"STUI_Glass.wav",
"STUI_GuidingBegins.wav",
"STUI_GuidingEnds.wav",
"STUI_GuidingFailed.wav",
"STUI_LogHighlightedText.wav",
"STUI_MessageReceived.wav",
"STUI_NoGuideStar.wav",
"STUI_SeriousAlert.wav",
"STUI_Silence.wav"
]
},
"maxLogMessages": 50000,
"updateChannel": "stable",
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/HAL/ApogeeDomeFlat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function ApogeeDomeFlat() {
const isRunning = useIsMacroRunning(macroName);

return (
<MacroPaper>
<MacroPaper backcolor='#FF980030'>
<Stack
direction='column'
divider={<Divider variant='middle' sx={{ opacity: 0.8 }} />}
Expand Down
14 changes: 12 additions & 2 deletions src/renderer/HAL/Components/MacroPaper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,30 @@
import { Paper } from '@mui/material';
import React from 'react';
import { useAutoPilotMacroName } from 'renderer/HAL/AutoPilot';
import { useStore } from 'renderer/hooks';
import useIsMacroRunning from 'renderer/hooks/useIsMacroRunning';

export default function MacroPaper(props: React.PropsWithChildren) {
const { children } = props;
interface MacroPaperProps {
backcolor?: string;
children: React.ReactNode;
}

export default function MacroPaper(props: MacroPaperProps) {
const { backcolor, children } = props;

const autoPilotMacroName = useAutoPilotMacroName();
const autoIsRunning = useIsMacroRunning(autoPilotMacroName);

const [useBackcolor] = useStore<boolean>('hal.useColours');

console.log(useBackcolor);
return (
<Paper
variant='outlined'
sx={{
pointerEvents: autoIsRunning ? 'none' : 'inherit',
opacity: autoIsRunning ? 0.6 : 'inherit',
backgroundColor: useBackcolor && backcolor ? backcolor : 'inherit',
}}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/HAL/Expose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export default function Expose() {

return (
<>
<MacroPaper>
<MacroPaper backcolor='#448AFF30'>
<Stack
direction='column'
divider={<Divider variant='middle' sx={{ opacity: 0.8 }} />}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/HAL/GotoField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default function GotoField() {
}, [configurationLoadedKw, isExposing]);

return (
<MacroPaper>
<MacroPaper backcolor='#F4433630'>
<Stack
direction='column'
divider={<Divider variant='middle' sx={{ opacity: 0.8 }} />}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/HAL/Scripts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default function Scripts() {
}, [runningScriptsKw, handleScriptChange]);

return (
<MacroPaper>
<MacroPaper backcolor='#9C27B030'>
<Stack
alignItems='baseline'
direction='row'
Expand Down
11 changes: 11 additions & 0 deletions src/renderer/Preferences/Panes/Tools/HALPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ function SyncStages() {
);
}

function UseColours() {
return (
<BooleanOption
param='hal.useColours'
title='Use colours'
description='Use different colours for the background of the HAL macros'
/>
);
}

export default function LogWindowPane() {
return (
<Pane title='HAL'>
Expand All @@ -38,6 +48,7 @@ export default function LogWindowPane() {
<Stack width='100%' direction='column' spacing={2.5}>
<GotoAutoMode />
<SyncStages />
<UseColours />
</Stack>
</Grid>
</Grid>
Expand Down

0 comments on commit 761f9df

Please sign in to comment.