A control framework for wxPython, thoughts...

As I'm finishing this particular iteration of wxoo, I'm coming to realise that I need a better system for registering/resolving interfaces and adapters for controls, views and data structures. Something along the lines of an Active-X system, but hopefully usable :wink: .

I've been seriously considering ripping the interface and registry code out of zope3 and using that. It appears to do much of what I want (including registering interfaces for non-extensible types) with regard to interfaces and allowing externally-applied adapters. It is, however, still alpha code, and I'd prefer to go with something a little more stable.

Anyone have a better suggestion for something that would provide some significant sub-set of these features:

聽聽聽聽* Declare and test conformance to interfaces
聽聽聽聽聽聽聽聽聽聽o Both property and method members
聽聽聽聽聽聽聽聽聽聽o Allow distinct class and instance declarations
聽聽聽聽* Query for an object's implementation of an interface
聽聽聽聽聽聽聽聽聽聽o Allow for Adapter objects to be returned to implement the
聽聽聽聽聽聽聽聽聽聽聽聽interface
聽聽聽聽聽聽聽聽聽聽o Allow built-in and non-extendable objects being registered
聽聽聽聽聽聽聽聽聽聽聽聽as implementing an interface, potentially with an adapter
聽聽聽聽聽聽聽聽聽聽聽聽class which would implement the interface
聽聽聽聽聽聽聽聽聽聽o Allow for both class and instance interfaces

My current code does this stuff in an ad-hoc manner (there's no explicitly defined interfaces, just code in various places that falls back from one possible interface-source to another when it's trying to get an interface for an object), but I'm looking for something that will formalise, clean up, and solidify the interface-definition/resolution process before I get into defining higher-level abstractions. (e.g. sets, ordered sets, sub-sets, trees, collections, and collection-indices).

More concrete ideas of interfaces I'm looking at:

class ITypeCoercian:
聽聽聽聽def coerce( cls, value ):
聽聽聽聽聽聽聽聽"""Coerce value to an instance of class"""
class ITypeCheck:
聽聽聽聽def check( cls, value ):
聽聽聽聽聽聽聽聽"""Do a strict check to see if the value is a valid instance of cls"""
class IAllValuesSet:
聽聽聽聽def getAllValues( self ):
聽聽聽聽聽聽聽聽"""Retrieve a set object with all suitable values for the type"""
class ICommonValuesSet:
聽聽聽聽def getCommonValues( self ):
聽聽聽聽聽聽聽聽"""Retrieve a set of common values for the type"""
class IWatchable:
class ICallable:
class IPersistable:
class IProvideXContext:
class ISequence:
class IMapping:
class ICollection:
class ICollectionIndex:
...
class IValueEditControl:
聽聽聽聽def GetValue( self ):
聽聽聽聽聽聽聽聽"""Return the current value of the control"""
聽聽聽聽def SetValue( self, value ):
聽聽聽聽聽聽聽聽"""Set the current value of the control"""
聽聽聽聽generatedEvents = [ ValueChangedEvent ]
class IEditType:
聽聽聽聽"""Interface declaring type which may be edited by a control"""
聽聽聽聽dataTypes = [unicode,str]
class IPreferedSize:
聽聽聽聽"""Interface declaring prefered size of a control

聽聽聽聽i.e. to be used during control resolution to provide
聽聽聽聽the best-sized control for a particular location.
聽聽聽聽"""
...
class IViewContext:
class IViewSelectionSet:
class IViewFocus:
class IViewActionSet:
...

Anyway, suggestions or thoughts appreciated,
Mike

路路路

_______________________________________
聽聽Mike C. Fletcher
聽聽Designer, VR Plumber, Coder
聽聽http://members.rogers.com/mcfletch/

Mike C. Fletcher wrote:

As I'm finishing this particular iteration of wxoo, I'm coming to realise that I need a better system for registering/resolving interfaces and adapters for controls, views and data structures. Something along the lines of an Active-X system, but hopefully usable :wink: .

I've been seriously considering ripping the interface and registry code out of zope3 and using that. It appears to do much of what I want (including registering interfaces for non-extensible types) with regard to interfaces and allowing externally-applied adapters. It is, however, still alpha code, and I'd prefer to go with something a little more stable.

Anyone have a better suggestion for something that would provide some significant sub-set of these features:

   * Declare and test conformance to interfaces
         o Both property and method members
         o Allow distinct class and instance declarations
   * Query for an object's implementation of an interface
         o Allow for Adapter objects to be returned to implement the
           interface
         o Allow built-in and non-extendable objects being registered
           as implementing an interface, potentially with an adapter
           class which would implement the interface
         o Allow for both class and instance interfaces

More concrete ideas of interfaces I'm looking at:

class ITypeCoercian:
   def coerce( cls, value ):
       """Coerce value to an instance of class"""
...
class IViewContext:
class IViewSelectionSet:
class IViewFocus:
class IViewActionSet:
...

Anyway, suggestions or thoughts appreciated,

PEAK does this. Default for DB stuff byt why not to extend it to GUI.

Niki Spahiev

Argh. Wish I'd seen this stuff a lot earlier. Same basic problem domain at the Python/app level, similar approach (both use ZODB's persistence, both use Zope's interface mechanisms AFAICS). Sigh.

Thanks for the pointer,
Mike

Niki Spahiev wrote:
...

PEAK does this. Default for DB stuff byt why not to extend it to GUI.

Niki Spahiev

...

路路路

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/