2
0
mirror of https://github.com/frappe/books.git synced 2024-09-19 19:19:02 +00:00

incr: remove 600x600 windows

This commit is contained in:
18alantom 2022-04-21 18:47:06 +05:30
parent 27aed52044
commit b6163b4cac
7 changed files with 6 additions and 54 deletions

View File

@ -10,7 +10,6 @@ import Store from 'electron-store';
import { autoUpdater } from 'electron-updater';
import path from 'path';
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib';
import { getMainWindowSize } from './main/helpers';
import registerAppLifecycleListeners from './main/registerAppLifecycleListeners';
import registerAutoUpdaterListeners from './main/registerAutoUpdaterListeners';
import registerIpcMainActionListeners from './main/registerIpcMainActionListeners';
@ -18,6 +17,9 @@ import registerIpcMainMessageListeners from './main/registerIpcMainMessageListen
import registerProcessListeners from './main/registerProcessListeners';
import { IPC_CHANNELS } from './utils/messages';
const WIDTH = 1200;
const HEIGHT = 907;
export class Main {
title: string = 'Frappe Books';
icon: string;
@ -69,13 +71,12 @@ export class Main {
}
getOptions(): BrowserWindowConstructorOptions {
const { width, height } = getMainWindowSize();
const options: BrowserWindowConstructorOptions = {
vibrancy: 'sidebar',
transparent: this.isMac,
backgroundColor: '#80FFFFFF',
width,
height,
width: WIDTH,
height: HEIGHT,
title: this.title,
webPreferences: {
contextIsolation: false, // TODO: Switch this off

View File

@ -1,14 +0,0 @@
import electron, { app } from 'electron';
export function getMainWindowSize() {
let height;
if (app.isReady()) {
const screen = electron.screen;
height = screen.getPrimaryDisplay().workAreaSize.height;
height = height > 907 ? 907 : height;
} else {
height = 907;
}
const width = Math.ceil(1.323 * height);
return { height, width };
}

View File

@ -10,7 +10,6 @@ import saveHtmlAsPdf from '../src/saveHtmlAsPdf';
import { DatabaseMethod } from '../utils/db/types';
import { DatabaseResponse } from '../utils/ipc/types';
import { IPC_ACTIONS } from '../utils/messages';
import { getMainWindowSize } from './helpers';
export default function registerIpcMainActionListeners(main: Main) {
ipcMain.handle(IPC_ACTIONS.TOGGLE_MAXIMIZE_CURRENT_WINDOW, (event) => {
@ -31,10 +30,6 @@ export default function registerIpcMainActionListeners(main: Main) {
return await dialog.showSaveDialog(main.mainWindow!, options);
});
ipcMain.handle(IPC_ACTIONS.GET_PRIMARY_DISPLAY_SIZE, (event) => {
return getMainWindowSize();
});
ipcMain.handle(IPC_ACTIONS.GET_DIALOG_RESPONSE, async (event, options) => {
if (main.isDevelopment || main.isLinux) {
Object.assign(options, { icon: main.icon });

View File

@ -21,13 +21,6 @@ export default function registerIpcMainMessageListeners(main: Main) {
main.mainWindow!.reload();
});
ipcMain.on(IPC_MESSAGES.RESIZE_MAIN_WINDOW, (event, size, resizable) => {
const [width, height] = size;
if (!width || !height) return;
main.mainWindow!.setSize(width, height);
main.mainWindow!.setResizable(resizable);
});
ipcMain.on(IPC_MESSAGES.CLOSE_CURRENT_WINDOW, (event) => {
main.mainWindow!.close();
});

View File

@ -30,9 +30,7 @@
</template>
<script>
import { ipcRenderer } from 'electron';
import fs from 'fs/promises';
import { IPC_MESSAGES } from 'utils/messages';
import { fyo } from './initFyo';
import DatabaseSelector from './pages/DatabaseSelector';
// import Desk from './pages/Desk';
@ -47,25 +45,6 @@ export default {
activeScreen: null,
};
},
watch: {
async activeScreen(value) {
if (!value) return;
const { width, height } = await ipcRenderer.invoke(
IPC_ACTIONS.GET_PRIMARY_DISPLAY_SIZE
);
let size = {
Desk: [width, height],
DatabaseSelector: [600, 600],
SetupWizard: [600, 600],
}[value];
let resizable = value === 'Desk';
if (size.length) {
ipcRenderer.send(IPC_MESSAGES.RESIZE_MAIN_WINDOW, size, resizable);
}
},
},
components: {
// Desk,
// SetupWizard,

View File

@ -27,7 +27,7 @@ import { setLanguageMap } from './utils/language';
registerIpcRendererListeners();
const app = createApp({
template: '<h1>Hellow, World</h1>',
template: '<App/>',
});
setErrorHandlers(app);

View File

@ -5,7 +5,6 @@ export enum IPC_MESSAGES {
OPEN_EXTERNAL = 'open-external',
SHOW_ITEM_IN_FOLDER = 'show-item-in-folder',
RELOAD_MAIN_WINDOW = 'reload-main-window',
RESIZE_MAIN_WINDOW = 'resize-main-window',
CLOSE_CURRENT_WINDOW = 'close-current-window',
MINIMIZE_CURRENT_WINDOW = 'minimize-current-window',
DOWNLOAD_UPDATE = 'download-update',
@ -18,7 +17,6 @@ export enum IPC_ACTIONS {
GET_OPEN_FILEPATH = 'open-dialog',
GET_SAVE_FILEPATH = 'save-dialog',
GET_DIALOG_RESPONSE = 'show-message-box',
GET_PRIMARY_DISPLAY_SIZE = 'get-primary-display-size',
SAVE_HTML_AS_PDF = 'save-html-as-pdf',
SAVE_DATA = 'save-data',
SHOW_ERROR = 'show-error',