11import * as fs from 'fs' ;
2+ import * as path from 'path' ;
23import * as React from 'react' ;
34import { connect } from 'react-redux' ;
45
@@ -9,6 +10,8 @@ import { Spinner } from 'office-ui-fabric-react/lib/Spinner';
910import { TextField } from 'office-ui-fabric-react/lib/TextField' ;
1011import Select from 'react-select' ;
1112
13+ import { winmlDataFolder } from '../../native/appData' ;
14+
1215import Collapsible from '../../components/Collapsible' ;
1316import { setFile , setQuantizationOption , setSaveFileName } from '../../datastore/actionCreators' ;
1417import IState from '../../datastore/state' ;
@@ -125,7 +128,7 @@ class ConvertView extends React.Component<IComponentProperties, IComponentState>
125128 return < Spinner label = "Converting..." /> ;
126129 }
127130 this . localPython = this . localPython || getLocalPython ( ) ;
128- if ( ! this . localPython ) {
131+ if ( ! this . localPython || ! fs . existsSync ( path . join ( winmlDataFolder , '/python/PIResult.txt' ) ) ) {
129132 return this . pythonChooser ( ) ;
130133 }
131134 return this . converterView ( ) ;
@@ -184,6 +187,10 @@ class ConvertView extends React.Component<IComponentProperties, IComponentState>
184187 await pip ( [ 'install' , '-r' , packagedFile ( 'requirements.txt' ) , '--no-warn-script-location' ] , this . outputListener ) ;
185188 this . setState ( { currentStep : Step . Idle } ) ;
186189 log . info ( "python environment is installed successfully" ) ;
190+ fs . writeFile ( path . join ( winmlDataFolder , '/python/PIResult.txt' ) , 'Python is installed successfully!' , ( err ) => {
191+ if ( err ) { throw err ; }
192+ log . info ( 'PIResult.txt Saved!' ) ;
193+ } ) ;
187194 pythonDialogOptions . message = 'python environment is installed successfully!'
188195 require ( 'electron' ) . remote . dialog . showMessageBox ( require ( 'electron' ) . remote . getCurrentWindow ( ) , pythonDialogOptions )
189196 } catch ( error ) {
@@ -362,7 +369,7 @@ class ConvertView extends React.Component<IComponentProperties, IComponentState>
362369 }
363370 // Convert successfully
364371 log . info ( this . state . source + " is converted successfully." ) ;
365- convertDialogOptions . message = 'convert successfully!'
372+ convertDialogOptions . message = 'Converted successfully!'
366373 require ( 'electron' ) . remote . dialog . showMessageBox ( require ( 'electron' ) . remote . getCurrentWindow ( ) , convertDialogOptions )
367374 this . setState ( { currentStep : Step . Idle , source : undefined , console :"Converted successfully!!" } ) ;
368375
0 commit comments