This repository has been archived by the owner on Oct 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathindex.js
94 lines (79 loc) · 2.3 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
//const electron = require('electron');
const url = require('url');
const path = require('path');
var fs = require('fs');
//var sqlite3 = require('sqlite3').verbose();
const {app, BrowserWindow, ipcMain, Menu, MenuItem} = require('electron');
const menu = new Menu()
menu.append(new MenuItem({ label: 'Hello' }))
menu.append(new MenuItem({ type: 'separator' }))
menu.append(new MenuItem({ label: 'Electron', type: 'checkbox', checked: true }))
let mainWindow;
app.commandLine.appendSwitch('--ignore-gpu-blacklist');
app.on('ready' , function(){
win = new BrowserWindow({
width: 1200,
height: 600,
minWidth: 200,
minHeight: 200,
autoHideMenuBar: true,
show: false,
icon: __dirname + '/logo/logo.png'
})
win.on('closed', () => {
win = null
});
splash = new BrowserWindow({
width: 300,
height: 300,
transparent: false,
frame: false,
alwaysOnTop: true,
resizable: false
});
splash.loadURL(url.format({
pathname: path.join(__dirname, 'pages/spinner.html'),
protocol: 'file:',
slashes: true
}));
setTimeout(function (){
win.loadURL(url.format({
pathname: path.join(__dirname, 'pages/graph_1.html'),
protocol: 'file:',
slashes: true
}));
win.once('ready-to-show', () => {
splash.destroy();
win.show();
});
}, 1000);
//win.loadURL(url.format({
// pathname: path.join(__dirname, 'pages/spinner.html'),
// protocol: 'file:',
// slashes: true
//}));
//win.loadURL(url.format({
// pathname: path.join(__dirname, 'pages/graph_1.html'),
// protocol: 'file:',
// slashes: true
//}));
var graphName = "";
ipcMain.on('Name', (event, arg) => {
graphName = arg;
});
ipcMain.on('importData', (event, arg) => {
fs.readFile(graphName, 'utf-8', (err, data) => {
event.sender.send('responseGraph', data);
});
});
ipcMain.on('exportData', (event, arg) => {
fs.writeFile(graphName, arg)
});
ipcMain.on('show-context-menu', (event, arg) => {
const menu = new Menu();
menu.append(new MenuItem ({
label: 'Item ' + arg,
}));
menu.popup(menu)
});
});