本文整理汇总了TypeScript中electron.Menu.setApplicationMenu方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Menu.setApplicationMenu方法的具体用法?TypeScript Menu.setApplicationMenu怎么用?TypeScript Menu.setApplicationMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.Menu
的用法示例。
在下文中一共展示了Menu.setApplicationMenu方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
app.on('ready', function () {
Menu.setApplicationMenu(null);
let iconFile = process.platform === 'win32' ? 'tray.ico' : 'trayTemplate.png';
tray = new Tray(path.normalize(`${app.getAppPath()}/icons/${iconFile}`));
var windowOptions = Object.assign({}, {
width: currentTheme.settings.BTWindowWidth,
height: currentTheme.settings.BTWindowHeight,
webPreferences: { preload: path.resolve(`${__dirname}/preload.js`) }
}, env.windowProperties)
mainWindow = createWindow('main', windowOptions);
mainWindow.loadURL(`file://${currentTheme.path}/${currentTheme.settings.BTMainFile}`);
tray.setContextMenu(trayMenu);
console.log('wtf');
console.log(dialog.showMessageBox(mainWindow, {type: 'info', message: `Welcome Back, You arrived!`}));
if (1 == 1 || env.name === 'development') {
mainWindow.openDevTools();
}
});
示例2: function
app.on('ready', function() {
Menu.setApplicationMenu(menus);
var mainWindow = createWindow('main', {
width: 1000,
height: 600
});
mainWindow.setTitle(require('../package.json').name);
mainWindow.loadURL(
url.format({
pathname: join(__dirname, 'app.html'),
protocol: 'file:',
slashes: true
})
);
if (env.name === 'development') {
mainWindow.openDevTools();
}
const backgroundApp = new BackgroundApp();
backgroundApp.init(getConfig());
});
示例3: buildDefaultMenu
(event: Electron.IpcMessageEvent, labels: MenuLabels) => {
menu = buildDefaultMenu(labels)
Menu.setApplicationMenu(menu)
if (mainWindow) {
mainWindow.sendAppMenu()
}
}
示例4: createWindow
export function createWindow() {
const electronScreen = screen;
const size = electronScreen.getPrimaryDisplay().workAreaSize;
// Create the browser window.
win = new BrowserWindow({
width: 1200,
height: 900,
title: pkg.productName,
icon: path.join(__dirname, '../resources/icon.png')
});
Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate));
// and load the index.html of the app.
win.loadURL(`file://${__dirname}/index.html`);
// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store window
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
}
示例5: onAppReady
function onAppReady() {
electron.Menu.setApplicationMenu(null);
getPaths((dataPathErr, pathToCore, pathToUserData) => {
userDataPath = pathToUserData;
corePath = pathToCore;
getLanguageCode(userDataPath, (languageCode) => {
i18n.languageCode = languageCode;
i18n.load([ "startup", "tray" ], () => {
if (dataPathErr != null) {
electron.dialog.showErrorBox(i18n.t("startup:failedToStart"), i18n.t(dataPathErr.key, dataPathErr.variables));
electron.app.quit();
process.exit(1);
return;
}
setupTrayOrDock();
setupMainWindow();
// NOTE: Disabled for now, see below
// process.on("SIGINT", onSigInt);
});
});
});
}
示例6: loadFullMenu
.then(kernelSpecs => {
if (Object.keys(kernelSpecs).length !== 0) {
store.dispatch(setKernelSpecs(kernelSpecs));
const menu = loadFullMenu();
Menu.setApplicationMenu(menu);
const logo =
process.platform === "win32" ? "logoWhite" : "logoTemplate";
const trayImage = join(__dirname, "..", "static", `${logo}.png`);
tray = new Tray(trayImage);
const trayMenu = loadTrayMenu();
tray.setContextMenu(trayMenu);
} else {
dialog.showMessageBox(
{
type: "warning",
title: "No Kernels Installed",
buttons: [],
message: "No kernels are installed on your system.",
detail:
"No kernels are installed on your system so you will not be " +
"able to execute code cells in any language. You can read about " +
"installing kernels at " +
"https://ipython.readthedocs.io/en/latest/install/kernel_install.html"
},
index => {
if (index === 0) {
app.quit();
}
}
);
}
})
示例7: Tray
app.on("ready", () => {
// window
MainWindow.getInstance().show()
// tray
const tray = new Tray(`${__dirname}/images/icon.png`)
const menu = Menu.buildFromTemplate([
{label: "Setting", click: () => SettingWindow.getInstance().show()},
{label: "Quit", click: () => app.quit()},
])
tray.setToolTip(app.getName())
tray.setContextMenu(menu)
// menu
Menu.setApplicationMenu(Menu.buildFromTemplate([{
label: "Application",
submenu: [
{ label: "About Application", selector: "orderFrontStandardAboutPanel:" },
{ type: "separator" },
{ label: "Quit", accelerator: "Command+Q", click: () => app.quit() },
]}, {
label: "Edit",
submenu: [
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
{ type: "separator" },
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" },
]},
]))
})
示例8: createWindow
function createWindow() {
mainWindow = new BrowserWindow({height: 650, width: 900, show: debug});
if (debug) {
mainWindow.webContents.openDevTools();
}
mainWindow.loadURL(`file://${__dirname}/index.html`);
if (process.platform === 'darwin') {
Menu.setApplicationMenu(createMenu());
} else {
mainWindow.setMenu(createMenu());
}
ipcMain.once('+main:angular-up', () => {
if (debug) {
mainWindow.webContents.send('+view:debug-enabled');
}
if (startFile) {
openScheduleFromFile(startFile);
}
mainWindow.show();
});
ipcMain.on('+main:new-schedule', () => {
createNewSchedule();
});
ipcMain.on('+main:open-schedule', () => {
openScheduleFileDialog();
});
mainWindow.on('closed', () => {
mainWindow = null;
app.quit();
});
};
示例9:
const setApplicationMenu = () => {
const menus = [editMenuTemplate];
if (env.name !== 'production') {
menus.push(devMenuTemplate);
}
Menu.setApplicationMenu(Menu.buildFromTemplate(menus));
};
示例10: function
var setApplicationMenu = function () {
var menus :Electron.MenuItemOptions[];
menus = [editMenuTemplate];
if (env.name !== 'production') {
menus.push(devMenuTemplate);
}
Menu.setApplicationMenu(Menu.buildFromTemplate(menus));
};