equal
deleted
inserted
replaced
148 def hash(self): |
148 def hash(self): |
149 """ Produce a hash, any change in HMI tree structure change that hash """ |
149 """ Produce a hash, any change in HMI tree structure change that hash """ |
150 s = hashlib.new('md5') |
150 s = hashlib.new('md5') |
151 self._hash(s) |
151 self._hash(s) |
152 # limit size to HMI_HASH_SIZE as in svghmi.c |
152 # limit size to HMI_HASH_SIZE as in svghmi.c |
153 return list(map(ord,s.digest()))[:8] |
153 return s.digest()[:8] |
154 |
154 |
155 def _hash(self, s): |
155 def _hash(self, s): |
156 s.update(str((self.name,self.nodetype))) |
156 s.update(self.name.encode() + self.nodetype.encode()) |
157 if hasattr(self, "children"): |
157 if hasattr(self, "children"): |
158 for c in self.children: |
158 for c in self.children: |
159 c._hash(s) |
159 c._hash(s) |
160 |
160 |
161 SPECIAL_NODES = [("HMI_ROOT", "HMI_NODE"), |
161 SPECIAL_NODES = [("HMI_ROOT", "HMI_NODE"), |