[PEAK] Towards a GUI facility for PEAK

Niki Spahiev niki at vintech.bg
Thu Dec 23 04:28:16 EST 2004


Phillip J. Eby wrote:
> At 05:56 PM 12/22/04 +0200, Niki Spahiev wrote:
> 
>> I hope that my code is better than my words :)
>>
>> This is minimal ctypes based demo. test_calc.py is UI with selftest. 
>> Its completely UI independent.
> 
> 
> Nice.  There actually is some minor coupling from my POV, in that Action 
> and InitAll receive 'view' and perform actions on it.  In the ideal 
> situation, InitAll would be replaced by e.g an events.Value subscribed 
> to by the GUI.

As i said this design is 10 years old. Now its time to refactor it using
PEAK.

I experimented with view as Observer and showing same model in many
windows is something that we use in our latest releases. This way
InitAll stays but is called from view only, no internal calls to
InitAll are allowed. Maybe an events.Value should hold the object (m) and
all views should call m.InitAll(self)?

>  And I'd tie the buttons to methods rather than using the 
> 100+digit ID values, since if I understand correctly, those IDs have to 
> be chosen to suit the GUI layer.

In test_calc.py number IDs for buttons 0-9 are because i am lazy. They
are not necessary and can all be replaced by event names as is done for
'add' and 'sub'. IMO routing from events to actions is task that not
always involves method call as first step e.g. Taskmaster pattern sends
all events to state machine which then generates some method calls.

> 
> Indeed, I'd do away with 'Action' and 'InitAll' altogether, because 
> they're both artifacts of the GUI.  But apart from that, yes, this is 
> very similar to the concept I proposed here.

Main use of Action( view, .. ) is to call view.AttachFrame(..) to open 
new windows. Not sure about InitAll, its responsible for reconfiguring 
UI too.

Here is better example (still not using subscription). What is the 
English name of concept represented by CalcXXX?

Niki Spahiev
P.S. I would like this design to be compatible with Web.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_calc2.zip
Type: application/zip
Size: 3079 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20041223/2f2d89f4/test_calc2.zip


More information about the PEAK mailing list