[Sugar-devel] How to not make a window?

Tomeu Vizoso tomeu at sugarlabs.org
Tue Aug 11 03:14:29 EDT 2009


On Tue, Aug 11, 2009 at 07:09, Benjamin M.
Schwartz<bmschwar at fas.harvard.edu> wrote:
> I am trying to create a sugar activity that wraps a simple X application.
>  Specifically, my activity is a standard python activity, inheriting from
> the sugar.activity.activity.Activity, but it has no GUI.  set_canvas is
> never called, and nor is self.show_all().  Instead, I use
> subprocess.Popen() to start another process that opens a window.
>
> Unfortunately, it seems that even if I don't call set_canvas or show_all,
> the python code still produces an empty gray window.  This window becomes
> the official window of the Activity, and so the actual window gets the
> dreaded meaningless circle in the top bar.
>
> How can I prevent my activity from opening a window at all, so that the
> subprocess's window becomes the activity's main window?

The simplest way is to not use the Activity class at all.

> Perhaps using
> http://www.pygtk.org/docs/pygtk/class-gdkwindow.html#function-gdk--window-foreign-new
> ?

Yes, if you are fine loading gtk you can get a gdk.Window like that,
then call property_change on it to set the X11 properties that Sugar
expects.

You can also do it with plain Xlib calls:

http://git.sugarlabs.org/projects/hellow-world-qt/repos/mainline/blobs/master/qtactivity.py#line694

Regards,

Tomeu
> --Ben
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>


More information about the Sugar-devel mailing list