Quantcast

Sending signals beween plug and socket

Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sending signals beween plug and socket

andy pugh
I am trying to propagate a signal between a host application that
accepts user-supplied content embedded inside it and the user-supplied
content.

For reference the hosting application embeds the content here:
https://github.com/LinuxCNC/linuxcnc/blob/master/src/emc/usr_intf/touchy/touchy.py#L795

Using the sub-application here:
https://github.com/LinuxCNC/linuxcnc/blob/master/src/hal/user_comps/gladevcp.py#L154

I am trying to signal from "Touchy" to "GladeVCP" that its tab has
been _deselected_ (we seem to get a visibility-notify automatically on
selection, but not on deselection)

I have tried using "emit" but I get the error message:
TypeError: could not convert type NoneType to GParam required for parameter 0
with the code below:

def tabselect(self, notebook, b, tab):
   new_tab = notebook.get_nth_page(tab)
   old_tab = notebook.get_nth_page(self.tab)
   self.tab = tab
   for c in self._dynamic_childs:
      if new_tab.__gtype__.name == 'GtkSocket':
        w = new_tab.get_plug_window()
           if new_tab.get_id() == c:
              print "touchy plug_window xid visible = ", w.xid
              w.emit('notify::visible', gtk.gdk.VISIBILITY_UNOBSCURED)
       if old_tab.__gtype__.name == 'GtkSocket':
         w = old_tab.get_plug_window()
            if old_tab.get_id() == c:
                print "touchy plug_window xid hidden = ", w.xid
                w.emit('notify::visible', gtk.gdk.VISIBILITY_FULLY_OBSCURED)

So it seems that perhaps I need to create a new "GParam", but can't
find any documentation on how to do that.

Another of our developers tried the code below, but also met with no
success: He only appeared to get events in GladeVCP when he resized
the window.

        def tabselect(self, notebook, b, tab):
                new_tab=notebook.get_nth_page(tab)
                old_tab=notebook.get_nth_page(self.tab)
                self.tab = tab
                for c in self._dynamic_childs:
                    if new_tab.__gtype__.name =='GtkSocket':
                        w= new_tab.get_plug_window()
                        if new_tab.get_id()==c:
                                print"touchy plug_window xid visible =", w.xid,w
                                event = gtk.gdk.Event(gtk.gdk.VISIBILITY_NOTIFY)
                                event.window = w
                                event.state = gtk.gdk.VISIBILITY_UNOBSCURED
                                event.send_event = True
                    if old_tab.__gtype__.name =='GtkSocket':
                        w= old_tab.get_plug_window()
                        if old_tab.get_id()==c:
                                print"touchy plug_window xid hidden =", w.xid,w
                                event = gtk.gdk.Event(gtk.gdk.VISIBILITY_NOTIFY)
                                event.window = w
                                event.state = gtk.gdk.VISIBILITY_FULLY_OBSCURED
                                event.send_event = True

#w.emit('visibility-notify-event',gtk.gdk.VISIBILITY_FULLY_OBSCURED)

I have also tried sending UNIX signals between the programs, but
couldn't make that work either.

In summary, the questions are:

How can I create a new "GParam" to use as an argument to w.emit()?
If I do manage to do that, will it have the results I hope for?

Is there a better way, or any way, to have a gtkSocket cause code to
run in a gtkPlug?

--
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1916
_______________________________________________
pygtk mailing list   [hidden email]
http://mailman.daa.com.au/cgi-bin/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
Loading...