desktop: load model from file

This commit is contained in:
Jeffrey Morgan
2023-06-27 12:35:51 -04:00
parent a12df7faf4
commit ad4ffdf754
8 changed files with 271 additions and 151 deletions

View File

@@ -1,6 +1,9 @@
import { app, BrowserWindow } from 'electron'
import { app, BrowserWindow, ipcMain, dialog } from 'electron'
import { spawn } from 'child_process'
import * as path from 'path'
require('@electron/remote/main').initialize()
// This allows TypeScript to pick up the magic constants that's auto-generated by Forge's Webpack
// plugin that tells the Electron app where to look for the Webpack-bundled app code (depending on
// whether you're running in development or production).
@@ -21,9 +24,15 @@ const createWindow = (): void => {
minWidth: 400,
minHeight: 300,
titleBarStyle: 'hiddenInset',
transparent: true,
webPreferences: {
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
nodeIntegration: true,
contextIsolation: false,
},
})
require('@electron/remote/main').enable(mainWindow.webContents)
// and load the index.html of the app.
mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY)
}
@@ -34,7 +43,7 @@ if (app.isPackaged) {
console.log(resources)
// Start the executable
const exec = path.join(resources, 'server')
const exec = path.join(resources, 'serve', '--port', '5001')
console.log(`Starting ${exec}`)
const proc = spawn(exec)
proc.stdout.on('data', data => {