MVC Pattern

Hi everybody,

has anybody implemented the MVC-Pattern in wxpython or knows where I can get the code ?

regards
tom

I am trying to use a kind of MVC pattern (M-VC in my case). I just created
some mixin classes to add the dependency mechanism:

class mixinDepend:
    def __init__(self):
        self.dependents=

    def addDependent(self,dependent):
        self.dependents.append(dependent)

    def removeDependent(self,dependent):
        self.dependents.remove(dependent)

    def clearDependents(self):
        self.dependents=

    def changed(self,aspect=False,with=False):
        map(lambda s:s.update(aspect,with),self.dependents)

    def update(self,aspect=False,with=False):
        print self.__class__,'Update',aspect,with

class mixinModel(mixinDepend):
    def __init__(self):
        mixinDepend.__init__(self)

class mixinVC(mixinDepend):
    def __init__(self,model,win):
        mixinDepend.__init__(self)
        self.Model=model
        self.Win=win
        self.isSelected=False

    def Select(self,yes,dc):
        if yes:
            self.isSelected=True
            col=self.GetPen().GetColour()
            pen=wxPen(col,5)
            self.SetPen(pen)
        else:
            self.isSelected=False
            col=self.GetPen().GetColour()
            pen=wxPen(col,1)
            self.SetPen(pen)

    def Selected(self):
        return self.isSelected

The select stuff is only necessary because I use OGL as a view-controller
and don't need/want handles.

Torsten

ยทยทยท

On Fri, 8 Aug 2003, Tom Baker wrote:

Hi everybody,

has anybody implemented the MVC-Pattern in wxpython or knows where I can
get the code ?

regards
tom

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org