[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] Qt4 and uic - dynamic generation
From: "Phil Thompson" <phil () riverbankcomputing ! co ! uk>
Date: 2005-07-22 12:16:37
Message-ID: 39781.194.203.13.71.1122034597.squirrel () river-bank ! demon ! co ! uk
[Download RAW message or body]
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jeremy Sanders schrieb:
>> On Thu, 21 Jul 2005, Sebastian Kügler wrote:
>>
>>> Not sure if I'd like to do this ...
>>>
>>> * I actually like the way it is done right now, you can easily
>>> subclass the
>>> generated python code, and I'm not sure how this should be done when
>>> using .ui files directly. Furthermore, it might add overhead to do
>>> this at
>>
>>
>> I wasn't suggesting this would replace the existing subclassing.
>>
>> What I'm suggesting is that you could have some function which returns a
>> class which you could then subclass, e.g.
>>
>> MyDialogBase = qt.LoadUI('foo.ui')
>>
>> class MyDialog(MyDialogBase):
>>
>> def foobar(self):
>> ...
>>
>> Personally I think this is a lot nicer than having generated python code
>> in my source tree. It means that someone could run a python script and
>> it would just work, without having uic and so on installed.
>>
>> If this is what QWidgetFactory does, then that's great!
>>
>
> Hi,
>
> you have to be careful with QWidgetFactory, because it creates an
> instance, not
> a class. One Problem is, that you cannot override event handlers in it,
> but only
> use signals and slots.
class MyDialog:
def __init__(self):
self.d = QWidgetFactory("d.ui")
self.d.event = self.event
def event(self, e):
# Do your thing
pass
Not pretty I know.
Phil
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic