PyQt4 missing module


Eric Jardim

Member
Joined
Feb 1, 2011
Messages
63
Age
44
Location
Rio de Janeiro - Brazil
Hi,


Just a few days ago, I realized that my Pandora came with Python and Qt4.


Long ago (2006) I've designed a tiny kit to rapidly create UI-based applications with no redundancy and clear code, based upon PyQt4. I was curious to port some of my applications to the Pandora just to see if I can use my kit to develop pandora apps.


So I did:


opkg install python-pyqt python-sip


But the uic module is still missing. My kit depends on dynamic ui loading (the loadUi function inside uic module) and ui compiling is not an option.


I read this post and saw that the guy somehow solved the uic problem, but I can't see how?!?!!





Can anyone help? Thanks
 
Hi,


Just a few days ago, I realized that my Pandora came with Python and Qt4.


Long ago (2006) I've designed a tiny kit to rapidly create UI-based applications with no redundancy and clear code, based upon PyQt4. I was curious to port some of my applications to the Pandora just to see if I can use my kit to develop pandora apps.


So I did:


opkg install python-pyqt python-sip


But the uic module is still missing. My kit depends on dynamic ui loading (the loadUi function inside uic module) and ui compiling is not an option.


I read this post and saw that the guy somehow solved the uic problem, but I can't see how?!?!!





Can anyone help? Thanks
Hi you can just put the ui module in the folder with your project ,


If you need it ill upload it when I get home tonight, and then just package it up with the rest of your app
 
Hi you can just put the ui module in the folder with your project ,


If you need it ill upload it when I get home tonight, and then just package it up with the rest of your app

Fine. It only worked when I copied it to the /usr/lib/pythonXX/site-packages/PyQt4 folder. If not, I would have edit the .py files to remove the PyQt4 prefix of all modules. I just want to see if it works.


Unfortunately, it is an old PyQt4 version and pyqtSignal is not defined :(


But I think I can still port the applications by not declaring signals or creating a custom pyqtSignal. I will meditate about it.


Thanks,
 
Last edited by a moderator:
Hi you can just put the ui module in the folder with your project ,


If you need it ill upload it when I get home tonight, and then just package it up with the rest of your app

Fine. It only worked when I copied it to the /usr/lib/pythonXX/site-packages/PyQt4 folder. If not, I would have edit the .py files to remove the PyQt4 prefix of all modules. I just want to see if it works.


Unfortunately, it is an old PyQt4 version and pyqtSignal is not defined :(


But I think I can still port the applications by not declaring signals or creating a custom pyqtSignal. I will meditate about it.


Thanks,
you should be able to have the uic folder in /media/SDcard/pythonapp/PyQt4/uic where your python is run from pythonapp.


I will post the methods I used to get around the pyqtsignal problem also.


The only problem I have is that my uic is not found unless I am in the correct directory when I run it.
 
The only problem I have is that my uic is not found unless I am in the correct directory when I run it.
It needs to be on your python path, either install it to your nand, setup the PYTHONPATH environment (see python -h) or modify sys.path at runtime (i.e. before importing the module).
 
Last edited by a moderator:
The only problem I have is that my uic is not found unless I am in the correct directory when I run it.
It needs to be on your python path, either install it to your nand, setup the PYTHONPATH environment (see python -h) or modify sys.path at runtime (i.e. before importing the module).
Oops its not the uic module thats not found but the .ui file.


Im working around it at the moment by just hard coding the path in to it when it calls the ui file.
 
you should be able to have the uic folder in /media/SDcard/pythonapp/PyQt4/uic where your python is run from pythonapp.


I will post the methods I used to get around the pyqtsignal problem also.

Right now, I just want to see if PyQt4 works. So I put it in the site-packages and tried to run some simple apps.


They ran, BUT the dynamic loading didn't work correctly and some widgets (in particular ListWidgets) did'n appear. Are you having this same problem?


PS. Right now I am firewalled and can't access your files.
 
and to avoid using pyqtslot() I do


self.connect(self.ui.volUpButton, SIGNAL('clicked()'),lambda who="Three": self.volUp())


def volUp(self):


newVol = func.getVolume() + 9


That works for me, hope it helps

You should take a look a the kit I developed. The idea is that you don't have to do explicit "connects" to set up event handlers. Suppose you make your widget in QtDesigner and name it MyForm and save it in myform.ui file.


all you have to do is create a myform.py file with:



Code:
from mu import *


class MyForm( Form(QWidget) ):

    def init(self):

        # optional startup without need to call super contructors


    def on_volUpButton_clicked(self):

        newVol = func.getVolume() + 9


# as this is the main file you can launch the application like this

form = MyForm()

form.run()


And voilá! All the dirty is hidden under the carpet. There are another features but the idea is to have simplicity and no redundancy.


The kit is somehow stable and is fine for working with many forms. It is very good to create simple applications with simple coding. Some complex job may become simple with the power of Python, Qt4 and the good use of software design.
 
Last edited by a moderator:
Back
Top