18 from PyQt6.QtWidgets import QDialog |
18 from PyQt6.QtWidgets import QDialog |
19 |
19 |
20 from eric7 import Preferences |
20 from eric7 import Preferences |
21 from eric7.EricWidgets import EricMessageBox |
21 from eric7.EricWidgets import EricMessageBox |
22 from eric7.EricWidgets.EricApplication import ericApp |
22 from eric7.EricWidgets.EricApplication import ericApp |
23 from eric7.SystemUtilities import FileSystemUtilities, PythonUtilities |
23 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities, PythonUtilities |
24 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
24 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
25 |
25 |
26 from .VirtualenvMeta import VirtualenvMetaData |
26 from .VirtualenvMeta import VirtualenvMetaData |
27 |
27 |
28 |
28 |
477 self.__saveSettings() |
477 self.__saveSettings() |
478 |
478 |
479 self.virtualEnvironmentRemoved.emit() |
479 self.virtualEnvironmentRemoved.emit() |
480 self.virtualEnvironmentsListChanged.emit() |
480 self.virtualEnvironmentsListChanged.emit() |
481 |
481 |
|
482 def searchUnregisteredInterpreters(self): |
|
483 """ |
|
484 Public method to search for unregistered Python interpreters. |
|
485 |
|
486 @return list of unregistered interpreters |
|
487 @rtype list of str |
|
488 """ |
|
489 interpreters = [] |
|
490 baseDir = self.getVirtualEnvironmentsBaseDir() |
|
491 if not baseDir: |
|
492 # search in home directory, if no environments base directory is defined |
|
493 baseDir = OSUtilities.getHomeDir() |
|
494 environments = [ |
|
495 os.path.join(baseDir, d) |
|
496 for d in os.listdir(baseDir) |
|
497 if os.path.isdir(os.path.join(baseDir, d)) |
|
498 ] |
|
499 |
|
500 interpreters = PythonUtilities.searchInterpreters() |
|
501 if environments: |
|
502 interpreters += PythonUtilities.searchInterpreters(environments) |
|
503 |
|
504 interpreters = { |
|
505 i for i in interpreters if not self.environmentForInterpreter(i)[0] |
|
506 } # filter the list into a set to make the remaining ones unique |
|
507 return list(interpreters) |
|
508 |
482 def getEnvironmentEntries(self): |
509 def getEnvironmentEntries(self): |
483 """ |
510 """ |
484 Public method to get a list of the defined virtual environment entries. |
511 Public method to get a list of the defined virtual environment entries. |
485 |
512 |
486 @return list containing a copy of the defined virtual environments |
513 @return list containing a copy of the defined virtual environments |