Author Topic: qcop not reaching Python apps  (Read 6377 times)

zenyatta

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • http://
qcop not reaching Python apps
« on: July 14, 2004, 03:08:03 am »
Hi all,

I have a little problem with Python apps. Say I have a trivial PyQt application in /root/test.py:
Code: [Select]
#!/usr/bin/python
import sys
from qt import *
from qtpe import *
class MyWin(QVBox):
    def __init__(self, parent):
        QVBox.__init__(self, parent)
        self.setCaption('Test')
        label = QLabel(self)
        label.setText('Hello, world!')
app=QPEApplication(sys.argv)
win=MyWin(None)
app.setMainWidget(win)
win.show()
app.exec_loop()
I type chmod +x test.py and then ./test.py . The app runs OK but when I open another konsole session and type qcop QPE/Application/test.py 'quit()' it doesn't come through.

How do I know that QPE/Application/test.py is the right channel? When the app starts the file /tmp/qcop-msg-test.py is created. I also tried other channels like QPE/Application/python but the results are the same. The funniest thing, though, is that when I say qcop QPE/System 'quit()' the app does quit - and it is the only one to do so! Konsole continues to run, as well as the rest of Opie.

This is a major problem because the taskbar uses qcop to raise() an application when you tap its taskbar icon. So when I set up my app to be launched through an icon, it misbehaves: once it's "minimized" e.g. by pressing the Home button, there is no way to bring it back up - it has to be shut down with SIGTERM.

What I think is happening is that either the app fails to actually create a QCop channel or it creates a different one than Qtopia/Opie expects. Can anyone tell me how to find out the name of the channel a QPEApplication creates? Thanks in advance.

z.
« Last Edit: July 14, 2004, 03:12:25 am by zenyatta »
SL-5500, 256MB Kingston CF card, 128MB EDGE SD card, Thomson HED-155 headphones
OpenZaurus 3.5.3 / Opie (kernel 64-0)

Mickeyl

  • Hero Member
  • *****
  • Posts: 1495
    • View Profile
    • http://www.Vanille.de
qcop not reaching Python apps
« Reply #1 on: July 14, 2004, 02:29:58 pm »
Try QPEApplication(sys.argv[1:]) - same which is needed to get an icon to appear in the TaskBar. I put a lengthy explanation for why this is needed in one of the forums, probably the old Sharp one, can't remember.
« Last Edit: July 14, 2004, 02:30:59 pm by Mickeyl »
Cheers,

Michael 'Mickey' Lauer | Embedded Linux Freelancer | www.Vanille-Media.de
Consider donating, if you like the software I contribute to.

zenyatta

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • http://
qcop not reaching Python apps
« Reply #2 on: July 15, 2004, 03:31:31 am »
Solved. The first argument to QPEApplication() must be the same string as the Exec value in the corresponding .desktop file. I did not actually need sys.argv[1:] to do that (my launch mechanism is a bit different).

Also, neither value should contain the full path, just the file name of the launch script (which means the launch script needs to be on the PATH).

Thanks for the pointer.

z.
« Last Edit: July 15, 2004, 03:32:20 am by zenyatta »
SL-5500, 256MB Kingston CF card, 128MB EDGE SD card, Thomson HED-155 headphones
OpenZaurus 3.5.3 / Opie (kernel 64-0)

sdjf

  • Sr. Member
  • ****
  • Posts: 447
    • View Profile
    • http://www.sdjf.wordpress.com and http://www.sdjf.esmartdesign.com
qcop not reaching Python apps
« Reply #3 on: August 29, 2008, 12:52:00 am »
About qcop channels, the qcoptest tool may help you figure it out, although it's a matter of trial and error, but it will show you when a message gets thru I believe.  Here's what I know about qcoptest:

http://sdjf.esmartdesign.com/ipks/qcoptest.html

sdjf
http://www.sdjf.esmartdesign.com
http://www.sdjf.wordpress.com
-----------------
sl5500 running Sharp ROM 2.38 (dead batteries)
sl6000L running Sharp ROM 1.12 (still working)
Opera 7.25 and 7.30
Socket CF 56k modem
3Com USB Ethernet Adapter
Toshiba, Lexar and Kingston SD cards
Lexar, Kingston and Transcend CF cards