Skip to content

Commit

Permalink
Merge pull request #422 from NeurodataWithoutBorders/anomalous-linux-…
Browse files Browse the repository at this point in the history
…branch

Add instructions to run on unsupported Linux machines
  • Loading branch information
CodyCBakerPhD authored Oct 5, 2023
2 parents 7eb406c + 35715c6 commit ba08402
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 71 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ Run the `setup.exe` file and follow all instructions.

Run the `.dmg` file and follow all instructions to move the file into your Applications folder.

### Ubuntu - Graphical Interface
### Ubuntu

> **Note:** If you're running the `.AppImage` and the app window clears to a white screen within a few seconds of starting, you will need to follow the [Developer Instructions](#developer-installation) on the [linux-fix](https://github.com/neurodatawithoutborders/nwb-guide/tree/linux-fix) branch of the NWB GUIDE.
#### Graphical Interface

Right-click the `.AppImage` file, navigate to `permissions`, and check any box which mentions 'run as executable'.

### Ubuntu - CLI
#### Ubuntu - CLI

From the terminal, simply type

Expand All @@ -57,6 +61,7 @@ Where you are using version `X.Y.Z`; then execute by calling




## Developer Installation

Start by cloning the repository
Expand Down
3 changes: 1 addition & 2 deletions pyflask/manageNeuroconv/info/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ def resource_path(relative_path):

# Create all nested home folders
STUB_SAVE_FOLDER_PATH.mkdir(exist_ok=True, parents=True)
CONVERSION_SAVE_FOLDER_PATH.mkdir(exist_ok=True, parents=True)
CONVERSION_SAVE_FOLDER_PATH.mkdir(exist_ok=True, parents=True)
TUTORIAL_SAVE_FOLDER_PATH.mkdir(exist_ok=True, parents=True)

1 change: 0 additions & 1 deletion pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ def upload_to_dandi(
):
from neuroconv.tools.data_transfers import automatic_dandi_upload


# CONVERSION_SAVE_FOLDER_PATH.mkdir(exist_ok=True, parents=True) # Ensure base directory exists

os.environ["DANDI_API_KEY"] = api_key # Update API Key
Expand Down
13 changes: 6 additions & 7 deletions src/preload/preload.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

const electron = require('electron')
const electron = require("electron");

// Expose ipcRenderer
if (process.contextIsolated) {
try {
electron.contextBridge.exposeInMainWorld('electron', electron)
electron.contextBridge.exposeInMainWorld("electron", electron);
} catch (error) {
console.error(error)
console.error(error);
}
} else {
globalThis.electron = electron
}
} else {
globalThis.electron = electron;
}
13 changes: 5 additions & 8 deletions src/renderer/src/stories/InstanceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,9 @@ export class InstanceManager extends LitElement {

setTimeout(() => {
Object.entries(this.#info).forEach(([id, { status }]) => {
if (status) this.updateState(id, status)
})
}) // NOTE: Why is this not possible without waiting?


if (status) this.updateState(id, status);
});
}); // NOTE: Why is this not possible without waiting?
};

#isCategory(value) {
Expand Down Expand Up @@ -272,7 +270,7 @@ export class InstanceManager extends LitElement {
});
}

#ids = {}
#ids = {};
#accordions = {};

#onSelected = () => {
Expand Down Expand Up @@ -359,10 +357,9 @@ export class InstanceManager extends LitElement {

return list;
}


render() {
this.#info = {}
this.#info = {};
this.#items = [];

const instances = this.#render();
Expand Down
32 changes: 16 additions & 16 deletions src/renderer/src/stories/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ export class Table extends LitElement {
onUpdate,
validateEmptyCells,
onStatusChange,
contextMenu
contextMenu,
} = {}) {
super();
this.schema = schema ?? {};
this.data = data ?? [];
this.keyColumn = keyColumn;
this.template = template ?? {};
this.validateEmptyCells = validateEmptyCells ?? true;
this.contextMenu = contextMenu ?? {}
this.contextMenu = contextMenu ?? {};

if (onUpdate) this.onUpdate = onUpdate;
if (validateOnChange) this.validateOnChange = validateOnChange;
Expand Down Expand Up @@ -288,25 +288,25 @@ export class Table extends LitElement {
let contextMenu = ["row_below", "remove_row"];
if (this.schema.additionalProperties) contextMenu.push("col_right", "remove_col");

console.log(this.contextMenu)
contextMenu = contextMenu.filter(k => !(this.contextMenu.ignore ?? []).includes(k))
console.log(this.contextMenu);
contextMenu = contextMenu.filter((k) => !(this.contextMenu.ignore ?? []).includes(k));

const descriptionEl = this.querySelector('#description')
const descriptionEl = this.querySelector("#description");
const operations = {
rows: [],
columns: []
}
if (contextMenu.includes('row_below')) operations.rows.push('add')
if (contextMenu.includes('remove_row')) operations.rows.push('remove')
if (contextMenu.includes('col_right')) operations.columns.push('add')
if (contextMenu.includes('remove_col')) operations.columns.push('remove')
const operationSet = new Set(Object.values(operations).flat())
const operationOn = Object.keys(operations).filter(k => operations[k].length)
columns: [],
};

if (contextMenu.includes("row_below")) operations.rows.push("add");
if (contextMenu.includes("remove_row")) operations.rows.push("remove");
if (contextMenu.includes("col_right")) operations.columns.push("add");
if (contextMenu.includes("remove_col")) operations.columns.push("remove");
const operationSet = new Set(Object.values(operations).flat());
const operationOn = Object.keys(operations).filter((k) => operations[k].length);

if (operationSet.size) {
const desc = `Right click to ${Array.from(operationSet).join('/')} ${operationOn.join('and')}.`
descriptionEl.innerText = desc
const desc = `Right click to ${Array.from(operationSet).join("/")} ${operationOn.join("and")}.`;
descriptionEl.innerText = desc;
}

const table = new Handsontable(div, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ const filter = (list, toFilter) => {
});
};


