245 from .VirtualenvExecDialog import VirtualenvExecDialog |
245 from .VirtualenvExecDialog import VirtualenvExecDialog |
246 |
246 |
247 if not baseDir: |
247 if not baseDir: |
248 baseDir = self.__virtualEnvironmentsBaseDir |
248 baseDir = self.__virtualEnvironmentsBaseDir |
249 |
249 |
250 dlg = VirtualenvConfigurationDialog(baseDir=baseDir) |
250 dlg = VirtualenvConfigurationDialog(baseDir=baseDir, parent=self.__ui) |
251 if dlg.exec() == QDialog.DialogCode.Accepted: |
251 if dlg.exec() == QDialog.DialogCode.Accepted: |
252 resultDict = dlg.getData() |
252 resultDict = dlg.getData() |
253 |
253 |
254 if resultDict["envType"] == "conda": |
254 if resultDict["envType"] == "conda": |
255 # create the conda environment |
255 # create the conda environment |
289 venvDirectory = self.getVirtualenvDirectory(venvName) |
289 venvDirectory = self.getVirtualenvDirectory(venvName) |
290 if not os.path.exists(os.path.join(venvDirectory, "pyvenv.cfg")): |
290 if not os.path.exists(os.path.join(venvDirectory, "pyvenv.cfg")): |
291 # The environment was not created by the 'venv' module. |
291 # The environment was not created by the 'venv' module. |
292 return |
292 return |
293 |
293 |
294 dlg = VirtualenvUpgradeConfigurationDialog(venvName, venvDirectory) |
294 dlg = VirtualenvUpgradeConfigurationDialog( |
|
295 venvName, venvDirectory, parent=self.__ui |
|
296 ) |
295 if dlg.exec() == QDialog.DialogCode.Accepted: |
297 if dlg.exec() == QDialog.DialogCode.Accepted: |
296 pythonExe, args, createLog = dlg.getData() |
298 pythonExe, args, createLog = dlg.getData() |
297 |
299 |
298 dia = VirtualenvUpgradeExecDialog(venvName, pythonExe, createLog, self) |
300 dia = VirtualenvUpgradeExecDialog( |
|
301 venvName, pythonExe, createLog, self, parent=self.__ui |
|
302 ) |
299 dia.show() |
303 dia.show() |
300 dia.start(args) |
304 dia.start(args) |
301 dia.exec() |
305 dia.exec() |
302 |
306 |
303 def addVirtualEnv(self, metadata): |
307 def addVirtualEnv(self, metadata): |
322 ).format(metadata.name), |
326 ).format(metadata.name), |
323 icon=EricMessageBox.Warning, |
327 icon=EricMessageBox.Warning, |
324 ) |
328 ) |
325 if not ok: |
329 if not ok: |
326 dlg = VirtualenvNameDialog( |
330 dlg = VirtualenvNameDialog( |
327 list(self.__virtualEnvironments), metadata.name |
331 list(self.__virtualEnvironments), metadata.name, parent=self.__ui |
328 ) |
332 ) |
329 if dlg.exec() != QDialog.DialogCode.Accepted: |
333 if dlg.exec() != QDialog.DialogCode.Accepted: |
330 return |
334 return |
331 |
335 |
332 metadata.name = dlg.getName() |
336 metadata.name = dlg.getName() |
333 |
337 |
334 if not metadata.interpreter: |
338 if not metadata.interpreter: |
335 dlg = VirtualenvInterpreterSelectionDialog(metadata.name, metadata.path) |
339 dlg = VirtualenvInterpreterSelectionDialog( |
|
340 metadata.name, metadata.path, parent=self.__ui |
|
341 ) |
336 if dlg.exec() == QDialog.DialogCode.Accepted: |
342 if dlg.exec() == QDialog.DialogCode.Accepted: |
337 metadata.interpreter = dlg.getData() |
343 metadata.interpreter = dlg.getData() |
338 |
344 |
339 if metadata.interpreter: |
345 if metadata.interpreter: |
340 self.__virtualEnvironments[metadata.name] = metadata |
346 self.__virtualEnvironments[metadata.name] = metadata |
414 venvName, self.__virtualEnvironments[venvName].path |
420 venvName, self.__virtualEnvironments[venvName].path |
415 ) |
421 ) |
416 ) |
422 ) |
417 if venvMessages: |
423 if venvMessages: |
418 dlg = DeleteFilesConfirmationDialog( |
424 dlg = DeleteFilesConfirmationDialog( |
419 None, |
425 self.__ui, |
420 self.tr("Delete Virtual Environments"), |
426 self.tr("Delete Virtual Environments"), |
421 self.tr( |
427 self.tr( |
422 """Do you really want to delete these virtual""" |
428 """Do you really want to delete these virtual""" |
423 """ environments?""" |
429 """ environments?""" |
424 ), |
430 ), |
481 venvName, self.__virtualEnvironments[venvName].path |
487 venvName, self.__virtualEnvironments[venvName].path |
482 ) |
488 ) |
483 ) |
489 ) |
484 if venvMessages: |
490 if venvMessages: |
485 dlg = DeleteFilesConfirmationDialog( |
491 dlg = DeleteFilesConfirmationDialog( |
486 None, |
492 self.__ui, |
487 self.tr("Remove Virtual Environments"), |
493 self.tr("Remove Virtual Environments"), |
488 self.tr( |
494 self.tr( |
489 """Do you really want to remove these virtual""" |
495 """Do you really want to remove these virtual""" |
490 """ environments?""" |
496 """ environments?""" |
491 ), |
497 ), |
547 @type bool |
553 @type bool |
548 """ |
554 """ |
549 from .VirtualenvManagerWidgets import VirtualenvManagerDialog |
555 from .VirtualenvManagerWidgets import VirtualenvManagerDialog |
550 |
556 |
551 if modal: |
557 if modal: |
552 virtualenvManagerDialog = VirtualenvManagerDialog(self, self.__ui) |
558 virtualenvManagerDialog = VirtualenvManagerDialog(self, parent=self.__ui) |
553 virtualenvManagerDialog.exec() |
559 virtualenvManagerDialog.exec() |
554 self.virtualEnvironmentsListChanged.emit() |
560 self.virtualEnvironmentsListChanged.emit() |
555 else: |
561 else: |
556 self.__ui.activateVirtualenvManager() |
562 self.__ui.activateVirtualenvManager() |
557 |
563 |