PYQT4 Core?


I did a opkg install some python modules (yup not ideal)


now I get the error above but with module named uic


edit error is wrong


ImportError:cannot import name uic
 
Last edited by a moderator:
Gotcha thank,


It now runs with the ui showing but compains about my slot


its currently like the below and runs on my pc, guess im gonna have to keep googling after work


@pyqtSlot


def click():


blah blah
 
I really really cant shift this error


NameError: name 'pyqtSlot' is not defined


I have QtCore imported


as below



Code:
from PyQt4 import uic

from Another import remote

from PyQt4 import QtGui

from PyQt4.QtCore import *

import urllib2

its erroring on the below



Code:
    @pyqtSlot()

    def upButton(self):

        rem.send('input.up', '')
 
I really really cant shift this error


NameError: name 'pyqtSlot' is not defined


its erroring on the below



Code:
    @pyqtSlot()

    def upButton(self):

        rem.send('input.up', '')


Well, what's @pyqtSlot? It's bugging out because it has no idea what you're trying to do with the decorator. GIMF: pyqtSlot is available as of QT 4.5. Chances are you don't have that version. Just to explain what's going on behind the scenes, your code above is pretty equivalent to:





Code:
def upButton(self)

    rem.send("input.up", "")


PyQt4.QtCore.pyqtSlot(upButton)


I might've simplified away a few too many details, but that's the concept behind decorators. The decorator (a function) just gets called on the method it's wrapping.
 
Last edited by a moderator:
Just to explain what's going on behind the scenes, your code above is pretty equivalent to:



Code:
def upButton(self)

    rem.send("input.up", "")


PyQt4.QtCore.pyqtSlot(upButton)



I might've simplified away a few too many details, but that's the concept behind decorators. The decorator (a function) just gets called on the method it's wrapping.
Actually it is closer to



Code:
def upButton(self):

    rem.send("input.up", "")


upButton = PyQt4.QtCore.pyqtSlot(upButton)

A decorator is a higher order function which takes one function as an argument and returns one function (not necessarily the same one) as a result. The decoration is performed before assignment into the module namespace.





Code:
def upButton(self): rem.send("input.up", "")

# is roughly equivalent to:

upButton = lambda self: rem.send("input.up", "")

Hence



Code:
@pyqtSlot

def upButton(self): rem.send("input.up", "")

# can be read as:

upButton = pyqtSlot(lambda self: rem.send("input.up", ""))

Except that that the lambda has its func_name attribute set to '<lambda>' instead of "upButton". So, perhaps this is a more accurate (though less clear) model for its semantics:



Code:
upButton = pyqtSlot(

    (lambda function: (setattr(function, "func_name", "upButton"), function)[-1])(

         lambda self: rem.send("input.up", "")))
 
Last edited by a moderator:
Yeah, skipping "upButton = ..." was what I meant by oversimplification. As long as you understand that a decorator wraps your function (think Advice in the Emacs paradigm) you got it.
 
So you pulleg Angstrom bits and still worked? Against our native QT? Awesome and lucky :)


I'm hoping someone or me will do a ni e Qt 4.7.x build with pyqt or pyside bindings.. Shouldn't be too bad a build (and sebt3 among others have done a nice fresh Qt build of course.)


Jeffphonesick
 
Cheers for all the advice Ill try it when I get home, hopefully ill have a semi useful app soon.


yes skeezix I was pulling lots from angstrom repo and all seems to work fine, (yey for booting from SD card)
 
Cheers guys a combination of a few of your ideas and I got it working, I will no doubt have more questions but about the coding + functionality of my little application once its at a bit more of a mature stage but thanks for the help
 
Back
Top