I saw in ActiveState page the folowing code to make a singleton:
class Borg:
    __shared_state = {}
    def __init__(self):
        self.__dict__ = self.__shared_state
    # and whatever else you want in your class -- that's all!

And in all Qt classes I customize via inheritance I do the folowing:
class MyClass(QSomeName):
        def __init__(self):
                QSomeName.__init__(self)

I want to make a config class that recives some signals, so I inhertit from 
QObject. I did the folowing in the constructor...
def __init__(self):
    if self.__shared_state == None:
      QObject.__init__(self)
    self.__dict__ = self.__shared_state

It seems to work, but I'm not sure. Have you ever tried to do something like 
that?

Thanks
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to