@@ -75,13 +75,9 @@ def __init__(self, parent):
7575 vscode_layout .addWidget (vscode_window_path_config )
7676
7777 vscode_window_button_open = QtWidgets .QPushButton ("Open" )
78- vscode_window_button_open .clicked .connect (
79- lambda x : self ._pop_up ("Do you want to open?" , self ._open_vscode )
80- )
78+ vscode_window_button_open .clicked .connect (lambda x : self ._open_vscode ())
8179 vscode_window_button_close = QtWidgets .QPushButton ("Close" )
82- vscode_window_button_close .clicked .connect (
83- lambda x : self ._pop_up ("Do you want to close?" , self ._close_all )
84- )
80+ vscode_window_button_close .clicked .connect (lambda x : self ._close_all ())
8581
8682 vscode_window_layout_1 = QtWidgets .QHBoxLayout ()
8783 vscode_window_layout_1 .addWidget (vscode_window_label )
@@ -118,8 +114,6 @@ def _open_vscode(self):
118114 if os .path .exists (rf"{ path } " ):
119115 error_msg = "echo Failed to launch vscode. Try reinstalling code by following this link https://code.visualstudio.com/download"
120116 self ._parent .launch_cmd (f'code "{ path } " && exit 0 || { error_msg } ' )
121-
122- self .user_confirmation_form .close ()
123117 self ._parent .vscode_window .close ()
124118 else :
125119 self .vscode_warning_text .setText (
@@ -130,46 +124,11 @@ def _open_vscode(self):
130124 color: rgb(255, 0, 0);
131125 """
132126 )
133- self .user_confirmation_form .close ()
134127
135128 def _close_all (self ):
136129 """Close all the pop-up window."""
137- self .user_confirmation_form .close ()
138130 self ._parent .vscode_window .close ()
139131
140- def _pop_up (self , message , call_back ):
141- """Launch the confirmation pop-up window."""
142- self .user_confirmation_form = QtWidgets .QWidget ()
143- self .user_confirmation_form .move (
144- self .user_confirmation_form .frameGeometry ().center ()
145- )
146- user_confirmation_label = QtWidgets .QLabel ()
147- user_confirmation_label .setText (message )
148- user_confirmation_label .setOpenExternalLinks (True )
149- user_confirmation_label .setTextFormat (QtCore .Qt .TextFormat .RichText )
150- user_confirmation_label .setAlignment (QtCore .Qt .AlignmentFlag .AlignJustify )
151- user_confirmation_label .setWordWrap (True )
152-
153- user_confirmation_layout_horizontal = QtWidgets .QHBoxLayout ()
154- user_confirmation_yes_button = QtWidgets .QPushButton ("Yes" )
155- user_confirmation_yes_button .clicked .connect (call_back )
156- user_confirmation_no_button = QtWidgets .QPushButton ("No" )
157- user_confirmation_no_button .clicked .connect (self .user_confirmation_form .close )
158- user_confirmation_layout = QtWidgets .QVBoxLayout ()
159- user_confirmation_layout .addWidget (user_confirmation_label )
160- user_confirmation_layout_horizontal .addWidget (user_confirmation_yes_button )
161- user_confirmation_layout_horizontal .addWidget (user_confirmation_no_button )
162- user_confirmation_layout .addLayout (user_confirmation_layout_horizontal )
163- self .user_confirmation_form .setLayout (user_confirmation_layout )
164- self .user_confirmation_form .setWindowTitle ("Confirmation" )
165- icon = QtGui .QIcon (ANSYS_FAVICON )
166- self .user_confirmation_form .setWindowIcon (icon )
167- self .user_confirmation_form .resize (400 , 40 )
168- self .user_confirmation_form .setWindowFlag (
169- QtCore .Qt .WindowCloseButtonHint , False
170- )
171- self .user_confirmation_form .show ()
172-
173132 def is_vscode_installed (self ):
174133 """Check if VSCode is installed or not.
175134
0 commit comments