Sharing a notebook and a statusbar in two gtk windows

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Sharing a notebook and a statusbar in two gtk windows

philopensource@hotmail.com
Hi list,

I want to share a notebook and a statusbar in two gtk windows as this
components are same for the two windows.
The notebook will display lots of canvas, and i want to optimize the
memory use as there canvas won't be modify. That's why i decided to
create a shared notebook and a share statusbar.

I saw several times this error without succeeding in finding the cause.
I found it is not possible for a widget to be part of two windows due to
the test child->parent == NULL.

Can't we put a widget as a children for two parents?
If no, how can i have same notebook and statusbar in both windows
without eating two much mermory and without having problem to
synchronize them.

Note: i need both windows because one is simplier and for quick access
and the other is for more heavy use.

The error i get is:
H:\Philippe\Pyvisu\Code
Source\eclipse\workspace\pyvisu\ihm\window.py:110: GtkWarning:
gtk_box_pack_start: assertion `child->parent == NULL' failed
  vbox.pack_start(statusbar, True, True, 0)

_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

Re: Sharing a notebook and a statusbar in two gtk windows

John Gill
I don't think you can have a widget have two parents simultaneously.

If you don't need both versions of the widgets visible simultaneously then what you can do is reparent widgets from one frame to another.

In this way, you could allow the user to toggle between the views and just reparent the widgets you want in both views.

The specific case of re-parenting between notebook pages is a bit tricky -- you can't reparent direct to a notebook page, only to an existing frame, so you need to create a new frame, reparent to that and then attach the frame to the relevant notebook page.

John

[hidden email] wrote:
[pygtk] Sharing a notebook and a statusbar in two gtk windows

Hi list,

I want to share a notebook and a statusbar in two gtk windows as this
components are same for the two windows.
The notebook will display lots of canvas, and i want to optimize the
memory use as there canvas won't be modify. That's why i decided to
create a shared notebook and a share statusbar.

I saw several times this error without succeeding in finding the cause.
I found it is not possible for a widget to be part of two windows due to
the test child->parent == NULL.

Can't we put a widget as a children for two parents?
If no, how can i have same notebook and statusbar in both windows
without eating two much mermory and without having problem to
synchronize them.

Note: i need both windows because one is simplier and for quick access
and the other is for more heavy use.

The error i get is:
H:\Philippe\Pyvisu\Code
Source\eclipse\workspace\pyvisu\ihm\window.py:110: GtkWarning:
gtk_box_pack_start: assertion `child->parent == NULL' failed
  vbox.pack_start(statusbar, True, True, 0)

_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

Re: Sharing a notebook and a statusbar in two gtk windows

Rafael Villar Burke
In reply to this post by philopensource@hotmail.com
[hidden email] wrote:

> Hi list,
>
> I want to share a notebook and a statusbar in two gtk windows as this
> components are same for the two windows.
> The notebook will display lots of canvas, and i want to optimize the
> memory use as there canvas won't be modify. That's why i decided to
> create a shared notebook and a share statusbar.
>
> I saw several times this error without succeeding in finding the cause.
> I found it is not possible for a widget to be part of two windows due
> to the test child->parent == NULL.

That is almost a logical contradiction. You could have the same model
data for two different widgets, but not the same widget on two places.
That would lead to situations like receiving a position event for the
widget, a drag'n drop action, a signal to display a context menu and
then... which instance has received it? wasn't there only one single
instance?.

At the end you need having two instances of the same widget that share
the same single model where they store their data and status information
and that keeps them both in sync. How you achieve this depends on your
needs. You can have something like two treeviews that share the same
treemodel, or one being a real widget and a different window that has a
clone pixmap of the "original" widget, and so on...

Good luck,

--
Pachi


_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

pygtk and httpserver

manatlan
In reply to this post by philopensource@hotmail.com
I try to embed a HTTPServer in a pygtk app ...
i've got trouble to give cycle/loops to the GUI

i run my pygtk app, and add handle_request() from HTTPServer with
gobject.idle_add() ...
the http server seems to eat all the cycle/loop ... but replys well
the GUI seems to be frozen ... the log of the server are displayed in
a textview pygtk very well ... but i can't click a button or a
checkbox ...

i've tryed a thread version too, but it's not better, the gui responds
well, but the httpserver never reply ...

i don't know where to go, any ideas ? is there a simple way to give
cycle/loop to the gui and to the http server ?
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

Re: pygtk and httpserver

Nikos Kouremenos
On 5/27/05, manatlan <[hidden email]> wrote:
> I try to embed a HTTPServer in a pygtk app ...
> i've got trouble to give cycle/loops to the GUI
> i run my pygtk app, and add handle_request() from HTTPServer with
> gobject.idle_add() ...
> the http server seems to eat all the cycle/loop ... but replys well
> the GUI seems to be frozen ... the log of the server are displayed in
> a textview pygtk very well ... but i can't click a button or a
> checkbox ...
I'm not an expert, you can try pending_events [see FAQ in entry about
progressbar and doing sth useful with the UI too]

> i've tryed a thread version too, but it's not better, the gui responds
> well, but the httpserver never reply ...
That's strange. You can use pseudo-threads via generators which could
be simpler to catch logical bugs

> i don't know where to go, any ideas ? is there a simple way to give
> cycle/loop to the gui and to the http server ?
You can use input_add() to pass the socket that listens to the gtk mainloop
see FAQ entry again

Good Luck


--
Nikos Kouremenos | Jabber ID: [hidden email] | http://members.hellug.gr/nkour
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

Re: Sharing a notebook and a statusbar in two gtk windows

Christian Robottom Reis
In reply to this post by John Gill
On Fri, May 27, 2005 at 02:04:51PM +0100, John Gill wrote:
>    I don't think you can have a widget have two parents simultaneously.

Right. More likely, Phillipe wants to create multiple widgets and have
them share the same data or model in the background. This is standard
MVC.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3376 0125
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/