On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Thanks for the reply Nate.
> > Use the class designer or favorite text editor to create your
> > vewierPanel class. Make sure that you put the "create new viewer
> > panel" button in. Save that class.
> >
> > Store a reference to viewerSizer in the class so you can append stuff.
> > Include an event handler like this:
> >
> > def onHit_viewButton(self, evt):
> > newViewPanel = viewPanel(self.Parent, etc.)
> > self.viewerSizer.append1x(newViewPanel)
> >
> > That solves your creation problem. If you want to not display the
> > create panel button anymore just set self.viewButton.Visible to False.
> >
> Yes, that's the way I'm heading- especially now Ed has corrected my
> understanding of how custom classes in the Class Editor do retain
> behavior on insert.
> I'll go you one better - I don't think I even need to keep a reference
> to viewerSizer- I can give it a reg ID :-)
>
>
>
> > Now for the updating part. I assume that when update constraints is
> > displayed you want to update various controls on various panels. The
> > class should have an update method that will query bizobj's and update
> > the data that is called by the onHit_udateButton function.
> >
> Not quite. In fact that's almost the opposite of what I want ;-)
>
> Page 1 of tab viewer has a bunch of constraints (contents of where clauses.)
> Page 2 has 1 or more viwerPanels, lets say 3 called a,b,c.
> When I click on a's 'update' button, I want a (and only a) to update
> the data displayed, based on the current values of the controls on
> Page 1. I don't want b or c to change.
Much easier to do this. In your constructor, pass a reference to the
page 1 control panel. You have your update function use that
reference to grab the values for the constraints. Then update.
Because your panel classes are different objects and have different
bizobjects, updating one won't affect the others.
That's one solution, and even though I don't like the coupling, it'll work.
>
> To be honest, just talking about it, I think it makes a lot more sense
> that Page 1 becomes a dialog, triggered by the update button on the
> viewerPanel(s).
>
> So the thing I'm not sure about is how to adjust the 'where
> clauses'/filters on the bizObject connected to my test_results table,
> and have that only cause an update of one viewerPanel, not all of
> them.
>
> Ed is suggesting keys and _CurrentCursor, that I suspect sounds like
> the right way to go, but I don't yet understand how to create
> keys/what they are/how to use them.
>
> > That's all fine and dandy, but we still need a way of updating the
> > other objects. The most elegant way of doing this in my opinion is to
> > implement the viewPanel class as a borg DP. The shared state would be
> > a list of viewPanels created. Each class upon instantiation will add
> > itself to the list. On updating, a function can cycle through the
> > list and update all of the panels.
> >
> If it doen't mean permanent assimilation, can you explain what you
> mean by a borg DP? ;-)
> Otherwise though, I think that's heading in the wrong direction to
> what I want, but I'm not sure- what do you think?
Disregard this then. Basically, the design pattern is using the code
below to share a variables between all subjects.
class Borg:
__shared_state = {}
def __init__(self):
self.__dict__ = self.__shared_state
Basically you have a situation where if you have 3 borg objects (a, b,
and c), you get something like this:
>>> a['testVariable'] = 42
>>> print b['testVariable'], c['testVariable']
42, 42
All of the behaviors and variables not in __dict__ are separate
instances for each object. This is just an easy way for objects to
keep track of how many others were instantiated.
> Thanks!
>
> Julian
>
> _______________________________________________
> Post Messages to: [email protected]
> Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
>
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users