mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-11 00:12:24 +12:00
* Fix #855 - Avoid a crash when there's no model * Moved the update id to the AbstactItem class
This commit is contained in:
parent
40e6bf0793
commit
f5fa60c50c
|
@ -47,14 +47,9 @@ class abstractItem():
|
|||
if parent:
|
||||
# add this as a child to the parent, and link to the outlineModel of the parent
|
||||
parent.appendChild(self)
|
||||
elif not model:
|
||||
print("Warning: floating outline item (has no parent or associated Outline model).")
|
||||
|
||||
if ID:
|
||||
self._data[self.enum.ID] = ID
|
||||
self._model.updateAvailableIDs(ID) # Informs the ID distributor that this ID number has been used
|
||||
else:
|
||||
self._data[self.enum.ID] = self._model.requestNewID()
|
||||
|
||||
|
||||
|
||||
|
@ -64,6 +59,11 @@ class abstractItem():
|
|||
|
||||
def setModel(self, model):
|
||||
self._model = model
|
||||
if not self.ID():
|
||||
self.getUniqueID()
|
||||
elif model:
|
||||
# if we are setting a model update it's ID
|
||||
self._model.updateAvailableIDs(self.ID())
|
||||
for c in self.children():
|
||||
c.setModel(model)
|
||||
|
||||
|
|
Loading…
Reference in a new issue