tidy up touchbar

master
Dave Conway-Jones 2020-10-10 17:10:47 +01:00
rodzic 4816ef4816
commit 5e3c7eede5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 88BA2B8A411BE9FF
3 zmienionych plików z 21 dodań i 20 usunięć

29
main.js
Wyświetl plik

@ -426,43 +426,44 @@ function createWindow() {
// If on a Mac add some touchbar buttons...
if (process.platform === 'darwin') {
const touchButton1 = new TouchBarButton({
label: 'Editor',
backgroundColor: '#910000',
click: () => { mainWindow.loadURL("http://localhost:"+listenPort+urledit); }
});
const touchButton2 = new TouchBarButton({
const touchButton1 = new TouchBarButton({
label: 'Dashboard',
backgroundColor: '#910000',
click: () => { mainWindow.loadURL("http://localhost:"+listenPort+urldash); }
});
const touchButton2 = new TouchBarButton({
label: 'Editor',
backgroundColor: '#910000',
click: () => { mainWindow.loadURL("http://localhost:"+listenPort+urledit); }
});
const touchButton3 = new TouchBarButton({
label: 'Map',
backgroundColor: '#910000',
click: () => { mainWindow.loadURL("http://localhost:"+listenPort+urlmap); }
});
const spacer = new TouchBarSpacer({ size: 'flexible' });
const touchButton4 = new TouchBarButton({
label: 'Console',
backgroundColor: '#910000',
click: () => { createConsole(); }
});
var items = [ touchButton2 ];
if (editable) { items.push(touchButton1) }
var items = [ touchButton1 ];
if (editable) { items.push(touchButton2) }
if (showMap) { items.push(touchButton3) }
if (editable) {
items.push(spacer);
items.push(new TouchBarSpacer({ size: 'flexible' }));
items.push(touchButton4);
}
const mainTouchBar = new TouchBar({ items: items });
mainWindow.setTouchBar(mainTouchBar);
// Only bother to add buttons if more than one
if (items.length != 1) {
const mainTouchBar = new TouchBar({ items: items });
mainWindow.setTouchBar(mainTouchBar);
}
}
// Start the app full screen

Wyświetl plik

@ -22,8 +22,8 @@ if (process.argv.length === 3 ) {
app = require(arg);
}
}
else {
app = require(path.join(arg, "package.json"));
else {
app = require(path.join(arg, "package.json"));
dn = arg;
}
}
@ -40,12 +40,12 @@ const merge = {
pkg.dependencies = merge;
// Try to get flow file name from package.json setiings
if (app.hasOwnProperty("node-red") && app["node-red"].hasOwnProperty("settings") && app["node-red"].settings.hasOwnProperty("flowFile") ) {
pkg.NRelectron.flowFile = app["node-red"].settings.flowFile;
pkg.NRelectron.flowFile = app["node-red"].settings.flowFile;
} // or the npm scripts if there is a run command
else if (app.hasOwnProperty("scripts") && app.scripts.hasOwnProperty("start")) {
pkg.NRelectron.flowFile = app.scripts.start.split(' ').pop();
} // or the command line if the user gave us a name - or just guess flow.json.
else {
else {
pkg.NRelectron.flowFile = flowfile || "flow.json";
}
@ -73,7 +73,7 @@ fs.copyFile(path.join(arg, creds), path.join("./", creds), (err) => {
else { console.log('Copied creds file - '+creds); }
});
// Finally re-write th new package.json
// Finally re-write the new package.json
fs.writeFile("./package.json", JSON.stringify(pkg, null, 4), 'utf8', function (err) {
if (err) { console.log("Failed to re-write package.json file."); }
else {

Wyświetl plik

@ -11,7 +11,7 @@
"kioskMode": false,
"addNodes": true,
"flowFile": "electronflow.json",
"start": "editor"
"start": "dashboard"
},
"scripts": {
"pack": "electron-builder --dir",