@@ -75,9 +75,9 @@ def create_venv(self):
7575 user_venv_dir = f"{ user_directory } /{ venv_dir } /{ self .venv_name .text ()} "
7676 isExist = os .path .exists (user_venv_dir )
7777
78- if isExist :
78+ if self . venv_name . text () == "" :
7979 self .failed_to_create_dialog (case_1 = True )
80- elif self . venv_name . text () == "" or self . venv_name . text () == self . caption :
80+ elif isExist :
8181 self .failed_to_create_dialog (case_2 = True )
8282 else :
8383 Path (f"{ user_directory } /{ venv_dir } /{ self .venv_name .text ()} " ).mkdir (
@@ -101,22 +101,23 @@ def venv_success_dialog(self):
101101 def failed_to_create_dialog (self , case_1 = False , case_2 = False ):
102102 """Dialogs for if environment gets failed to create."""
103103 if case_1 :
104- # Case 1: if environment already exists or blank name
104+ # Case 1: check for name of environment
105105 msg = QtWidgets .QMessageBox ()
106106 msg .setText ("Warning: Failed to create virtual environment!" )
107107 msg .setInformativeText (
108- "Either environment is already exists. Or Please enter valid environment name ."
108+ "Enter a valid name for virtual environment creation ."
109109 )
110110 msg .setWindowTitle ("Warning" )
111111 msg .setIcon (msg .Icon .Warning )
112112 msg .setWindowIcon (self .app_icon )
113113 msg .exec_ ()
114+
114115 elif case_2 :
115- # Case 1: check for name of environment
116+ # Case 2: if environment already exists
116117 msg = QtWidgets .QMessageBox ()
117118 msg .setText ("Warning: Failed to create virtual environment!" )
118119 msg .setInformativeText (
119- "Enter a valid name for virtual environment to create ."
120+ "Virtual environment already exists. Please enter a different virtual environment name ."
120121 )
121122 msg .setWindowTitle ("Warning" )
122123 msg .setIcon (msg .Icon .Warning )
0 commit comments