[PEAK] Towards a GUI facility for PEAK
Niki Spahiev
niki at vintech.bg
Wed Dec 8 05:31:42 EST 2004
Phillip J. Eby wrote:
> At 12:48 AM 12/5/04 -0500, Phillip J. Eby wrote:
>
>> Well, enough speculation for tonight.
>
>
> Okay, maybe just a little more...
> [...]
This is very interesting. It looks like documentation to UI system (not
GUI because of ANSI terminal backend) that is basis for all products of
our company (Vintech Ltd.) for past 10 years. We have started with
character based (ANSI) backend and now have MFC, wxPython and ctypes
too. ANSI and MFC backends have C++ and Python versions. Its possible to
mix C++ and Python for model and backend.
class TransferContext:
"""Abstract view interface"""
def Attach( self, cre, dd=None ):
"""
add field (if not dd)
cre = ( type, name, x,y,w,h_max, text_label, style[, help] )
type ::= 'label' | 'edit' | 'button' | 'checkbox' | ...
"""
pass
def AttachFrame( self, cre, dd ):
"""
create new view
cre = ( type, name, x,y,w,h_max, text_label, style[, help] )
type ::= 'modal' | CommonDialog.XXX
"""
pass
def Set( self, id, item ):
"""set data to be displayed in field"""
pass
def Get( self, id ):
"""get data from field"""
return None
def SetFlag( self, id, mask, on=1 ):
"""change bit properties of control"""
pass
def GetFlag( self, id ):
"""read bit properties of control"""
return 0
def GlobalEvent( self, evt ):
"""post app-global event"""
pass
def __setitem__( self, i, v ):
self.Set(i,v)
def __getitem__( self, i ):
return self.Get(i)
current incarnation of abstract view (TransferContext) can produce UI
screens based on universal resource format (TransferContext.Attach), we
found that this works great for prototyping, but for users toolkit
specific design is required. Get/Set flag is compatible with C++
version, for python next version we plan something like configure()
found in Tk and WCK. (IMHO WCK is great example, i started wxPython port
if it and WCK looks very universal approach).
class ModelD:
"""document with user data"""
def CreateFields( self, view ):
"""create using view.Attach"""
pass
def InitAll( self, view ):
"""populate all fields"""
pass
def Action( self, view, id, *arg ):
"""respond to buttons etc."""
pass
def Enter( self, view, ii ):
"""<user entered a field> notification"""
pass
def Leave( self, view, ii ):
"""<user leaved a field> notification"""
pass
This interface is meant to be compatible with CGI, with but of
javascript there can be Enter and Leave notifications too. All view
parameters support TransferContext interface.
We have dummy TransferContext implementation for unit testing. Menus and
interface Action are not well integrated, but follow your guidelines.
So your speculations look like mind reading to me :^)
regards,
Niki Spahiev
More information about the PEAK
mailing list