What I’m trying to do:
I am trying to separate a form I use as a component into a base class and a child class; I am having issues with getting component properties to work along the way
What I’ve tried and what’s not working:
I have moved all the code I plan to reuse in the future from thermometerGague to abstractGague. This includes all the property declarations and their setters and getters etc. I expected the thermometerGague, who is a child of abstractGague, to inherit all those properties, along with their respective setters and getters, - since I don’t want any changes from the parent class behaviour. I then hoped that when these properties get set when thermometerGague’s are created in the hexThermometer class, the inherited setters and getters will get executed. However, it seems to not be the case, and I don’t know why, oh how to get the setters/getters from the parent class to get executed after all.
A custom component class will get its own getters and setters per property you defined in the custom component dialogue. These are actually inherited from the Template class of the form.
You can check this by inspecting the class
class A:
@property
def foo(self):
…
# Custom component with a foo property
class B(BTemplate, A):
…
print(B.foo) # ComponentProperty
print(B.foo is BTemplate.foo) # True
print(B.foo is A.foo) # False
The above happens because BTemplate is next in line in the mro (method resolution order) for class B. And BTemplate has its own property-like definition for foo
Changing the order of the bases should fix the issue since it will change the mro so that class A is next in line.