Skip to content

Commit

Permalink
audiveris parsing warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
amcolash committed May 20, 2021
1 parent 60e57b5 commit 4b18e8b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@

### Added

- Audiveris parsing errors now displayed in stage progress?
- Audiveris parsing warnings now reported on score view

### Fixed

- "Open In Noteflight" fixed and works without local server
- Some time signatures were accidentally cut off and failed parsing

### Updated

- Updated most application dependencies to latest (exceptions listed):
- `electron` is `11.x.x`, instead of 12
- `webpack` is still `4.x.x`, instead of 5
- Internal code changes to make `Log` component a bit nicer

## 0.8.0 (2021-05-14)

Expand Down
3 changes: 3 additions & 0 deletions src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export const Colors = {
LightGrey: '#bbb',
Grey: '#777',
Charcoal: '#333',
Red: '#f00',
Yelow: '#ff0',
Orange: '#ff7f00',
};

export const tmpPath = join(remote.app.getPath('userData'), 'tmp');
Expand Down
2 changes: 1 addition & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let mainWindow;
function createMainWindow() {
const window = new BrowserWindow({
webPreferences: { nodeIntegration: true, webviewTag: true, webSecurity: false, enableRemoteModule: true },
...(isDevelopment ? { width: 800, height: 1000 } : { width: 1200, height: 900 }),
...(isDevelopment ? { width: 1200, height: 1000 } : { width: 1200, height: 900 }),
title: isDevelopment ? undefined : `${app.getName()} (${app.getVersion()})`,
});

Expand Down
6 changes: 6 additions & 0 deletions src/renderer/Log.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export const error = (item) => {
console.error(item);
};

export const getLog = () => logValues;

export const clearLog = () => {
logValues = [];
};

const errorText = style({
color: 'red',
});
Expand Down
17 changes: 14 additions & 3 deletions src/renderer/Score.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import axios from 'axios';
import { remote } from 'electron';
import { copyFileSync, readFileSync, writeFileSync } from 'fs';
import { basename, join, relative } from 'path';
import { basename, join } from 'path';
import React, { useEffect, useState } from 'react';
import { Code, FileText, Image } from 'react-feather';
import { AlertCircle, Code, FileText, Image } from 'react-feather';
import { cssRule } from 'typestyle';

import { isDevelopment } from '../common/constants';
import { Colors, isDevelopment } from '../common/constants';
import NFClient from '../common/nfclient';
import { imageDir } from '../common/stages/images';
import { getTitle } from '../common/util';
import { getLog, log, logValues } from './Log';

cssRule('#sheetMusic', {
border: '1px solid #aaa !important',
Expand Down Expand Up @@ -57,6 +58,11 @@ export const Score = (props) => {

const margin = 10;

let foundErrors = 0;
getLog().forEach((l) => {
if (l.value.indexOf('Exception:') !== -1) foundErrors++;
});

return (
<div style={{ marginTop: 50, width: '100%', height: '100%', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: 20 }}>
Expand Down Expand Up @@ -141,6 +147,11 @@ export const Score = (props) => {
</button>
</div>
<div id="sheetMusic" />
{foundErrors > 0 && (
<div style={{ display: 'flex', alignItems: 'center', marginTop: margin * 2, fontSize: 18 }}>
<AlertCircle color={Colors.Orange} style={{ marginRight: margin }} /> Audiveris Parsing Errors Occured ({foundErrors})
</div>
)}
</div>
);
};
6 changes: 4 additions & 2 deletions src/renderer/Status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Colors, isDevelopment, tmpPath } from '../common/constants';
import { runStages, Stage } from '../common/stages/stages';

import { Score } from './Score';
import { Log } from './Log';
import { clearLog, Log } from './Log';
import { remote } from 'electron';
import rimraf from 'rimraf';

Expand Down Expand Up @@ -43,6 +43,7 @@ export const Status = (props) => {
<button
disabled={stage !== Stage.Complete && !error}
onClick={() => {
clearLog();
const current = remote.getCurrentWindow();
if (current) current.reload();
}}
Expand Down Expand Up @@ -87,7 +88,7 @@ export const Status = (props) => {
>
{stage === Stage[s] &&
(error ? (
<AlertTriangle style={{ color: 'red' }} />
<AlertTriangle style={{ color: Colors.Red }} />
) : (
<SpinnerCircularFixed size={22} thickness={200} color={Colors.Green} secondaryColor={Colors.LightGrey} />
))}
Expand All @@ -111,6 +112,7 @@ export const Status = (props) => {
message: 'Are you sure you want to clear temp cache?',
});
if (option === 1) {
clearLog();
rimraf.sync(tmpPath);
const current = remote.getCurrentWindow();
if (current) current.reload();
Expand Down

0 comments on commit 4b18e8b

Please sign in to comment.