eric6/VirtualEnv/VirtualenvExecDialog.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8176
31965986ecd1
parent 8260
2161475d9639
equal deleted inserted replaced
8190:fb0ef164f536 8273:698ae46f40a4
37 @param venvManager reference to the virtual environment manager 37 @param venvManager reference to the virtual environment manager
38 @type VirtualenvManager 38 @type VirtualenvManager
39 @param parent reference to the parent widget 39 @param parent reference to the parent widget
40 @type QWidget 40 @type QWidget
41 """ 41 """
42 super(VirtualenvExecDialog, self).__init__(parent) 42 super().__init__(parent)
43 self.setupUi(self) 43 self.setupUi(self)
44 44
45 self.buttonBox.button( 45 self.buttonBox.button(
46 QDialogButtonBox.StandardButton.Close).setEnabled(False) 46 QDialogButtonBox.StandardButton.Close).setEnabled(False)
47 self.buttonBox.button( 47 self.buttonBox.button(
259 def __writeLogFile(self): 259 def __writeLogFile(self):
260 """ 260 """
261 Private method to write a log file to the virtualenv directory. 261 Private method to write a log file to the virtualenv directory.
262 """ 262 """
263 outtxt = self.contents.toPlainText() 263 outtxt = self.contents.toPlainText()
264 if self.__pyvenv: 264 logFile = (
265 logFile = os.path.join(self.__targetDir, "pyvenv.log") 265 os.path.join(self.__targetDir, "pyvenv.log")
266 else: 266 if self.__pyvenv else
267 logFile = os.path.join(self.__targetDir, "virtualenv.log") 267 os.path.join(self.__targetDir, "virtualenv.log")
268 )
268 self.__logOutput(self.tr("\nWriting log file '{0}'.\n") 269 self.__logOutput(self.tr("\nWriting log file '{0}'.\n")
269 .format(logFile)) 270 .format(logFile))
270 271
271 try: 272 try:
272 with open(logFile, "w", encoding="utf-8") as f: 273 with open(logFile, "w", encoding="utf-8") as f:
285 286
286 def __writeScriptFile(self): 287 def __writeScriptFile(self):
287 """ 288 """
288 Private method to write a script file to the virtualenv directory. 289 Private method to write a script file to the virtualenv directory.
289 """ 290 """
290 if self.__pyvenv: 291 basename = "create_pyvenv" if self.__pyvenv else "create_virtualenv"
291 basename = "create_pyvenv"
292 else:
293 basename = "create_virtualenv"
294 if isWindowsPlatform(): 292 if isWindowsPlatform():
295 script = os.path.join(self.__targetDir, basename + ".cmd") 293 script = os.path.join(self.__targetDir, basename + ".cmd")
296 txt = self.__cmd 294 txt = self.__cmd
297 else: 295 else:
298 script = os.path.join(self.__targetDir, basename + ".sh") 296 script = os.path.join(self.__targetDir, basename + ".sh")

eric ide

mercurial