const emptyMessage = 'No issues detected in these files!'
const emptyMessage = "No issues detected in these files!";

export class GuidedInspectorPage extends Page {
constructor(...args) {
Expand Down Expand Up @@ -58,11 +57,11 @@ export class GuidedInspectorPage extends Page {

getStatus = (list) => {
return list.reduce((acc, o) => {
const res = getMessageType(o)
if (acc === 'error') return acc
else return res
}, 'valid')
}
const res = getMessageType(o);
if (acc === "error") return acc;
else return res;
}, "valid");
};

render() {
const { globalState } = this.info;
Expand All @@ -80,8 +79,6 @@ export class GuidedInspectorPage extends Page {
.flat();
return html` ${until(
(async () => {
if (fileArr.length <= 1) {
const items =
inspector ??
Expand All @@ -101,58 +98,54 @@ export class GuidedInspectorPage extends Page {
return truncateFilePaths(report, path);
})();
const _instances = fileArr.map(({ subject, session, info }) => {
const file_path = [`sub-${subject}`, `sub-${subject}_ses-${session}`];
const filtered = removeFilePaths(filter(items, { file_path }));
const file_path = [`sub-${subject}`, `sub-${subject}_ses-${session}`]
const filtered = removeFilePaths(filter(items, { file_path }))
const display = () => new InspectorList({ items: filtered, emptyMessage })
display.status = this.getStatus(filtered)
const display = () => new InspectorList({ items: filtered, emptyMessage });
display.status = this.getStatus(filtered);
return {
subject,
session,
display
display,
};
});
const instances = _instances.reduce((acc, { subject, session, display }) => {
const subLabel = `sub-${subject}`
const subLabel = `sub-${subject}`;
if (!acc[`sub-${subject}`]) acc[subLabel] = {};
acc[subLabel][`ses-${session}`] = display;
return acc;
}, {});
Object.keys(instances).forEach((subLabel) => {
const subItems = filter(items, { file_path: `${subLabel}${nodePath.sep}${subLabel}_ses-` }); // NOTE: This will not run on web-only now
const path = getSharedPath(subItems.map((o) => o.file_path));
const filtered = truncateFilePaths(subItems, path)
const filtered = truncateFilePaths(subItems, path);
const display = () => new InspectorList({ items: filtered, emptyMessage })
display.status = this.getStatus(filtered)
const display = () => new InspectorList({ items: filtered, emptyMessage });
display.status = this.getStatus(filtered);
instances[subLabel] = {
["All Files"]: display,
...instances[subLabel],
};
});
const allDisplay = () => new InspectorList({ items, emptyMessage })
allDisplay.status = this.getStatus(items)
const allDisplay = () => new InspectorList({ items, emptyMessage });
allDisplay.status = this.getStatus(items);
const allInstances = {
["All Files"]: allDisplay,
...instances,
}
};
const manager = new InstanceManager({
instances:allInstances
instances: allInstances,
});
return manager
return manager;
})(),
""
)}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class GuidedSubjectsPage extends Page {
keyColumn: "subject_id",
validateEmptyCells: false,
contextMenu: {
ignore: ['row_below']
ignore: ["row_below"],
},
onUpdate: () => {
this.unsavedUpdates = true;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/stories/preview/NWBFilePreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function getSharedPath(array) {
}
});

return shared ? path.normalize(shared.join("/")) : ''; // Convert back to OS-specific path
return shared ? path.normalize(shared.join("/")) : ""; // Convert back to OS-specific path
}

export function truncateFilePaths(items, basepath) {
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/src/stories/preview/inspector/InspectorList.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class InspectorList extends List {
}

constructor(props) {
const { items } = props
const { items } = props;
const aggregatedItems = Object.values(aggregateMessages(items)).map((items) => {
const aggregate = { ...items.pop() }; // Create a base object for the aggregation
aggregate.files = [aggregate.file_path, ...items.map((o) => o.file_path)];
Expand All @@ -57,7 +57,7 @@ export class InspectorList extends List {
const item = new InspectorListItem(o);
item.style.flexGrow = "1";
return { content: item };
})
}),
});
}
}
Expand Down Expand Up @@ -133,8 +133,8 @@ export class InspectorListItem extends LitElement {
render() {
this.type = getMessageType({
...this,
type: this.ORIGINAL_TYPE
})
type: this.ORIGINAL_TYPE,
});

this.setAttribute("title", this.message);

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/validation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import validationSchema from "./validation";

// NOTE: Only validation missing on NWBFile Metadata is check_subject_exists and check_processing_module_name

export const isErrorImportance = ["PYNWB_VALIDATION", "CRITICAL", "ERROR"]
export const isErrorImportance = ["PYNWB_VALIDATION", "CRITICAL", "ERROR"];
export function getMessageType(item) {
return item.type ?? (isErrorImportance.includes(item.importance) ? "error" : "warning");
}
Expand Down

0 comments on commit ba08402

Please sign in to comment.