Skip to content

Commit

Permalink
Env Configuration Fix
Browse files Browse the repository at this point in the history
1. [GUI] Correct the format of pathstring to append to PATH variable
2. [GUI] Fix incorrect value assignment for emitflag
3. [GUI] Allow messagebox to display the exception when dependency installation is failed
  • Loading branch information
Spr-Aachen committed Apr 7, 2024
1 parent f466b28 commit 344fdfc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions EVT_GUI/EnvConfigurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def Install_Aria2(self):
File_Name = 'Aria2'
File_Format = 'zip'
Path_Download = os.path.join(Dir_Download, f"{File_Name}.{File_Format}")
Dir_Install = f"{os.getenv('SystemDrive')}/Aria2"
Dir_Install = Path(f"{os.getenv('SystemDrive')}/Aria2").__str__()
DownloadFile(URL, Dir_Download, File_Name, File_Format, None)
shutil.unpack_archive(Path_Download, Dir_Install, Path_Download.rsplit('.', 1)[-1])
MoveFiles(os.path.dirname(GetPaths(Dir_Install, 'aria2c.exe')[0]), Dir_Install)
Expand Down Expand Up @@ -144,7 +144,7 @@ def Install_FFmpeg(self):
File_Name = 'FFmpeg'
File_Format = 'zip'
Path_Download = os.path.join(Dir_Download, f"{File_Name}.{File_Format}")
Dir_Install = f"{os.getenv('SystemDrive')}/FFmpeg"
Dir_Install = Path(f"{os.getenv('SystemDrive')}/FFmpeg").__str__()
Path_Binary = os.path.normpath(os.path.join(Dir_Install, 'bin'))
DownloadFile(URL, Dir_Download, File_Name, File_Format, None)
shutil.unpack_archive(Path_Download, Dir_Install, Path_Download.rsplit('.', 1)[-1])
Expand Down Expand Up @@ -204,7 +204,7 @@ def Install_GCC(self):
File_Name = 'MinGW'
File_Format = 'zip'
Path_Download = os.path.join(Dir_Download, f"{File_Name}.{File_Format}")
Dir_Install = f"{os.getenv('SystemDrive')}/MinGW"
Dir_Install = Path(f"{os.getenv('SystemDrive')}/MinGW").__str__()
Path_Binary = os.path.normpath(os.path.join(Dir_Install, 'bin'))
DownloadFile(URL, Dir_Download, File_Name, File_Format, None)
shutil.unpack_archive(Path_Download, Dir_Install, Path_Download.rsplit('.', 1)[-1])
Expand Down Expand Up @@ -264,7 +264,7 @@ def Install_CMake(self):
File_Name = 'CMake'
File_Format = 'zip'
Path_Download = os.path.join(Dir_Download, f"{File_Name}.{File_Format}")
Dir_Install = f"{os.getenv('SystemDrive')}/CMake"
Dir_Install = Path(f"{os.getenv('SystemDrive')}/CMake").__str__()
Path_Binary = os.path.normpath(os.path.join(Dir_Install, 'bin'))
DownloadFile(URL, Dir_Download, File_Name, File_Format, None)
shutil.unpack_archive(Path_Download, Dir_Install, Path_Download.rsplit('.', 1)[-1])
Expand All @@ -282,7 +282,7 @@ def Execute_CMake_Installation(self):
self.MinGW_Bin_Path = Path
break
elif Index == len(PathList) - 1:
self.MinGW_Bin_Path = f"{os.getenv('SystemDrive')}/MinGW/bin"
self.MinGW_Bin_Path = Path(f"{os.getenv('SystemDrive')}/MinGW/bin").__str__()
#shutil.copy2(os.path.join(self.MinGW_Bin_Path, 'mingw32-make.exe'), os.path.join(self.MinGW_Bin_Path, 'make.exe')) if not os.path.isfile(os.path.join(self.MinGW_Bin_Path, 'make.exe')) else None
Result = self.Check_CMake()
Expand Down Expand Up @@ -515,7 +515,7 @@ def Execute_Pytorch_Installation(self):
if Result == False:
if self.EmitFlag == True:
EnvConfiguratorSignals.Signal_PytorchUndetected.emit()
self.EmitFlag == False
self.EmitFlag = False
EnvConfiguratorSignals.Signal_PytorchStatus.emit(f"Installing {Package}. Please wait...")
try:
self.Install_Pytorch(Package)
Expand Down
22 changes: 11 additions & 11 deletions Run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,10 +1192,10 @@ def Main(self):
lambda: EnvConfiguratorSignals.Signal_Aria2Detected.emit()
)
EnvConfiguratorSignals.Signal_Aria2InstallFailed.connect(
lambda: Function_ShowMessageBox(self,
lambda Exception: Function_ShowMessageBox(self,
MessageType = QMessageBox.Warning,
WindowTitle = "Warning",
Text = "安装Aria2出错",
Text = f"安装Aria2出错\n{Exception}",
)
)
EnvConfiguratorSignals.Signal_Aria2Detected.connect(
Expand Down Expand Up @@ -1236,10 +1236,10 @@ def Main(self):
lambda: EnvConfiguratorSignals.Signal_FFmpegDetected.emit()
)
EnvConfiguratorSignals.Signal_FFmpegInstallFailed.connect(
lambda: Function_ShowMessageBox(self,
lambda Exception: Function_ShowMessageBox(self,
MessageType = QMessageBox.Warning,
WindowTitle = "Warning",
Text = "安装FFmpeg出错",
Text = f"安装FFmpeg出错\n{Exception}",
)
)
EnvConfiguratorSignals.Signal_FFmpegDetected.connect(
Expand Down Expand Up @@ -1280,10 +1280,10 @@ def Main(self):
lambda: EnvConfiguratorSignals.Signal_PythonDetected.emit()
)
EnvConfiguratorSignals.Signal_PythonInstallFailed.connect(
lambda: Function_ShowMessageBox(self,
lambda Exception: Function_ShowMessageBox(self,
MessageType = QMessageBox.Warning,
WindowTitle = "Warning",
Text = "安装Python出错",
Text = f"安装Python出错\n{Exception}",
)
)
EnvConfiguratorSignals.Signal_PythonDetected.connect(
Expand Down Expand Up @@ -1324,10 +1324,10 @@ def Main(self):
lambda: EnvConfiguratorSignals.Signal_PyReqsDetected.emit()
)
EnvConfiguratorSignals.Signal_PythonInstallFailed.connect(
lambda: Function_ShowMessageBox(self,
lambda Exception: Function_ShowMessageBox(self,
MessageType = QMessageBox.Warning,
WindowTitle = "Warning",
Text = "安装Python依赖库出错"
Text = f"安装Python依赖库出错\n{Exception}"
)
)
EnvConfiguratorSignals.Signal_PyReqsDetected.connect(
Expand All @@ -1349,7 +1349,7 @@ def Main(self):
Method = Pytorch_Installer.Execute,
Params = ()
)
EnvConfiguratorSignals.Signal_PythonDetected.connect(
EnvConfiguratorSignals.Signal_PyReqsDetected.connect(
self.ui.Button_Install_Pytorch.click #if Config.GetValue('Env', 'Pytorch', 'Undetected') == 'Undetected' else EnvConfiguratorSignals.Signal_PytorchDetected.emit
)
self.ui.Button_Install_Pytorch.setText('')
Expand All @@ -1368,10 +1368,10 @@ def Main(self):
lambda: EnvConfiguratorSignals.Signal_PytorchDetected.emit()
)
EnvConfiguratorSignals.Signal_PytorchInstallFailed.connect(
lambda: Function_ShowMessageBox(self,
lambda Exception: Function_ShowMessageBox(self,
MessageType = QMessageBox.Warning,
WindowTitle = "Warning",
Text = "安装Pytorch出错",
Text = f"安装Pytorch出错\n{Exception}",
)
)
EnvConfiguratorSignals.Signal_PytorchDetected.connect(
Expand Down

0 comments on commit 344fdfc

Please sign in to comment.