@@ -16,6 +16,7 @@ import * as yaml from 'js-yaml';
16
16
import * as semver from 'semver' ;
17
17
import * as fs from 'fs' ;
18
18
import {
19
+ bundledEnvironmentIsInstalled ,
19
20
clearSession ,
20
21
EnvironmentInstallStatus ,
21
22
getBundledPythonEnvPath ,
@@ -392,6 +393,12 @@ export class JupyterApplication implements IApplication, IDisposable {
392
393
installUpdatesAutomatically : settings . getValue (
393
394
SettingType . installUpdatesAutomatically
394
395
) ,
396
+ notifyOnBundledEnvUpdates : settings . getValue (
397
+ SettingType . notifyOnBundledEnvUpdates
398
+ ) ,
399
+ updateBundledEnvAutomatically : settings . getValue (
400
+ SettingType . updateBundledEnvAutomatically
401
+ ) ,
395
402
defaultWorkingDirectory : userSettings . getValue (
396
403
SettingType . defaultWorkingDirectory
397
404
) ,
@@ -429,7 +436,9 @@ export class JupyterApplication implements IApplication, IDisposable {
429
436
isDarkTheme : this . _isDarkTheme ,
430
437
defaultPythonPath : userSettings . getValue ( SettingType . pythonPath ) ,
431
438
app : this ,
432
- activateTab
439
+ activateTab,
440
+ bundledEnvInstallationExists : bundledEnvironmentIsInstalled ( ) ,
441
+ bundledEnvInstallationLatest : this . _registry . bundledEnvironmentIsLatest ( )
433
442
} ) ;
434
443
435
444
this . _managePythonEnvDialog = dialog ;
@@ -529,7 +538,16 @@ export class JupyterApplication implements IApplication, IDisposable {
529
538
} ;
530
539
531
540
dialog . showMessageBox ( dialogOpts ) . then ( returnValue => {
532
- if ( returnValue . response === 0 ) autoUpdater . quitAndInstall ( ) ;
541
+ if ( returnValue . response === 0 ) {
542
+ if (
543
+ userSettings . getValue ( SettingType . updateBundledEnvAutomatically ) &&
544
+ bundledEnvironmentIsInstalled ( )
545
+ ) {
546
+ appData . updateBundledEnvOnRestart = true ;
547
+ appData . save ( ) ;
548
+ }
549
+ autoUpdater . quitAndInstall ( ) ;
550
+ }
533
551
} ) ;
534
552
} ) ;
535
553
@@ -773,6 +791,27 @@ export class JupyterApplication implements IApplication, IDisposable {
773
791
}
774
792
) ;
775
793
794
+ this . _evm . registerEventHandler (
795
+ EventTypeMain . UpdateBundledPythonEnv ,
796
+ async event => {
797
+ const choice = dialog . showMessageBoxSync ( {
798
+ type : 'warning' ,
799
+ message : 'Update bundled environment' ,
800
+ detail :
801
+ 'App will restart and the existing environment installation will be deleted before the update. Would you like to continue?' ,
802
+ buttons : [ 'Update' , 'Cancel' ] ,
803
+ defaultId : 1 ,
804
+ cancelId : 1
805
+ } ) ;
806
+
807
+ if ( choice === 0 ) {
808
+ appData . updateBundledEnvOnRestart = true ;
809
+ app . relaunch ( ) ;
810
+ app . quit ( ) ;
811
+ }
812
+ }
813
+ ) ;
814
+
776
815
this . _evm . registerEventHandler (
777
816
EventTypeMain . ShowManagePythonEnvironmentsDialog ,
778
817
async ( event , activateTab ) => {
@@ -1091,6 +1130,15 @@ export class JupyterApplication implements IApplication, IDisposable {
1091
1130
}
1092
1131
) ;
1093
1132
1133
+ this . _evm . registerEventHandler (
1134
+ EventTypeMain . SetSettings ,
1135
+ ( _event , settings : { [ key : string ] : any } ) => {
1136
+ for ( const key in settings ) {
1137
+ userSettings . setValue ( key as SettingType , settings [ key ] ) ;
1138
+ }
1139
+ }
1140
+ ) ;
1141
+
1094
1142
this . _evm . registerSyncEventHandler (
1095
1143
EventTypeMain . GetServerInfo ,
1096
1144
( event ) : IServerInfo => {
0 commit comments