-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
101 lines (88 loc) · 2.74 KB
/
main.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
const { app, BrowserWindow, Menu } = require('electron')
const { dialog } = require('electron')
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 900,
webPreferences: {
nodeIntegration: true,
webviewTag: true,
contextIsolation: false,
enableRemoteModule: true
},
icon: __dirname + "/image/moon.ico"
})
win.loadFile('index.html')
//win.webContents.openDevTools()
createMainMenu()
}
function createMainMenu(){
const menuTemplate = [
{
label: "Edit",
submenu: [
{
label: "Cut",
accelerator: 'CmdOrCtrl+X',
role: "cut"
},
{
label: "Copy",
accelerator: 'CmdOrCtrl+C',
role: "copy"
},
{
label: "Paste",
accelerator: 'CmdOrCtrl+V',
role: "paste"
},
{
label: "Select Everything!",
accelerator: 'CmdOrCtrl+A',
role: "selectAll"
}
]
},
{
label: "Tools",
submenu: [
{
label: "Reload",
role: "reload"
},
{
label: "Developer tools",
click(item, focusedWindow){
if(focusedWindow) focusedWindow.webContents.openDevTools()
}
},
]
},
{
label: "About",
click(item, focusedWindow){
if(focusedWindow) {
dialog.showMessageBox(focusedWindow, {
message: "A program developed by Gansanta Bhikkhu, 2022 in ITBMU, Myanmar",
type:"info",
title:"Buddhist Lunar Calendar",
detail:"The program displays easy-to-look-up dates of BC or AD, ranging from 700BC up to 2100 AD. Adhimāsa is also visible. \nLunar phase data is by courtesy of Fred Espenak, www.Astropixels.com",
})
}
}
},
]
const mainmenu = Menu.buildFromTemplate(menuTemplate)
Menu.setApplicationMenu(mainmenu)
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})