Update api.py, base.py and two other files

This commit is contained in:
Richard Bronkhorst
2023-07-11 07:17:13 +02:00
parent ea34bcfab7
commit 269b5cf537
4 changed files with 28 additions and 15 deletions

View File

@@ -6,14 +6,14 @@ class Reference:
self.typ = typ
self.symbol = symbol
self.store = store
@classmethod
def create(cls, obj):
o = cls(type(obj), obj.symbol, obj.store)
return o
def resolve(self):
self.store.get(self.typ, self.symbol)
return self.store.get(self.typ, self.symbol)
def __repr__(self):
return f'*REF*{self.symbol}.{self.typ.ext()}'
@@ -80,14 +80,6 @@ class Base:
self.disable_dirty = True
self.__dict__.update(d)
self.disable_dirty = False
def __getstate__(self):
r = {}
for k,v in self.__dict__.items():
if k in ['store','file_offset', 'disable_dirty', 'file_offset']:
continue
r[k] = deepcopy(v)
return r
def type(self):
return self.__class__.__name__

View File

@@ -21,7 +21,8 @@ class Waypoint(Base):
def set_system(self):
parts = self.symbol.split('-')
system_str = f'{parts[0]}-{parts[1]}'
self.system = self.store.get(System, system_str, create=True)
system = self.store.get(System, system_str, create=True)
self.system = system
@classmethod
def ext(self):