Closed daniel-carvajal closed 12 months ago
Attempting to work out issue related to process not terminating properly on Electron window close, will reopen then.
Python app terminates correctly now when Electron is closed, using:
in main.js
mainWindow.on("close", function (e) {
if (mainWindow) {
mainWindow.webContents.send("app-close");
}
});
in App.tsx
componentDidMount() {
ipcRenderer.on('app-close', () => {
eel.quit_app()
});
}
and in eel_electron_CRA.py
@eel.expose
def quit_app():
"""Quit the app."""
print('Exiting python app')
os._exit(0)
---onefile --noconsole
flags needs to be further tested though.
Currently main.js uses this configuration (may need improvements) as discussed here:
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: false,
nodeIntegration: true,
nodeIntegrationInWorker: true
}
Should close https://github.com/python-eel/Eel/issues/216, https://github.com/python-eel/Eel/issues/57, https://github.com/python-eel/Eel/issues/428 Relates to https://github.com/python-eel/Eel/issues/285, https://github.com/python-eel/Eel/issues/544, https://github.com/python-eel/Eel/issues/266, https://github.com/python-eel/Eel/issues/607, https://github.com/python-eel/Eel/issues/159, https://github.com/python-eel/Eel/issues/491
build.sh
file for convenience.npm install
, then run./build.sh
, or follow instructions in README.md.download_electron.sh
to get Electron version for your chip (Intel or ARM).Also somewhat followed this article as reference to configure CRA app with Electron.