Re: [PyKDE] PyKDE - almost
Jim Bublitz wrote: package it, so I hope to have it available by Wednesday, and certainly no later than the end of the week. Excellent news! Are you going to consider KDE 3.1.3 (just released last week) for a future -X release? 3.7. There are a bunch of bug reports and patches pending from the list (Pete's SMP patch, a bunch of stuff Gordon Tyler worked on, and some other stuff). I'll be getting to that next (after I think most, if not all, of my patches were to get PyKDE compiling with sip/PyQt 3.6, so there may not be anything of value in them since you've already accomplished that. [1] My servers had been up 459 days 12 hours when I had to shut them down. Ugh. You have my sympathies ;) I'm looking forward to the new version. Now if only I could figure out my PyQt segfault problem, everything would be peachy 8) Ciao, Gordon ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] Sending an argument to a function with a button click
You can accomplish this a bit more simply with a lambda: self.connect(self.button1, SIGNAL("clicked()"), lambda: self.buttonClickedSlot("button1")) self.connect(self.button2, SIGNAL("clicked()"), lambda: self.buttonClickedSlot("button2")) Though now that I think about it, the lambda might need to be squirreled away somewhere so as not to be cleaned up by the reference counter. Same goes for the Curry example though. Fred On Wednesday 06 August 2003 17:46, Christian Bird wrote: > I've found a solution that works for me when I have similar problems. > The issue is that the connect function call needs to take a callable > object and self.printMessage("Testing") returns None (which is not a > callable object). You want the call to evaluate at signal time and not at > connect time. I'm attaching a class that I'll call curry. If your > familiar with functional programming then the idea of currying will be > familiar to you. If not, just think of it as combining a function with > some arguments and returning another function that remembers the original > arguments when called. Here's an example. Suppose you have two buttons > and you want to connect them to a single slot, but you want to know which > button was pressed when the slot is executed: > > #this creates a class that allows currying of functions > class Curry: > #keep a reference to all curried instances· > #or they are immediately garbage collected > instances = [] > def __init__(self, func, *args, **kwargs): > self.func = func > self.pending = args[:] > self.kwargs = kwargs.copy() > self.instances.append(self) > > def __call__(self, *args, **kwargs): > kw = self.kwargs > kw.update(kwargs) > funcArgs = self.pending + args > > #sometimes we want to limit the number of arguments that get > passed, #calling the constructor with the option __max_args__ = n will > limit #the function call args to the first n items > maxArgs = kw.get("__max_args__", -1) > if maxArgs != -1: > funcArgs = funcArgs[:maxArgs] > del kw["__max_args__"] > return self.func(*funcArgs, **kw) > > class foo(QObject): > > def __init__(self...): > setup stuff > self.connect(self.button1, SIGNAL("clicked()"), > Curry(self.buttonClickedSlot, "button1")) > self.connect(self.button2, SIGNAL("clicked()"), > Curry(self.buttonClickedSlot,"button2")) > > def buttonClickedSlot(self, buttonName): > if buttonName == "button1": > do stuff > elif buttonName == "button2": > do other stuff > > > In the above example, the same slot gets called when either button is > clicked, but the text passed to the Curry object is used as an argument > when the slot is called. Some signals actually send their own arguments > to the slot. In those cases, the signal arguments are added to the list > of arguments passed to the Curry object and all of them are sent to the > slot. > > I hope this isn't too confusing. It's helped me a lot in my PyQt > programming. Let me know if it helps or if you need further > clarification. > > Christian Bird > --- > > I've started dabbling with PyQt, but I'm a little confused as to how I > can pass an argument to a function with a button click. For instance, the > following doesn't work: > (snip button code) > > self.connect(self.button1, SIGNAL("clicked()"), > self.printMessage("Testing")) > > def printMessage(text): > print text > > (etc.) > > Any hints? > > :Peter > > ___ > PyKDE mailing list[EMAIL PROTECTED] > http://mats.imk.fraunhofer.de/mailman/listinfo/pykde ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] More documention?
Peter Clark wrote: Between the example programs packaged with PyQt and Boudewijn Rempt's book, I've been able to make pretty decent headway in learning PyQt through trial and error. However, at this point, I'm mostly parroting what I see, with only a vague comprehension as to what's going on. For example, take QMessageBox. What are the arguments that can be passed to it? I tried Generally, the original C++ Qt documentation combined with knowledge of how the C++ translates into Python is sufficient. The PyQt documentation describes where it has had to deviate from the original C++ API because of Python restrictions (reserved keywords generally) or where a more "Pythonic" API has been provided. I must admit that there is some guesswork and experimentation involved sometimes. I can't name anything specific off the top of my head because it's been a while since I last worked with PyQt. You can find the original Qt documentation here: http://doc.trolltech.com/ Ciao, Gordon ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] building sip modules
> after much hacking, I got the error: > > >>> import pkaudio > Traceback (most recent call last): > File "", line 1, in ? > File "pkaudio.py", line 9, in ? > import libpkaudioc > ImportError: ./libpkaudiocmodule.so: undefined symbol: _ZTV15sipProxypkaudio > >>> > > Where the *heck* did that symbol come from? According to c++filt it is the vtable for sipProxypkaudio - did you "link" all the sip*.o files into your library? -- :M: -- Dipl.-Inf. Michael 'Mickey' Lauer [EMAIL PROTECTED] Raum 10b - ++49 69 798 28358 Fachbereich Informatik und Biologie -- ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] Plugins in Python
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, how much work would it be, to make it possible to write Qt Plugins in Python? I think this be especilly useful, because one could create Custom Widgets with Plugins in Python. In case we could fix the Plugin Loader so it also loads Python libs, probably no change to Qt Designer would be required. regards Roland -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iD8DBQE/MNmrV/hlvQgMogsRAu3rAKChyPinzYLtAhDCAD+jUPGmtrfphwCg31Yv sCOW2Qpa/ee3naYVxNMNBn8= =N0od -END PGP SIGNATURE- ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] More documention?
On Tuesday 05 August 2003 04:18 pm, Gordon Tyler wrote: > You can find the original Qt documentation here: http://doc.trolltech.com/ Great, just what I needed, thanks! :Peter -- Oh what a tangled web they weave who try a new word to conceive! ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde