(self, memo=None)
| 1910 | |
| 1911 | |
| 1912 | def __deepcopy__(self, memo=None): |
| 1913 | fitCopy = Fit() |
| 1914 | # Character and owner are not copied |
| 1915 | fitCopy.character = self.__character |
| 1916 | fitCopy.owner = self.owner |
| 1917 | fitCopy.ship = deepcopy(self.ship) |
| 1918 | fitCopy.mode = deepcopy(self.mode) |
| 1919 | fitCopy.name = "%s copy" % self.name |
| 1920 | fitCopy.damagePattern = self.damagePattern |
| 1921 | fitCopy.targetProfile = self.targetProfile |
| 1922 | fitCopy.implantLocation = self.implantLocation |
| 1923 | fitCopy.systemSecurity = self.systemSecurity |
| 1924 | fitCopy.pilotSecurity = self.pilotSecurity |
| 1925 | fitCopy.notes = self.notes |
| 1926 | |
| 1927 | for i in self.modules: |
| 1928 | fitCopy.modules.appendIgnoreEmpty(deepcopy(i)) |
| 1929 | toCopy = ( |
| 1930 | "drones", |
| 1931 | "fighters", |
| 1932 | "cargo", |
| 1933 | "implants", |
| 1934 | "boosters", |
| 1935 | "projectedModules", |
| 1936 | "projectedDrones", |
| 1937 | "projectedFighters") |
| 1938 | for name in toCopy: |
| 1939 | orig = getattr(self, name) |
| 1940 | c = getattr(fitCopy, name) |
| 1941 | for i in orig: |
| 1942 | c.append(deepcopy(i)) |
| 1943 | |
| 1944 | # this bit is required -- see GH issue # 83 |
| 1945 | def forceUpdateSavedata(fit): |
| 1946 | eos.db.saveddata_session.flush() |
| 1947 | eos.db.saveddata_session.refresh(fit) |
| 1948 | |
| 1949 | for fit in self.commandFits: |
| 1950 | fitCopy.commandFitDict[fit.ID] = fit |
| 1951 | forceUpdateSavedata(fit) |
| 1952 | copyCommandInfo = fit.getCommandInfo(fitCopy.ID) |
| 1953 | originalCommandInfo = fit.getCommandInfo(self.ID) |
| 1954 | copyCommandInfo.active = originalCommandInfo.active |
| 1955 | forceUpdateSavedata(fit) |
| 1956 | |
| 1957 | for fit in self.projectedFits: |
| 1958 | fitCopy.projectedFitDict[fit.ID] = fit |
| 1959 | forceUpdateSavedata(fit) |
| 1960 | copyProjectionInfo = fit.getProjectionInfo(fitCopy.ID) |
| 1961 | originalProjectionInfo = fit.getProjectionInfo(self.ID) |
| 1962 | copyProjectionInfo.active = originalProjectionInfo.active |
| 1963 | copyProjectionInfo.amount = originalProjectionInfo.amount |
| 1964 | copyProjectionInfo.projectionRange = originalProjectionInfo.projectionRange |
| 1965 | forceUpdateSavedata(fit) |
| 1966 | |
| 1967 | return fitCopy |
| 1968 | |
| 1969 | def __repr__(self): |
nothing calls this directly
no test coverage detected