172 from .VirtualenvConfigurationDialog import ( |
172 from .VirtualenvConfigurationDialog import ( |
173 VirtualenvConfigurationDialog |
173 VirtualenvConfigurationDialog |
174 ) |
174 ) |
175 |
175 |
176 dlg = VirtualenvConfigurationDialog() |
176 dlg = VirtualenvConfigurationDialog() |
177 if dlg.exec_() == QDialog.Accepted: |
177 if dlg.exec() == QDialog.Accepted: |
178 resultDict = dlg.getData() |
178 resultDict = dlg.getData() |
179 |
179 |
180 if resultDict["envType"] == "conda": |
180 if resultDict["envType"] == "conda": |
181 # create the conda environment |
181 # create the conda environment |
182 conda = e5App().getObject("Conda") |
182 conda = e5App().getObject("Conda") |
191 # now do the call |
191 # now do the call |
192 from .VirtualenvExecDialog import VirtualenvExecDialog |
192 from .VirtualenvExecDialog import VirtualenvExecDialog |
193 dia = VirtualenvExecDialog(resultDict, self) |
193 dia = VirtualenvExecDialog(resultDict, self) |
194 dia.show() |
194 dia.show() |
195 dia.start(resultDict["arguments"]) |
195 dia.start(resultDict["arguments"]) |
196 dia.exec_() |
196 dia.exec() |
197 |
197 |
198 def addVirtualEnv(self, venvName, venvDirectory, venvInterpreter="", |
198 def addVirtualEnv(self, venvName, venvDirectory, venvInterpreter="", |
199 isGlobal=False, isConda=False, isRemote=False, |
199 isGlobal=False, isConda=False, isRemote=False, |
200 execPath=""): |
200 execPath=""): |
201 """ |
201 """ |
228 if not ok: |
228 if not ok: |
229 from .VirtualenvNameDialog import VirtualenvNameDialog |
229 from .VirtualenvNameDialog import VirtualenvNameDialog |
230 dlg = VirtualenvNameDialog( |
230 dlg = VirtualenvNameDialog( |
231 list(self.__virtualEnvironments.keys()), |
231 list(self.__virtualEnvironments.keys()), |
232 venvName) |
232 venvName) |
233 if dlg.exec_() != QDialog.Accepted: |
233 if dlg.exec() != QDialog.Accepted: |
234 return |
234 return |
235 |
235 |
236 venvName = dlg.getName() |
236 venvName = dlg.getName() |
237 |
237 |
238 if not venvInterpreter: |
238 if not venvInterpreter: |
239 from .VirtualenvInterpreterSelectionDialog import ( |
239 from .VirtualenvInterpreterSelectionDialog import ( |
240 VirtualenvInterpreterSelectionDialog |
240 VirtualenvInterpreterSelectionDialog |
241 ) |
241 ) |
242 dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory) |
242 dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory) |
243 if dlg.exec_() == QDialog.Accepted: |
243 if dlg.exec() == QDialog.Accepted: |
244 venvInterpreter = dlg.getData() |
244 venvInterpreter = dlg.getData() |
245 |
245 |
246 if venvInterpreter: |
246 if venvInterpreter: |
247 self.__virtualEnvironments[venvName] = { |
247 self.__virtualEnvironments[venvName] = { |
248 "path": venvDirectory, |
248 "path": venvDirectory, |
370 self.tr("Delete Virtual Environments"), |
370 self.tr("Delete Virtual Environments"), |
371 self.tr("""Do you really want to delete these virtual""" |
371 self.tr("""Do you really want to delete these virtual""" |
372 """ environments?"""), |
372 """ environments?"""), |
373 venvMessages |
373 venvMessages |
374 ) |
374 ) |
375 if dlg.exec_() == QDialog.Accepted: |
375 if dlg.exec() == QDialog.Accepted: |
376 for venvName in venvNames: |
376 for venvName in venvNames: |
377 if self.__isEnvironmentDeleteable(venvName): |
377 if self.__isEnvironmentDeleteable(venvName): |
378 if self.isCondaEnvironment(venvName): |
378 if self.isCondaEnvironment(venvName): |
379 conda = e5App().getObject("Conda") |
379 conda = e5App().getObject("Conda") |
380 path = self.__virtualEnvironments[venvName]["path"] |
380 path = self.__virtualEnvironments[venvName]["path"] |
435 self.tr("Remove Virtual Environments"), |
435 self.tr("Remove Virtual Environments"), |
436 self.tr("""Do you really want to remove these virtual""" |
436 self.tr("""Do you really want to remove these virtual""" |
437 """ environments?"""), |
437 """ environments?"""), |
438 venvMessages |
438 venvMessages |
439 ) |
439 ) |
440 if dlg.exec_() == QDialog.Accepted: |
440 if dlg.exec() == QDialog.Accepted: |
441 for venvName in venvNames: |
441 for venvName in venvNames: |
442 if venvName in self.__virtualEnvironments: |
442 if venvName in self.__virtualEnvironments: |
443 del self.__virtualEnvironments[venvName] |
443 del self.__virtualEnvironments[venvName] |
444 |
444 |
445 self.__saveSettings() |
445 self.__saveSettings() |