fix: python代码

This commit is contained in:
mozzie 2024-09-03 16:51:27 +08:00
parent 0b8b78b71c
commit e5e96891ef
3 changed files with 14 additions and 14 deletions

View File

@ -6,7 +6,7 @@ import {
processFilesInBatches,
structureMetadata,
} from "./core/dicom";
import PythonManager from "./core/PythonManager";
// import PythonManager from "./core/PythonManager";
import { db } from "./core/db";
/**
@ -14,7 +14,7 @@ import { db } from "./core/db";
*/
const registerIpcMainHandlers = (
mainWindow: Electron.BrowserWindow | null,
pythonManager: PythonManager
// pythonManager?: PythonManager
) => {
if (!mainWindow) return;
@ -25,15 +25,16 @@ const registerIpcMainHandlers = (
*/
ipcMain.on("ipc-loaded", () => mainWindow.show());
ipcMain.on("python-service", (_, data) => {
const { running } = data;
running ? pythonManager.startFlask() : pythonManager.stopFlask();
});
// ipcMain.on("python-service", (_, data) => {
// const { running } = data;
// running ? pythonManager.startFlask() : pythonManager.stopFlask();
// });
/**
* dialog
*/
ipcMain.on("import-dicom-dialog-visible", async (event) => {
console.log(1111);
const result = await dialog.showOpenDialog({
properties: ["openDirectory"],
});

View File

@ -13,6 +13,7 @@ import path from "node:path";
import PythonManager from "./core/PythonManager";
import { createDatabase } from "./core/db";
import { getMachineId } from "./core/auth";
import registerIpcMainHandlers from "./ipcMainHandlers";
// const require = createRequire(import.meta.url);
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@ -64,20 +65,18 @@ function createWindow() {
win.loadURL(VITE_DEV_SERVER_URL);
} else {
win.loadFile(path.join(RENDERER_DIST, "index.html")).then(() => {
win?.webContents.openDevTools()
win?.webContents.openDevTools();
// 检查是否传递了路径
if (process.argv.length >= 2) {
const folderPath = process.argv[1]; // 这是选中的目录路径
const folderPath = process.argv[1]; // 这是选中的目录路径
console.log("Opened directory path:", folderPath);
win?.webContents.send('open-folder', process.argv);
win?.webContents.send("open-folder", process.argv);
}
})
});
}
// pythonManager = new PythonManager(win, "http://127.0.0.1:15001", 3000);
// registerIpcMainHandlers(win, pythonManager);
registerIpcMainHandlers(win);
}
function createTray() {

View File

@ -19,7 +19,7 @@ export const MenuBar = () => {
const navigate = useNavigate();
const handleImportDicom = () => {
navigate("/datasource");
navigate("datasource");
window.ipcRenderer.send("import-dicom-dialog-visible");
};