From 74e7d4c283c253f02e5d804c93aafafef12131d8 Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Mon, 23 Dec 2024 13:50:31 +0000 Subject: [PATCH] Remove error toastr --- src/constants.ts | 2 -- src/main-process/appWindow.ts | 11 ----------- src/main-process/comfyDesktopApp.ts | 17 +++++++---------- src/main.ts | 8 +------- src/preload.ts | 14 -------------- 5 files changed, 8 insertions(+), 44 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 380e2b87..fcea650d 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -30,8 +30,6 @@ export const IPC_CHANNELS = { VALIDATE_COMFYUI_SOURCE: 'validate-comfyui-source', SHOW_DIRECTORY_PICKER: 'show-directory-picker', INSTALL_COMFYUI: 'install-comfyui', - SHOW_TOAST: 'show-toast', - LOADED: 'loaded', SHOW_CONTEXT_MENU: 'show-context-menu', RESTART_CORE: 'restart-core', GET_GPU: 'get-gpu', diff --git a/src/main-process/appWindow.ts b/src/main-process/appWindow.ts index 616bc8e6..34538949 100644 --- a/src/main-process/appWindow.ts +++ b/src/main-process/appWindow.ts @@ -98,17 +98,6 @@ export class AppWindow { }); } - /** - * Shows a toast popup in the client - */ - showToast(config: { - severity?: 'success' | 'info' | 'warn' | 'error' | 'secondary' | 'contrast' | undefined; - summary?: string | undefined; - detail?: any | undefined; - }): void { - this.send(IPC_CHANNELS.SHOW_TOAST, config); - } - public onClose(callback: () => void): void { this.window.on('close', () => { callback(); diff --git a/src/main-process/comfyDesktopApp.ts b/src/main-process/comfyDesktopApp.ts index 88060ef7..2ef4ae20 100644 --- a/src/main-process/comfyDesktopApp.ts +++ b/src/main-process/comfyDesktopApp.ts @@ -1,4 +1,4 @@ -import { app, dialog, ipcMain } from 'electron'; +import { app, dialog, ipcMain, Notification } from 'electron'; import log from 'electron-log/main'; import * as Sentry from '@sentry/electron/main'; import { graphics } from 'systeminformation'; @@ -250,15 +250,12 @@ export class ComfyDesktopApp { await this.comfyServer.start(); this.initializeTerminal(virtualEnvironment); - return () => { - if (customNodeMigrationError) { - this.appWindow.showToast({ - summary: 'Failed to migrate custom nodes', - detail: customNodeMigrationError, - severity: 'error', - }); - } - }; + if (customNodeMigrationError) { + new Notification({ + title: 'Failed to migrate custom nodes', + body: customNodeMigrationError, + }).show(); + } } async migrateCustomNodes(config: DesktopConfig, virtualEnvironment: VirtualEnvironment, callbacks: ProcessCallbacks) { diff --git a/src/main.ts b/src/main.ts index 38c36c4f..bdd2cc44 100644 --- a/src/main.ts +++ b/src/main.ts @@ -94,17 +94,11 @@ async function startApp() { delete extraServerArgs.listen; delete extraServerArgs.port; - let onReady: (() => void) | null = null; if (!useExternalServer) { - onReady = await comfyDesktopApp.startComfyServer({ host, port, extraServerArgs }); + await comfyDesktopApp.startComfyServer({ host, port, extraServerArgs }); } appWindow.sendServerStartProgress(ProgressStatus.READY); - - const waitLoad = Promise.withResolvers(); - ipcMain.handle(IPC_CHANNELS.LOADED, waitLoad.resolve); await appWindow.loadComfyUI({ host, port, extraServerArgs }); - await waitLoad.promise; - onReady?.(); } catch (error) { log.error('Unhandled exception during app startup', error); appWindow.sendServerStartProgress(ProgressStatus.ERROR); diff --git a/src/preload.ts b/src/preload.ts index 2b516bd5..07d2ec4b 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -226,20 +226,6 @@ const electronAPI = { installComfyUI: (installOptions: InstallOptions) => { ipcRenderer.send(IPC_CHANNELS.INSTALL_COMFYUI, installOptions); }, - /** - * Shows a toast popup with the supplied config - */ - onShowToast: (callback: (config: { message: string; type: string }) => void) => { - ipcRenderer.on(IPC_CHANNELS.SHOW_TOAST, (_event, value) => { - callback(value); - }); - }, - /** - * Trigged by the frontend app when it is loaded - */ - loaded: (): Promise => { - return ipcRenderer.invoke(IPC_CHANNELS.LOADED); - }, /** * Opens native context menus. *