Design Question. Data Acquisition/Display related.

Alex Verstraeten alex at quad.com.ar
Tue May 17 10:15:05 EDT 2005


StepH wrote:

>1./ Is each "display" must responsible to acquire/read the data ?
>2./ Or an engine collect the data then send them to each "display" ?
>
>  
>
I'd keep it simple:

- DataCollector class
asociated with one or more display instances (implemented as a list of 
display subscribers)
it collects data from a source and notifies each subscribed display that 
new data is available.
could something like a 'collect' method which performs:

for display in self.subscribed_displays:
   display.update( data )


- Display class
just a simple display class with an "update" method
it should be able to receive new data
and display new data
(those 2 actions could be implemented in different methods, you might 
not want to display everytime new data is available... maybe you might 
want to consolidate data in some way and output it at some high interval)

>Also, how to "anim" this ?
>
>1./ Via a timer ?
>2./ Via a simple loop (read/update display/pause/read user key)
>  
>

a simple loop could do it
  - handle user events
  - collect data
  - update displays
  - sleep





More information about the Python-list mailing list