Jump to content


Photo

PyQt4 missing module


  • Please log in to reply
8 replies to this topic

#1 OFFLINE   Eric Jardim

Eric Jardim

    Advanced Member

  • Members
  • PipPipPip
  • 60 posts
  • Local time: 01:35 AM
  • LocationRio de Janeiro - Brazil

Posted 22 June 2011 - 01:44 PM

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?!?!!
http://boards.openpa...020-pyqt4-core/

Can anyone help? Thanks

#2 OFFLINE   meandu229

meandu229

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts
  • Local time: 05:35 AM

Posted 22 June 2011 - 01:51 PM

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?!?!!
http://boards.openpandora.org/index.php?/topic/4020-pyqt4-core/

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

#3 OFFLINE   Eric Jardim

Eric Jardim

    Advanced Member

  • Members
  • PipPipPip
  • 60 posts
  • Local time: 01:35 AM
  • LocationRio de Janeiro - Brazil

Posted 22 June 2011 - 02:30 PM

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,

#4 OFFLINE   meandu229

meandu229

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts
  • Local time: 05:35 AM

Posted 22 June 2011 - 02:37 PM


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.

#5 OFFLINE   Caine

Caine

    Advanced Member

  • Members
  • PipPipPip
  • 1983 posts
  • Local time: 06:35 AM
  • LocationThe Netherlands

Posted 22 June 2011 - 03:01 PM

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).

#6 OFFLINE   meandu229

meandu229

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts
  • Local time: 05:35 AM

Posted 22 June 2011 - 03:06 PM


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.

#7 OFFLINE   meandu229

meandu229

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts
  • Local time: 05:35 AM

Posted 22 June 2011 - 04:25 PM

Incase it helps I put this in with my python files for using uic on pandora.
http://www.mediafire...69vqkqqd114qx1y
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

#8 OFFLINE   Eric Jardim

Eric Jardim

    Advanced Member

  • Members
  • PipPipPip
  • 60 posts
  • Local time: 01:35 AM
  • LocationRio de Janeiro - Brazil

Posted 22 June 2011 - 06:51 PM

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.

#9 OFFLINE   Eric Jardim

Eric Jardim

    Advanced Member

  • Members
  • PipPipPip
  • 60 posts
  • Local time: 01:35 AM
  • LocationRio de Janeiro - Brazil

Posted 22 June 2011 - 07:10 PM

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:

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.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users