[Sugar-devel] Is there a way to purposefully do synchronous GUI updates?

Ajay Garg ajay at activitycentral.com
Tue Aug 21 04:49:16 EDT 2012


On Tue, Aug 21, 2012 at 1:17 PM, Ajay Garg <ajay at activitycentral.com> wrote:

>
>
> On Tue, Aug 21, 2012 at 1:00 PM, Benjamin Berg <benzea at sugarlabs.org>wrote:
>
>> On Tue, 2012-08-21 at 12:43 +0530, Ajay Garg wrote:
>> > Does calling "process_updates" causes the GUI updates to take place,
>> > before the user returns from the function?
>>
>> Yes, the updates are done immediately and the drawing commands are
>> pushed out to the X server. And I do expect that this is *exactly* what
>> you requested.
>> You don't know exactly when the GUI update will be visible on the
>> screen. But that is normal and has nothing to do with process_updates.
>>
>> An example where this mechanism was used in GTK+ is scrollbars. When you
>> are dragging them, they should be redrawn right away so that they move
>> correctly.
>>
>> Benjamin
>>
>
>
> Awesome !!!!
> I'll give this a try right away, and get back to you with the results !!
>

Damn. Doesn't work :-(




>
> Thanks a ton !!!
>
>
> Thanks and Regards,
> Ajay
>
>
>>
>> > That is, will the following scenario necessarily happen ::
>> >
>> >                        logic statement 1
>> >                        update GUI
>> >                        process_updates  ===> causes the GUI update
>> >                        logic statement 2  ===> necessarily after GUI
>> > update
>> >
>> >
>> >
>> > I doubt that the above is a guarantee, as you have already mentioned
>> > that the actual GUI processing will take place  whenever X server sees
>> > it fit.
>> > Anyhow, just wish to confirm :)
>> >
>> >
>> > Thanks and Regards,
>> > Ajay
>> >
>> >         Please
>> >         note that you don't have much control here, you don't know how
>> >         fast the
>> >         update will happen, or even if it is ever visible to the user.
>> >         The X
>> >         server will process the drawing commands when it sees fit.
>> >
>> >         > My intention is to somehow have GUI updates in a synchronous
>> >         manner,
>> >         > and not rely upon "gobject.idle_add", which would have to
>> >         have
>> >         > dividing a long workflow into many sub-parts, and chaining
>> >         these
>> >         > sub-parts through "gobject.idle_add".
>> >         > This is EXTREMELY painful, especially when one needs to do
>> >         it on an
>> >         > already existing codebase.
>> >
>> >
>> >         As an alternative you could do something like:
>> >
>> >         def idle_add_function(pos):
>> >             if pos[0] == 1:
>> >                 # logic 1
>> >             elif pos[0] == 2:
>> >                 # logic 2
>> >             else:
>> >                 return False
>> >
>> >             queue_update()
>> >
>> >             pos[0] += 1
>> >             return True
>> >
>> >         Where pos = [0] to begin with (the usage of the list is just
>> >         so that it
>> >         is global in a way, any object will do, it just needs to be
>> >         something
>> >         permuteable).
>> >
>> >         Benjamin
>> >
>> >
>> > _______________________________________________
>> > Sugar-devel mailing list
>> > Sugar-devel at lists.sugarlabs.org
>> > http://lists.sugarlabs.org/listinfo/sugar-devel
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120821/a70e5f6d/attachment.html>


More information about the Sugar-devel mailing list