[Sugar-devel] Help Needed: Observer design Pattern

Sam Parkinson sam.parkinson3 at gmail.com
Thu Jun 9 18:23:27 EDT 2016



On Fri, Jun 10, 2016 at 5:18 AM, Yash Agarwal <agrwal.ysh94 at gmail.com> 
wrote:
> Hi,
> I'm having trouble implementing  an observer pattern based Gtk layout.

You can use GObject Signals:  `pydoc gi.repository.GObject.Signal`

> 
> This is my current method to dynamically change the layout:
> for implementing this, a grid with pagination, I'm destroying all the 
> elements of the grid when either of the buttons is pressed and then 
> add the new elements to the grid based on a counter.

Do you have the memory to create all the objects, even the invisible 
ones?

Alternatively, I'm not sure why you need the observer pattern.  Can you 
just go:

    for object in grid:
        object.change_to_new_thing(new_data[i])

> 
> I don't think this is the most efficient method to do this, hence I 
> need help in implementing observer pattern in this.
> 
> with Regards,
> Yash Agarwal
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20160610/2dfc98be/attachment.html>


More information about the Sugar-devel mailing list