From 65b0c5ef18c89d5e63d8c41ea009d80f56c060ab Mon Sep 17 00:00:00 2001 From: Mika Fischer Date: Thu, 16 Jun 2011 16:07:26 +0200 Subject: [PATCH] Make multiple inheritance a bit more safe --- sloth/annotations/model.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sloth/annotations/model.py b/sloth/annotations/model.py index 5b71c28..9677e43 100644 --- a/sloth/annotations/model.py +++ b/sloth/annotations/model.py @@ -11,11 +11,16 @@ ItemRole, TypeRole, DataRole, ImageRole = [Qt.UserRole + i + 1 for i in range(4) class ModelItem(MutableMapping): def __init__(self): - self._children = [] - self._pindex = [] - self._model = None - self._parent = None - self._columns = 1 + if not hasattr(self, "_children"): + self._children = [] + if not hasattr(self, "_pindex"): + self._pindex = [] + if not hasattr(self, "_model"): + self._model = None + if not hasattr(self, "_parent"): + self._parent = None + if not hasattr(self, "_columns"): + self._columns = 1 if not hasattr(self, "_dict"): self._dict = {}