Skip to content

Commit

Permalink
fixed processing complete toast icon
Browse files Browse the repository at this point in the history
fixed delay for summary context click
added keyboard styling for keyboard help
adjustspecdims on first result, instead of summary complete
  • Loading branch information
Mattk70 committed Oct 17, 2024
1 parent fcce3b6 commit c06bd27
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 37 deletions.
52 changes: 26 additions & 26 deletions Help/keyboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<td colspan="2" class="text-center text-bg-light"><h5>File handling</h5></td>
</tr>
<tr>
<td><b>Ctrl-O</b></td>
<td><kbd><kbd>Ctrl</kbd>+<kbd>O</kbd></kbd></td>
<td>Show file open dialog</td>
</tr>
<tr>
<td><b>Ctrl-S</b></td>
<td><kbd>Ctrl-S</kbd></td>
<td>Save detections to the records archive.
</td>
</tr>
Expand All @@ -24,116 +24,116 @@
<td colspan="2" class="text-center text-bg-light"><h5>Analysis</h5></td>
</tr>
<tr>
<td><b>Ctrl-A</b></td>
<td><kbd>Ctrl-A</kbd></td>
<td>Analyse the current file.
</td>
</tr>
<tr>
<td><b>Shift-Ctrl-A</b></td>
<td><kbd>Shift-Ctrl-A</kbd></td>
<td>Analyse all open files.
</td>
</tr>
<tr>
<td><b>Esc</b></td>
<td><kbd>Esc</kbd></td>
<td>Stop analysis</td>
</tr>
<tr>
<td><b>Ctrl-Tab</b></td>
<td><kbd>Ctrl-Tab</kbd></td>
<td>Toggle between exploring the archive and the latest analysis results. This allows you to compare current detections with those you've previously recorded.</td>
</tr>
<tr>
<td colspan="2" class="text-center text-bg-light"><h5>Transport Controls</h5></td>
</tr>
<tr>
<td><b>SpaceBar</b></td>
<td><kbd>SpaceBar</kbd></td>
<td>Toggle Play/Pause the audio</td>
</tr>
<tr>
<td><b>P</b></td>
<td><kbd>P</kbd></td>
<td>Play the selected region. Only active if a region has been selected.</td>
</tr>
<tr>
<td><b>Ctrl-C</b></td>
<td><kbd>Ctrl-C</kbd></td>
<td>Centre the spectrogram at the current playhead position.</td>
</tr>
<tr>
<td><b>Ctrl-G</b></td>
<td><kbd>Ctrl-G</kbd></td>
<td>Go to position in file</td>
</tr>
<tr>
<td><b>Home (Fn + ArrowLeft)</b></td>
<td><kbd>Home (Fn + ArrowLeft)</kbd></td>
<td>Move the playhead to the beginning of the file</td>
</tr>
<tr>
<td><b>End (Fn + ArrowLeft)</b></td>
<td><kbd>End (Fn + ArrowLeft)</kbd></td>
<td>Move the playhead to the end of the file</td>
</tr>
<tr>
<td><b>PgUp (Fn + ArrowUp)</b></td>
<td><kbd>PgUp (Fn + ArrowUp)</kbd></td>
<td>Move the playhead back by a screen width</td>
</tr>
<tr>
<td><b>PgDn (Fn + ArrowDown)</b></td>
<td><kbd>PgDn (Fn + ArrowDown)</kbd></td>
<td>Move the playhead forward by a screen width</td>
</tr>
<tr>
<td><b>Left arrow (&larr;)</b></td>
<td><kbd>Left arrow (&larr;)</kbd></td>
<td>Move the playhead forward. </td>
</tr>
<tr>
<td><b>Right arrow (&rarr;)</b></td>
<td><kbd>Right arrow (&rarr;)</kbd></td>
<td>Move the playhead backward. </td>
</tr>
<tr>
<td><b>Tab or Down Arrow (&darr;)</b></td>
<td><kbd>Tab or Down Arrow (&darr;)</kbd></td>
<td>Skip to the next detection</td>
</tr>
<tr>
<td><b>Shift Tab or Up Arrow (&uarr;)</b></td>
<td><kbd>Shift Tab or Up Arrow (&uarr;)</kbd></td>
<td>Skip back to the previous detection</td>
</tr>
<tr>
<td colspan="2" class="text-center text-bg-light"><h5>Spectrogram</h5></td>
</tr>
<tr>
<td><b>Plus (+) </b></td>
<td><kbd>Plus (+) </kbd></td>
<td>Zoom in on the spectrogram. When zooming, Chirpity automatically adjusts the short-time Fourier transform (STFT) window size to optimize
the spectral resolution
</td>
</tr>
<tr>
<td><b>Minus (-)</b></td>
<td><kbd>Minus (-)</kbd></td>
<td>Zoom out the spectrogram. When zooming, Chirpity automatically adjusts the STFT window size to optimize the
spectral resolution
</td>
</tr>
<tr>
<td><b>Ctrl Plus (+) </b></td>
<td><kbd>Ctrl Plus (+) </kbd></td>
<td>Manually reduce the spectrogram window size. Adjusting the window size has the effect of sharpening / blurring the calls in the spectrogram.
</td>
</tr>
<tr>
<td><b>Ctrl Minus (-)</b></td>
<td><kbd>Ctrl Minus (-)</kbd></td>
<td>Manually increase the spectrogram window size
</td>
</tr>
<tr>
<td><b>Ctrl-T</b></td>
<td><kbd>Ctrl-T</kbd></td>
<td>Toggle between Timecode and Time of Day</td>
</tr>
<tr>
<td colspan="2" class="text-center text-bg-light"><h5>Records</h5></td>
</tr>
<tr>
<td><b>Delete</b> or <b>Backspace</b></td>
<td><kbd>Delete</kbd> or <kbd>Backspace</kbd></td>
<td>Delete current record</td>
</tr>
<tr>
<td><b>Ctrl-Z</b></td>
<td><kbd>Ctrl-Z</kbd></td>
<td>Restore deleted record(s)</td>
</tr>
<tr>
<td><b>Ctrl-V</b></td>
<td><kbd>Ctrl-V</kbd></td>
<td>Validate the current active record (confirm the detection)</td>
</tr>
</table>
Expand Down
23 changes: 15 additions & 8 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -3353,8 +3353,6 @@ function formatDuration(seconds){
STATE.mode !== 'explore' && enableMenuItem(['save2db'])
}
if (STATE.currentFile) enableMenuItem(['analyse'])

