-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
131 lines (121 loc) · 3.69 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
'use strict';
const {
app,
BrowserWindow
} = require('electron');
const electron = require('electron');
///////////////////////////////////////////////////////////////////////////////
// Helpers
///////////////////////////////////////////////////////////////////////////////
const OS = () => {
if (process.platform.indexOf("darwin") >= 0 || process.platform.indexOf("mac") >= 0) {
return "OSX";
} else if (process.platform.indexOf("win") >= 0) {
return "WIN";
} else {
return "";
}
}
const getIconPath = () => {
//let mainWindowIcon = __dirname.toString() + '/resources/images/app/icon/icon_256x256';
var path = require('path')
let mainWindowIcon = path.join(__dirname.toString(), '/resources/images/app/icon/icon_256x256');
if (OS() == "OSX") {
mainWindowIcon = mainWindowIcon + ".icns";
} else if (OS() == "WIN") {
mainWindowIcon = mainWindowIcon + ".ico";
} else {
mainWindowIcon = mainWindowIcon + ".png";
}
mainWindowIcon = path.join(__dirname.toString(), '/resources/images/app/app.png');
return mainWindowIcon;
}
///////////////////////////////////////////////////////////////////////////////
// Settings
///////////////////////////////////////////////////////////////////////////////
let mainWindowSettings = {
title: 'Robust Time Series Toolbox - KAUST Biostatistics Group',
width: 1024,
height: 760,
minWidth: 400,
minHeight: 300,
//backgroundColor: 'rgb(224, 224, 224)',
backgroundColor: 'rgb(15,52,86)',
icon: getIconPath(),
acceptFirstMouse: true,
//titleBarStyle: 'customButtonsOnHover',
titleBarStyle: 'hiddenInset',
//titleBarStyle: 'hidden',
//autoHideMenuBar: !true,
fullscreenWindowTitle: true,
frame: false,
allowRendererProcessReuse: true,
webPreferences: {
///// webSecurity: true,
enableRemoteModule: true,
nodeIntegration: true,
//nodeIntegrationInWorker: true,
//contextIsolation: false,
},
nodeIntegration: true,
}
let modalWindowSettings = {
title: 'Robust Time Series Toolbox - KAUST Biostatistics Group',
width: 600,
height: 450,
minWidth: 400,
minHeight: 300,
//backgroundColor: 'rgb(224, 224, 224)',
backgroundColor: 'rgb(15,52,86)',
icon: getIconPath(),
acceptFirstMouse: true,
//titleBarStyle: 'customButtonsOnHover',
titleBarStyle: 'hiddenInset',
//titleBarStyle: 'hidden',
//autoHideMenuBar: !true,
fullscreenWindowTitle: true,
frame: false,
modal: true,
//allowRendererProcessReuse: true,
webPreferences: {
///// webSecurity: true,
//nodeIntegration: true,
//nodeIntegrationInWorker: true,
//contextIsolation: false,
},
}
///////////////////////////////////////////////////////////////////////////////
// Main events
///////////////////////////////////////////////////////////////////////////////
let mainWindow, modalWindow;
app.on('window-all-closed', function () {
app.quit();
//if(process.platform != 'darwin') {
// app.quit();
//}
});
app.on('ready', function () {
if (OS() == "OSX") {
mainWindowSettings.frame = true;
}
mainWindow = new BrowserWindow(mainWindowSettings);
modalWindowSettings.parent = mainWindow
modalWindow = new BrowserWindow(modalWindowSettings);
//mainWindow.setMenu(electron.Menu.buildFromTemplate(menuTemplate));
mainWindow.setMenu(null);
modalWindow.setMenu(null);
mainWindow.loadURL('file://' + __dirname + '/resources/main.html');
modalWindow.loadURL('file://' + __dirname + '/resources/modal.html');
mainWindow.on('closed', function () {
mainWindow = null;
});
modalWindow.on('closed', function () {
});
//mainWindow.maximize();
//
//mainWindow.toggleDevTools();
//modalWindow.toggleDevTools();
});
app.on('error', function () {
console.log("Error starting the application")
});