def _check_upgrade_private_venv(self, path): # If home is wrong then regenerate # If only micro version is different, then upgrade info = _get_venv_info(path) if not eqfn(info["home"], os.path.dirname(sys.executable)): self._create_private_venv( path, "Thonny's virtual environment was created for another interpreter.\n" + "Regenerating the virtual environment for current interpreter.\n" + "(You may need to reinstall your 3rd party packages)\n" + "Please wait!.", clear=True) else: venv_version = tuple(map(int, info["version"].split("."))) sys_version = sys.version_info[:3] assert venv_version[0] == sys_version[0] assert venv_version[1] == sys_version[1] if venv_version[2] != sys_version[2]: self._create_private_venv( path, "Please wait!\nUpgrading Thonny's virtual environment.", upgrade=True)
def get_editor(self, filename, open_when_necessary=False): for child in self.winfo_children(): child_filename = child.get_filename(False) if child_filename and eqfn(child.get_filename(), filename): return child if open_when_necessary: return self._open_file(filename) else: return None