79 # is_global: a flag indicating a global environment |
79 # is_global: a flag indicating a global environment |
80 # is_conda: a flag indicating an Anaconda environment |
80 # is_conda: a flag indicating an Anaconda environment |
81 # is_remote: a flag indicating a remotely accessed environment |
81 # is_remote: a flag indicating a remotely accessed environment |
82 # exec_path: a string to be prefixed to the PATH environment |
82 # exec_path: a string to be prefixed to the PATH environment |
83 # setting |
83 # setting |
|
84 # description a description of the environment |
84 # |
85 # |
85 envsToDelete = [] |
86 envsToDelete = [] |
86 for venvName in environments: |
87 for venvName in environments: |
87 environment = environments[venvName] |
88 environment = environments[venvName] |
88 if ("is_remote" in environment and environment["is_remote"]) or os.access( |
89 if ("is_remote" in environment and environment["is_remote"]) or os.access( |
94 environment["is_conda"] = False |
95 environment["is_conda"] = False |
95 if "is_remote" not in environment: |
96 if "is_remote" not in environment: |
96 environment["is_remote"] = False |
97 environment["is_remote"] = False |
97 if "exec_path" not in environment: |
98 if "exec_path" not in environment: |
98 environment["exec_path"] = "" |
99 environment["exec_path"] = "" |
|
100 if "description" not in environment: |
|
101 environment["description"] = "" |
99 self.__virtualEnvironments[venvName] = environment |
102 self.__virtualEnvironments[venvName] = environment |
100 |
103 |
101 # now remove unsupported environments |
104 # now remove unsupported environments |
102 for venvName in envsToDelete: |
105 for venvName in envsToDelete: |
103 del environments[venvName] |
106 del environments[venvName] |
276 @type bool |
281 @type bool |
277 @param isRemote flag indicating a remotely accessed environment |
282 @param isRemote flag indicating a remotely accessed environment |
278 @type bool |
283 @type bool |
279 @param execPath search path string to be prepended to the PATH |
284 @param execPath search path string to be prepended to the PATH |
280 environment variable |
285 environment variable |
|
286 @type str |
|
287 @param description descriptive text for the environment |
281 @type str |
288 @type str |
282 """ |
289 """ |
283 if venvName in self.__virtualEnvironments: |
290 if venvName in self.__virtualEnvironments: |
284 ok = EricMessageBox.yesNo( |
291 ok = EricMessageBox.yesNo( |
285 None, |
292 None, |
317 "variant": 3, # always 3 |
324 "variant": 3, # always 3 |
318 "is_global": isGlobal, |
325 "is_global": isGlobal, |
319 "is_conda": isConda, |
326 "is_conda": isConda, |
320 "is_remote": isRemote, |
327 "is_remote": isRemote, |
321 "exec_path": execPath, |
328 "exec_path": execPath, |
|
329 "description": description, |
322 } |
330 } |
323 |
331 |
324 self.__saveSettings() |
332 self.__saveSettings() |
325 |
333 |
326 self.virtualEnvironmentAdded.emit() |
334 self.virtualEnvironmentAdded.emit() |
351 @type bool |
360 @type bool |
352 @param isRemote flag indicating a remotely accessed environment |
361 @param isRemote flag indicating a remotely accessed environment |
353 @type bool |
362 @type bool |
354 @param execPath search path string to be prepended to the PATH |
363 @param execPath search path string to be prepended to the PATH |
355 environment variable |
364 environment variable |
|
365 @type str |
|
366 @param description descriptive text for the environment |
356 @type str |
367 @type str |
357 """ |
368 """ |
358 if venvName not in self.__virtualEnvironments: |
369 if venvName not in self.__virtualEnvironments: |
359 EricMessageBox.yesNo( |
370 EricMessageBox.yesNo( |
360 None, |
371 None, |
373 "variant": 3, # always 3 |
384 "variant": 3, # always 3 |
374 "is_global": isGlobal, |
385 "is_global": isGlobal, |
375 "is_conda": isConda, |
386 "is_conda": isConda, |
376 "is_remote": isRemote, |
387 "is_remote": isRemote, |
377 "exec_path": execPath, |
388 "exec_path": execPath, |
|
389 "description": description, |
378 } |
390 } |
379 |
391 |
380 self.__saveSettings() |
392 self.__saveSettings() |
381 |
393 |
382 self.virtualEnvironmentChanged.emit(venvName) |
394 self.virtualEnvironmentChanged.emit(venvName) |
411 @type bool |
424 @type bool |
412 @param isRemote flag indicating a remotely accessed environment |
425 @param isRemote flag indicating a remotely accessed environment |
413 @type bool |
426 @type bool |
414 @param execPath search path string to be prepended to the PATH |
427 @param execPath search path string to be prepended to the PATH |
415 environment variable |
428 environment variable |
|
429 @type str |
|
430 @param description descriptive text for the environment |
416 @type str |
431 @type str |
417 """ |
432 """ |
418 if oldVenvName not in self.__virtualEnvironments: |
433 if oldVenvName not in self.__virtualEnvironments: |
419 EricMessageBox.yesNo( |
434 EricMessageBox.yesNo( |
420 None, |
435 None, |
429 |
444 |
430 del self.__virtualEnvironments[oldVenvName] |
445 del self.__virtualEnvironments[oldVenvName] |
431 self.addVirtualEnv( |
446 self.addVirtualEnv( |
432 venvName, |
447 venvName, |
433 venvDirectory, |
448 venvDirectory, |
434 venvInterpreter, |
449 venvInterpreter=venvInterpreter, |
435 isGlobal, |
450 isGlobal=isGlobal, |
436 isConda, |
451 isConda=isConda, |
437 isRemote, |
452 isRemote=isRemote, |
438 execPath, |
453 execPath=execPath, |
|
454 description=description, |
439 ) |
455 ) |
440 |
456 |
441 def deleteVirtualEnvs(self, venvNames): |
457 def deleteVirtualEnvs(self, venvNames): |
442 """ |
458 """ |
443 Public method to delete virtual environments from the list and disk. |
459 Public method to delete virtual environments from the list and disk. |