Help - Search - Members - Calendar
Full Version: Pyqt Application Setup
OESF Portables Forum > Everything Else > Archived Forums > Distros, Development, and Model Specific Forums > Zaurus - Everything Development > Python
I've followed the helpful instructions here for using python (kopsis) and pyqt on the zaurus (5500), and have found by searching the forum postings how to use QPEApplication instead of QApplication (after about a month of development without a clue that it existed) and now my app is looking nice. It is for doing bird counts and includes a working GPS interface, using elements of the python code from gpsd and from pygps. One problem remains though: how to properly setup my app so that it can be restored after it looses focus, and how to give it a proper icon. I found postings that get close, it seems, and did the following:

1) put a script in /opt/QtPalmtop/bin called myapp that contains the line

"python /mnt/card/dev/"

2) added the line

sys.argv[0] = "myapp"

just above the line

a = QPEApplication(sys.argv)

The startup script works, but, if my app looses focus when another app is run, clicking the terminal icon only brings up the terminal console where i fired the script.

So, I am asking for general help on the full steps needed to make a python/pyqt program act like a normal application, or at least to solve the focus problem. I don't know if it matters for this, but my rom is the sharp 3.13 version.

BTW, I really enjoy programming with pyqt, after years of Java dev with Swing, but having entered into a limbo on gui development since turning to python in the last couple of years. Nice to discover Qt and pyqt -- good docs and clean api.


Jeff Pittman
You need a desktop file in /opt/Qtopia/apps/Applications

The last part of the path corresponds to the tab which the app will appear on so you may want /opt/Qtopia/apps/Games intead, for example.

Have a look at the ones you alread y have in there. They are text based so just catting them at the console will give you some idea of what you need. The minimum is probably

[Desktop Entry]

You'll need to make executable (chmod +x and add the standard

#!/usr/bin/env python

line at the top.

Add an icon line to the desktop file to use an icon other than the default "?" one.
I had some funny issues with keeping the focus, as well... I tried a few times, then bailed out (got lazy) and ended up doing:

a = QPEApplication([""])

Also, my .desktop has and I have a link to in my path somewhere.

I tried
a = QPEApplication([sys.argv[1:])

among other things, it just never worked right.

- added the .desktop file in /opt/QtPalmtop/apps/Applications (used a script in /opt/Qtopia/bin to call "python /mnt/card/dev/")

- found the home for the icons under the pics dir of /opt/Qtopia and added a 32x32 png

- rebooted

And, Presto, I have my normally behaving app.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.