From 777e51cc845d769072063b41a1156ca20727369d Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Thu, 30 Jan 2025 23:19:28 +1100 Subject: [PATCH 1/5] nit --- src/main-process/comfyInstallation.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main-process/comfyInstallation.ts b/src/main-process/comfyInstallation.ts index cbaf2179..de47911a 100644 --- a/src/main-process/comfyInstallation.ts +++ b/src/main-process/comfyInstallation.ts @@ -20,6 +20,11 @@ export class ComfyInstallation { return this._basePath; } + private _virtualEnvironment: VirtualEnvironment; + public get virtualEnvironment(): VirtualEnvironment { + return this._virtualEnvironment; + } + /** Installation issues, such as missing base path, no venv. Populated by {@link validate}. */ validation: InstallValidation = { inProgress: false, @@ -35,11 +40,6 @@ export class ComfyInstallation { return this.state === 'installed' && !this.hasIssues; } - private _virtualEnvironment: VirtualEnvironment; - public get virtualEnvironment(): VirtualEnvironment { - return this._virtualEnvironment; - } - /** * Called during/after each step of validation * @param data The data to send to the renderer From dbfffa3709c453b54079cdeb45722dec2304eedb Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Fri, 31 Jan 2025 01:01:10 +1100 Subject: [PATCH 2/5] nit --- src/main-process/appWindow.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main-process/appWindow.ts b/src/main-process/appWindow.ts index 8c2a33f9..b21d1144 100644 --- a/src/main-process/appWindow.ts +++ b/src/main-process/appWindow.ts @@ -278,7 +278,6 @@ export class AppWindow { } private setupWindowEvents(): void { - // eslint-disable-next-line unicorn/consistent-function-scoping const updateBounds = () => { if (!this.window) return; From 2157582445d044ce234f043368c78d4d93da8221 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Fri, 31 Jan 2025 06:37:59 +1100 Subject: [PATCH 3/5] nit - Remove completed TODO --- src/handlers/appInfoHandlers.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/handlers/appInfoHandlers.ts b/src/handlers/appInfoHandlers.ts index 7cf73584..c1c43395 100644 --- a/src/handlers/appInfoHandlers.ts +++ b/src/handlers/appInfoHandlers.ts @@ -31,7 +31,6 @@ export function registerAppInfoHandlers(appWindow: AppWindow) { const basePath = result.filePaths[0]; useDesktopConfig().set('basePath', basePath); - // TODO: Replace with new base path config return await ComfyServerConfig.setBasePathInDefaultConfig(basePath); }); From 2f79fcf8ad2e9138e1592d2ec28bcaf6869b8a35 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Fri, 31 Jan 2025 07:26:23 +1100 Subject: [PATCH 4/5] Recreate & reload ComfySettings on basePath change --- src/main-process/comfyDesktopApp.ts | 4 ++-- src/main-process/comfyInstallation.ts | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main-process/comfyDesktopApp.ts b/src/main-process/comfyDesktopApp.ts index 7ce8939d..c41da147 100644 --- a/src/main-process/comfyDesktopApp.ts +++ b/src/main-process/comfyDesktopApp.ts @@ -21,8 +21,8 @@ export class ComfyDesktopApp implements HasTelemetry { public comfyServer: ComfyServer | null = null; private terminal: Terminal | null = null; // Only created after server starts. constructor( - public installation: ComfyInstallation, - public appWindow: AppWindow, + readonly installation: ComfyInstallation, + readonly appWindow: AppWindow, readonly telemetry: ITelemetry ) {} diff --git a/src/main-process/comfyInstallation.ts b/src/main-process/comfyInstallation.ts index de47911a..e02f0d1c 100644 --- a/src/main-process/comfyInstallation.ts +++ b/src/main-process/comfyInstallation.ts @@ -53,7 +53,7 @@ export class ComfyInstallation { basePath: string, /** The device type to use for the installation. */ public readonly telemetry: ITelemetry, - public readonly comfySettings: ComfySettings + public comfySettings: ComfySettings ) { this._basePath = basePath; this._virtualEnvironment = this.createVirtualEnvironment(basePath); @@ -110,7 +110,7 @@ export class ComfyInstallation { // Validate base path const basePath = useDesktopConfig().get('basePath'); if (basePath && (await pathAccessible(basePath))) { - this.updateBasePathAndVenv(basePath); + await this.updateBasePathAndVenv(basePath); validation.basePath = 'OK'; this.onUpdate?.(validation); @@ -203,11 +203,13 @@ export class ComfyInstallation { * Updates the base path and recreates the virtual environment (object). * @param basePath The new base path to set. */ - updateBasePathAndVenv(basePath: string) { + async updateBasePathAndVenv(basePath: string) { if (this._basePath === basePath) return; this._basePath = basePath; this._virtualEnvironment = this.createVirtualEnvironment(basePath); + this.comfySettings = new ComfySettings(basePath); + await this.comfySettings.loadSettings(); useDesktopConfig().set('basePath', basePath); } From f35c1f1fdfc6cb6f02315f085c47e89671053ff9 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Fri, 31 Jan 2025 07:28:24 +1100 Subject: [PATCH 5/5] nit - Revert over-eager GH desktop amend --- src/main-process/comfyDesktopApp.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main-process/comfyDesktopApp.ts b/src/main-process/comfyDesktopApp.ts index c41da147..7ce8939d 100644 --- a/src/main-process/comfyDesktopApp.ts +++ b/src/main-process/comfyDesktopApp.ts @@ -21,8 +21,8 @@ export class ComfyDesktopApp implements HasTelemetry { public comfyServer: ComfyServer | null = null; private terminal: Terminal | null = null; // Only created after server starts. constructor( - readonly installation: ComfyInstallation, - readonly appWindow: AppWindow, + public installation: ComfyInstallation, + public appWindow: AppWindow, readonly telemetry: ITelemetry ) {}