184 |
184 |
185 if not baseDir: |
185 if not baseDir: |
186 baseDir = self.__virtualEnvironmentsBaseDir |
186 baseDir = self.__virtualEnvironmentsBaseDir |
187 |
187 |
188 dlg = VirtualenvConfigurationDialog(baseDir=baseDir) |
188 dlg = VirtualenvConfigurationDialog(baseDir=baseDir) |
189 if dlg.exec() == QDialog.Accepted: |
189 if dlg.exec() == QDialog.DialogCode.Accepted: |
190 resultDict = dlg.getData() |
190 resultDict = dlg.getData() |
191 |
191 |
192 if resultDict["envType"] == "conda": |
192 if resultDict["envType"] == "conda": |
193 # create the conda environment |
193 # create the conda environment |
194 conda = e5App().getObject("Conda") |
194 conda = e5App().getObject("Conda") |
240 if not ok: |
240 if not ok: |
241 from .VirtualenvNameDialog import VirtualenvNameDialog |
241 from .VirtualenvNameDialog import VirtualenvNameDialog |
242 dlg = VirtualenvNameDialog( |
242 dlg = VirtualenvNameDialog( |
243 list(self.__virtualEnvironments.keys()), |
243 list(self.__virtualEnvironments.keys()), |
244 venvName) |
244 venvName) |
245 if dlg.exec() != QDialog.Accepted: |
245 if dlg.exec() != QDialog.DialogCode.Accepted: |
246 return |
246 return |
247 |
247 |
248 venvName = dlg.getName() |
248 venvName = dlg.getName() |
249 |
249 |
250 if not venvInterpreter: |
250 if not venvInterpreter: |
251 from .VirtualenvInterpreterSelectionDialog import ( |
251 from .VirtualenvInterpreterSelectionDialog import ( |
252 VirtualenvInterpreterSelectionDialog |
252 VirtualenvInterpreterSelectionDialog |
253 ) |
253 ) |
254 dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory) |
254 dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory) |
255 if dlg.exec() == QDialog.Accepted: |
255 if dlg.exec() == QDialog.DialogCode.Accepted: |
256 venvInterpreter = dlg.getData() |
256 venvInterpreter = dlg.getData() |
257 |
257 |
258 if venvInterpreter: |
258 if venvInterpreter: |
259 self.__virtualEnvironments[venvName] = { |
259 self.__virtualEnvironments[venvName] = { |
260 "path": venvDirectory, |
260 "path": venvDirectory, |
382 self.tr("Delete Virtual Environments"), |
382 self.tr("Delete Virtual Environments"), |
383 self.tr("""Do you really want to delete these virtual""" |
383 self.tr("""Do you really want to delete these virtual""" |
384 """ environments?"""), |
384 """ environments?"""), |
385 venvMessages |
385 venvMessages |
386 ) |
386 ) |
387 if dlg.exec() == QDialog.Accepted: |
387 if dlg.exec() == QDialog.DialogCode.Accepted: |
388 for venvName in venvNames: |
388 for venvName in venvNames: |
389 if self.__isEnvironmentDeleteable(venvName): |
389 if self.__isEnvironmentDeleteable(venvName): |
390 if self.isCondaEnvironment(venvName): |
390 if self.isCondaEnvironment(venvName): |
391 conda = e5App().getObject("Conda") |
391 conda = e5App().getObject("Conda") |
392 path = self.__virtualEnvironments[venvName]["path"] |
392 path = self.__virtualEnvironments[venvName]["path"] |
447 self.tr("Remove Virtual Environments"), |
447 self.tr("Remove Virtual Environments"), |
448 self.tr("""Do you really want to remove these virtual""" |
448 self.tr("""Do you really want to remove these virtual""" |
449 """ environments?"""), |
449 """ environments?"""), |
450 venvMessages |
450 venvMessages |
451 ) |
451 ) |
452 if dlg.exec() == QDialog.Accepted: |
452 if dlg.exec() == QDialog.DialogCode.Accepted: |
453 for venvName in venvNames: |
453 for venvName in venvNames: |
454 if venvName in self.__virtualEnvironments: |
454 if venvName in self.__virtualEnvironments: |
455 del self.__virtualEnvironments[venvName] |
455 del self.__virtualEnvironments[venvName] |
456 |
456 |
457 self.__saveSettings() |
457 self.__saveSettings() |