File tree 3 files changed +19
-3
lines changed
arduino-ide-extension/src
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ import { MonitorManagerProxyClient } from '../../../common/protocol';
14
14
import { BoardsServiceProvider } from '../../boards/boards-service-provider' ;
15
15
import { MonitorModel } from '../../monitor-model' ;
16
16
import { ArduinoToolbar } from '../../toolbar/arduino-toolbar' ;
17
+ import {
18
+ CLOSE_PLOTTER_WINDOW ,
19
+ SHOW_PLOTTER_WINDOW ,
20
+ } from '../../../common/ipc-communication' ;
17
21
18
22
const queryString = require ( 'query-string' ) ;
19
23
@@ -58,7 +62,7 @@ export class PlotterFrontendContribution extends Contribution {
58
62
override onStart ( app : FrontendApplication ) : MaybePromise < void > {
59
63
this . url = new Endpoint ( { path : '/plotter' } ) . getRestUrl ( ) . toString ( ) ;
60
64
61
- ipcRenderer . on ( 'CLOSE_CHILD_WINDOW' , async ( ) => {
65
+ ipcRenderer . on ( CLOSE_PLOTTER_WINDOW , async ( ) => {
62
66
if ( ! ! this . window ) {
63
67
this . window = null ;
64
68
}
@@ -96,7 +100,7 @@ export class PlotterFrontendContribution extends Contribution {
96
100
async startPlotter ( ) : Promise < void > {
97
101
await this . monitorManagerProxy . startMonitor ( ) ;
98
102
if ( ! ! this . window ) {
99
- this . window . focus ( ) ;
103
+ ipcRenderer . send ( SHOW_PLOTTER_WINDOW ) ;
100
104
return ;
101
105
}
102
106
const wsPort = this . monitorManagerProxy . getWebSocketPort ( ) ;
Original file line number Diff line number Diff line change
1
+ export const SHOW_PLOTTER_WINDOW = 'SHOW_PLOTTER_WINDOW' ;
2
+ export const CLOSE_PLOTTER_WINDOW = 'CLOSE_PLOTTER_WINDOW' ;
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ import * as os from '@theia/core/lib/common/os';
23
23
import { Restart } from '@theia/core/lib/electron-common/messaging/electron-messages' ;
24
24
import { TheiaBrowserWindowOptions } from '@theia/core/lib/electron-main/theia-electron-window' ;
25
25
import { IsTempSketch } from '../../node/is-temp-sketch' ;
26
+ import {
27
+ CLOSE_PLOTTER_WINDOW ,
28
+ SHOW_PLOTTER_WINDOW ,
29
+ } from '../../common/ipc-communication' ;
26
30
27
31
app . commandLine . appendSwitch ( 'disable-http-cache' ) ;
28
32
@@ -328,9 +332,15 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
328
332
} ,
329
333
} ) ;
330
334
event . newGuest = new BrowserWindow ( options ) ;
335
+
336
+ const showPlotterWindow = ( ) => {
337
+ event . newGuest ?. show ( ) ;
338
+ } ;
339
+ ipcMain . on ( SHOW_PLOTTER_WINDOW , showPlotterWindow ) ;
331
340
event . newGuest . setMenu ( null ) ;
332
341
event . newGuest ?. on ( 'closed' , ( ) => {
333
- electronWindow ?. webContents . send ( 'CLOSE_CHILD_WINDOW' ) ;
342
+ ipcMain . removeListener ( SHOW_PLOTTER_WINDOW , showPlotterWindow ) ;
343
+ electronWindow ?. webContents . send ( CLOSE_PLOTTER_WINDOW ) ;
334
344
} ) ;
335
345
event . newGuest ?. loadURL ( url ) ;
336
346
}
You can’t perform that action at this time.
0 commit comments