Conversation
Fixed how the metaclass is defined
|
@copilot review this and provide pros cons and feedback summary |
There was a problem hiding this comment.
codex review
This change introduces a metaclass conflict: QApplication (PySide6/Shiboken type) already has a custom metaclass, so class BlenderApplication(QApplication, metaclass=ABCMeta) is likely to fail at import/class creation with TypeError: metaclass conflict.
metaclass = ABCMeta inside init was ineffective, but replacing it with metaclass=ABCMeta on a Qt base class is not safe.
Suggested fix: keep the Qt metaclass and enforce abstract behavior another way (for example, runtime checks in init_subclass, or a combined metaclass that inherits both the Qt metaclass and ABCMeta).
|
hmm seems i need to investigate this more, will revisit this |
|
I can confirm that this is sometimes not working. Tested it on a different computer and I do get If ABCs are not working with Qt, we should probably remove it and simple But |
PySide implements its own Metaclass which can collide with our defined.
|
what is the benefit if this PR? |
is that because qt already implements it, and we override the ones we need? so there are no missing ones |
|
just had a look at the code again, it completely changed from first commit, lot less complex now. |
It's important to note that with The statement Effectively the code is this, it doesn't use ABC but defines abstractmethod(s). from abc import abstractmethod
class Base:
@abstractmethod
def fnc(self):
pass
class App(Base):
pass
App()Your IDEA doesn't do any runtime checks, but it knows that the parent class (Base) defines some abstractmethods so it will warn on "App" that we are not implementing all abstractmethods. This could give you the illusion that it is properly defining the ABC. |

"Fixed" how the metaclass is defined, and later used.
Using the
__metaclass__is an old pattern. The keyword argument is standard in python 3