Skip to content

Commit

Permalink
Fixed: Open models, logs etc users path set by user. (#85)
Browse files Browse the repository at this point in the history
* Fix location path of models etc.

* Add about button.
  • Loading branch information
robinjhuang authored Oct 15, 2024
1 parent 3cdae66 commit 43adc17
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
15 changes: 14 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ if (!gotTheLock) {
await handleFirstTimeSetup();
const { userResourcesPath, appResourcesPath, pythonInstallPath, modelConfigPath, basePath } =
await determineResourcesPaths();
SetupTray(mainWindow, userResourcesPath);
SetupTray(mainWindow, basePath);
port = await findAvailablePort(8000, 9999).catch((err) => {
log.error(`ERROR: Failed to find available port: ${err}`);
throw err;
Expand Down Expand Up @@ -264,6 +264,19 @@ function buildMenu(): Menu {
submenu: [{ role: 'quit' }],
})
);
menu.append(
new MenuItem({
label: 'About',
click: () => {
dialog.showMessageBox({
title: 'About',
message: `ComfyUI v${app.getVersion()}`,
detail: 'Created by Comfy Org\nCopyright © 2024',
buttons: ['OK'],
});
},
})
);
}

return menu;
Expand Down
10 changes: 5 additions & 5 deletions src/tray.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Tray, Menu, BrowserWindow, app, shell } from 'electron';
import path from 'path';

export function SetupTray(mainView: BrowserWindow, userResourcesPath: string): Tray {
export function SetupTray(mainView: BrowserWindow, basePath: string): Tray {
// Set icon for the tray
// I think there is a way to packaged the icon in so you don't need to reference resourcesPath
const trayImage = path.join(
Expand Down Expand Up @@ -52,19 +52,19 @@ export function SetupTray(mainView: BrowserWindow, userResourcesPath: string): T
submenu: [
{
label: 'Models',
click: () => shell.openPath(path.join(userResourcesPath, 'models')),
click: () => shell.openPath(path.join(basePath, 'models')),
},
{
label: 'Outputs',
click: () => shell.openPath(path.join(userResourcesPath, 'output')),
click: () => shell.openPath(path.join(basePath, 'output')),
},
{
label: 'Inputs',
click: () => shell.openPath(path.join(userResourcesPath, 'input')),
click: () => shell.openPath(path.join(basePath, 'input')),
},
{
label: 'Custom Nodes',
click: () => shell.openPath(path.join(userResourcesPath, 'custom_nodes')),
click: () => shell.openPath(path.join(basePath, 'custom_nodes')),
},
{
label: 'Logs',
Expand Down

0 comments on commit 43adc17

Please sign in to comment.