From: Chris C. <cle...@oc...> - 2003-12-17 15:33:59
|
Okay, forgive the python ignorance... On Wed, 17 Dec 2003, Roger Binns wrote: > > You can see changes on individual files with the viewcvs. The code for > > the Sanyo 4900/8100 is in the files com_sanyo4900.py, com_sanyo.py, and > > p_sanyo.p. > > BTW it is really easy to make a seperate module for the 8100 and share > all code, with any exceptions you want to make. I did it for the > VX6000 and VX4400. Here is how: > > com_sanyo4900: > ====== > class Phone(...): > > protocolclass=p_sanyo4900 > desc="Sanyo 4900" > > def calendar(self): > # whereever you need protocol objects, instantiate them like this > req=self.protocolclass.calendarentry() > ====== > > p_sanyo8100: > ====== > %{ > # This brings all objects from sanyo4900 into this namespace > from p_sanyo4900 import * > %} > > # you can put any overrides here, eg if the calendarentry is > # a different size > > PACKET calendarentry: > 99 STRING description > ====== At this point, there's only one protocol file for sanyo; are you suggesting that it should be broken up, or just offering this as a suggestion? > com_sanyo8100: > ====== > class Phone(com_sanyo4900.Phone): > > protocolclass=p_sanyo8100 > desc="Sanyo 8100" > def __init__(self): > com_sanyo4900.Phone.__init__(self) > ======= There's another class declared at the end of this file: class Profile. Does that need to be inherited, too? Or, does it need to be broken out into a separate class, or perhaps phonebook.py needs to be massaged to allow individual phones to decorate a phone book entry? -- Chris Cleeland, cleeland_c @ ociweb.com, http://www.milodesigns.com/~chris Principal Software Engineer, Object Computing, Inc., +1 314 579 0066 Support Me Supporting Cancer Survivors in Ride for the Roses 2002 >>>>>>>>> Donate at http://www.milodesigns.com/donate <<<<<<<<< |