Skip to content
Snippets Groups Projects
Commit a2413cc0 authored by Daniel Brown's avatar Daniel Brown
Browse files

fixing issue where kat class changes were being made globally instead of to the cloned class

parent b20e1b58
No related branches found
No related tags found
No related merge requests found
...@@ -357,6 +357,9 @@ class kat(object): ...@@ -357,6 +357,9 @@ class kat(object):
def __init__(self, kat_file=None, kat_code=None, katdir="", katname="", tempdir=None, tempname=None): def __init__(self, kat_file=None, kat_code=None, katdir="", katname="", tempdir=None, tempname=None):
cls = type(self)
self.__class__ = type(cls.__name__, (cls,), {})
self.scene = None # scene object for GUI self.scene = None # scene object for GUI
self.verbose = True self.verbose = True
self.__blocks = OrderedDict() # dictionary of blocks that are used self.__blocks = OrderedDict() # dictionary of blocks that are used
...@@ -402,9 +405,6 @@ class kat(object): ...@@ -402,9 +405,6 @@ class kat(object):
if kat_file != None: if kat_file != None:
self.loadKatFile(kat_file) self.loadKatFile(kat_file)
cls = type(self)
self.__class__ = type(cls.__name__, (cls,), {})
@property @property
def signals(self): return self.__signals def signals(self): return self.__signals
...@@ -687,7 +687,7 @@ class kat(object): ...@@ -687,7 +687,7 @@ class kat(object):
if obj != None and not isinstance(obj, str): if obj != None and not isinstance(obj, str):
if self.hasNamedObject(obj.name): if self.hasNamedObject(obj.name):
getattr(self, obj.name).remove() getattr(self, obj.name).remove()
print "Removed existing object '{0}' of type {1} to add new object".format(obj.name, obj.__class__) print "Removed existing object '{0}' of type {1} to add line '{2}'".format(obj.name, obj.__class__, line)
self.add(obj) self.add(obj)
...@@ -1021,8 +1021,8 @@ class kat(object): ...@@ -1021,8 +1021,8 @@ class kat(object):
del nodes del nodes
import gc #import gc
print gc.get_referrers(obj) #print gc.get_referrers(obj)
def getMatrices(self): def getMatrices(self):
...@@ -1404,6 +1404,9 @@ class kat(object): ...@@ -1404,6 +1404,9 @@ class kat(object):
raise exceptions.ValueError("Argument is not of type Command") raise exceptions.ValueError("Argument is not of type Command")
name = com.__class__.__name__ name = com.__class__.__name__
print getattr(self.__class__, name)
delattr(self.__class__, name) delattr(self.__class__, name)
delattr(self, '__com_' + name) delattr(self, '__com_' + name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment