diff --git a/README.md b/README.md index 9602ef4..05e4413 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ An Electron-based application capable of configuring the functionality of the Au For more details on the device itself, visit [www.openacousticdevices.info](http://www.openacousticdevices.info). ### Usage ### -Once the repository has been cloned, install all required dependencies with: +Once the repository has been cloned, you must either have electron-builder installed globally, or get it for the app specifically by running: ``` npm install ``` -From then onwards, start the application with: +From then onwards, or if you already had electron-builder installed, start the application with: ``` npm run start ``` diff --git a/main.js b/main.js index 60af307..73b0ea9 100644 --- a/main.js +++ b/main.js @@ -27,6 +27,7 @@ const iconLocation = (process.platform === 'linux') ? '/build/icon.png' : '/buil const standardWindowSettings = { resizable: false, fullscreenable: false, + minimizable: false, autoHideMenuBar: true, icon: path.join(__dirname, iconLocation), useContentSize: true, diff --git a/package.json b/package.json index f31cbc5..8c51538 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "AudioMoth-Config", - "version": "1.11.0", + "version": "1.11.1", "description": "The configuration app for the AudioMoth acoustic monitoring device.", "main": "main.js", "author": "openacousticdevices.info", diff --git a/uiIndex.js b/uiIndex.js index 2280868..154f97b 100644 --- a/uiIndex.js +++ b/uiIndex.js @@ -1538,7 +1538,7 @@ configureButton.addEventListener('click', () => { let message = 'The '; message += sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'sunrise and sunset' : 'dawn and dusk'; - message += ' recording periods have zero duration. This means the AudioMoth will not record when in CUSTOM mode.'; + message += ' recording periods have zero duration. Extend both intervals to configure.'; dialog.showMessageBoxSync({ type: 'error', @@ -1552,11 +1552,13 @@ configureButton.addEventListener('click', () => { } - if ((sunMode === constants.MODE_BEFORE_SUNRISE_AFTER_SUNRISE || sunMode === constants.MODE_BEFORE_BOTH_AFTER_BOTH) && noSunrise) { + if (sunMode === constants.MODE_BEFORE_SUNRISE_AFTER_SUNRISE && noSunrise) { let message = 'The '; message += sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'sunrise' : 'dawn'; - message += ' recording period has zero duration. This means the AudioMoth will not record around sunrise when in CUSTOM mode.'; + message += ' recording period has zero duration. Extend the '; + message += sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'sunrise' : 'dawn'; + message += ' interval to configure.'; dialog.showMessageBoxSync({ type: 'error', @@ -1570,11 +1572,95 @@ configureButton.addEventListener('click', () => { } - if ((sunMode === constants.MODE_BEFORE_SUNSET_AFTER_SUNSET || sunMode === constants.MODE_BEFORE_BOTH_AFTER_BOTH) && noSunset) { + if (sunMode === constants.MODE_BEFORE_SUNSET_AFTER_SUNSET && noSunset) { let message = 'The '; message += sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'sunset' : 'dusk'; - message += ' recording period has zero duration. This means the AudioMoth will not record around sunrise when in CUSTOM mode.'; + message += ' recording period has zero duration. Extend the '; + message += sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'sunset' : 'dusk'; + message += ' interval to configure.'; + + dialog.showMessageBoxSync({ + type: 'error', + title: 'No recording periods', + message + }); + + console.log('Configuration cancelled'); + + return; + + } + + if (sunMode === constants.MODE_BEFORE_BOTH_AFTER_BOTH && noSunrise) { + + let message = 'The '; + message += sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'sunrise' : 'dawn'; + message += ' recording period has zero duration. Switch to "'; + switch (sunDefinitionIndex) { + + case constants.SUNRISE_AND_SUNSET: + message += 'Sunset'; + break; + + case constants.CIVIL_DAWN_AND_DUSK: + message += 'Civil Dusk'; + break; + + case constants.NAUTICAL_DAWN_AND_DUSK: + message += 'Nautical Dusk'; + break; + + case constants.ASTRONOMICAL_DAWN_AND_DUSK: + message += 'Astro Dusk'; + break; + + } + + message += '" recording mode or extend the '; + message += sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'sunrise' : 'dawn'; + message += ' interval to configure.'; + + dialog.showMessageBoxSync({ + type: 'error', + title: 'No recording periods', + message + }); + + console.log('Configuration cancelled'); + + return; + + } + + if (sunMode === constants.MODE_BEFORE_BOTH_AFTER_BOTH && noSunset) { + + let message = 'The '; + message += sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'sunset' : 'dusk'; + message += ' recording period has zero duration. Switch to "'; + switch (sunDefinitionIndex) { + + case constants.SUNRISE_AND_SUNSET: + message += 'Sunrise'; + break; + + case constants.CIVIL_DAWN_AND_DUSK: + message += 'Civil Dawn'; + break; + + case constants.NAUTICAL_DAWN_AND_DUSK: + message += 'Nautical Dawn'; + break; + + case constants.ASTRONOMICAL_DAWN_AND_DUSK: + message += 'Astro Dawn'; + break; + + } + + message += '" recording mode or extend the '; + message += sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'sunset' : 'dusk'; + message += ' interval to configure.'; dialog.showMessageBoxSync({ type: 'error', @@ -1590,16 +1676,16 @@ configureButton.addEventListener('click', () => { if (sunRecordingPeriods.length === 0) { - let messageText = sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'Sunrise and sunset ' : 'Dawn and dusk'; - messageText += 'calculation shows no recording periods for the '; - messageText += firstRecordingDateCheckbox.checked ? 'selected first recording date. ' : 'current date. '; - messageText += 'This means the AudioMoth may not record when in CUSTOM mode. Are you sure you wish to apply this configuration?'; + let message = sunDefinitionIndex === constants.SUNRISE_AND_SUNSET ? 'Sunrise and sunset' : 'Dawn and dusk'; + message += ' calculation shows no recording periods for the '; + message += firstRecordingDateCheckbox.checked ? 'selected first recording date' : 'current date'; + message += '. This means the AudioMoth may not record when in CUSTOM mode. Are you sure you wish to apply this configuration?'; const buttonIndex = dialog.showMessageBoxSync({ type: 'warning', buttons: ['Yes', 'No'], title: 'No recording periods', - message: messageText + message }); if (buttonIndex === 1) {