adjustSpecDims(true)
}


Expand Down Expand Up @@ -3454,6 +3452,7 @@ function formatDuration(seconds){
return
}
if (index <= 1) {
adjustSpecDims(true)
if (selection) {
const selectionTable = document.getElementById('selectionResultTableBody');
selectionTable.textContent = '';
Expand Down Expand Up @@ -5000,7 +4999,7 @@ async function readLabels(labelFile, updating){
// If we haven't clicked the active row or we cleared the region, load the row we clicked
if (resultContext || hideInSelection || hideInSummary) {
// Lets check if the summary needs to be filtered
if (!(inSummary && target.closest('tr').classList.contains('text-warning'))) {
if (inSummary && ! target.closest('tr').classList.contains('text-warning')) {
target.click(); // Wait for file to load
await waitForFileLoad();
}
Expand Down Expand Up @@ -5230,11 +5229,19 @@ async function readLabels(labelFile, updating){
function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

async function waitForFileLoad() {
while (!fileLoaded) {
await delay(100); // Wait for 100 milliseconds before checking again
}
let fileLoadRetryCount = 0
function waitForFileLoad() {
let maxRetries = 20;
return new Promise((resolve) =>{
setTimeout(() =>{
if (fileLoaded) resolve(fileLoadRetryCount = 0)
else {
console.log('retries: ', ++fileLoadRetryCount)
resolve(waitForFileLoad())
}
}, 100)
if (fileLoadRetryCount >= maxRetries) resolve(fileLoadRetryCount = 0)
})
}

async function waitForLocations() {
Expand Down
6 changes: 3 additions & 3 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ async function notifyMissingFile(file) {
const row = await diskDB.getAsync('SELECT * FROM FILES WHERE name = ?', file);
if (row?.id) missingFile = file
UI.postMessage({
event: 'generate-alert', type: 'error',
event: 'generate-alert', type: 'warning',
message: `Unable to locate source file with any supported file extension: ${file}`,
file: missingFile
})
Expand Down Expand Up @@ -1520,7 +1520,7 @@ const getPredictBuffers = async ({
predictionsRequested[file] = 0;

const samplesInBatch = sampleRate * BATCH_SIZE * WINDOW_SIZE
const highWaterMark = samplesInBatch * 2;
const highWaterMark = samplesInBatch * 2;

let chunkStart = start * sampleRate;
if (STATE.detect.backend === 'tensorflow'){
Expand Down Expand Up @@ -3727,7 +3727,7 @@ async function convertAndOrganiseFiles(threadLimit) {
const attempted = successfulConversions + failedConversions;
// Create a summary message
let summaryMessage;
let type = 'notice';
let type = 'info';

if (attempted) {
summaryMessage = `Processing complete: ${successfulConversions} successful, ${failedConversions} failed.`;
Expand Down

0 comments on commit c06bd27

Please sign in to comment.