[PyKDE] The thingie that makes your user interfaces....
Torsten Marek
shlomme at gmx.net
Tue Apr 5 18:32:58 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Truls A. Tangstad schrieb:
> On Tue, Apr 05, 2005 at 06:41:09PM +0200, Torsten Marek wrote:
>
>>Hello again,
>>
>>I created a new release (0.2.1, same place as yesterday) showing two techniques
>>of putting implementations and UI files together.
>>
>>The first one uses some deeper Python magic to create types on the fly and what
>>not. A lot of implicit stuff and some restraints (?) like not having to call the
>>base class constructor. Furthermore, you inherit from PyQtUI but this is not
>>your base class at all.
>>
>>The second one is more typing on the user side and you need to make sure that
>>you inherit the correct base class and call your base class constructor, but
>>it's more obvious what happens.
>>
>>Preferences, anybody?
>>Although I like the dark stuff happing in (1), I'd go for (2).
>
>
> I prefer knowing what's going on. Is it also possible to use something
> like the following syntax?
>
> # the function name isn't really important here, I'm using parseClass
> # since I wasn't sure of the implications of your existing parse
> # methods
> BaseClass = pyqtui.parseClass("myui")
>
> class SubClass(BaseClass):
> def closeEvent(self, event):
> ....
>
> ....
>
> There would always be a base class which isn't used for anything
> except subclassing. Like your second alternative it's more obvious
> what happens, but without having to subclass an existing Qt class
> (like you do with qt.QDialog).
This is also possible, but there's a problem with what parseClass should do:
The easy way out is using something like (1), then parseClass returns this exact
proxy object with overridden __new__.
In the other case, parseClass would return a new type, but then it has to create
code (objects) which is executed afterwards (when SubClass is created) -- which
is more or less what the ui compiler does.
Or is there another way I don't see?
greetings
Torsten
- --
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCUsvJfMVFHqJEyFgRAhImAJ9lX9S/2Xr2rEFC3Sdzm/9Qy/vClwCfQuBo
YorXhiUSPO8vPIeguY6gqnc=
=8YXh
-----END PGP SIGNATURE-----
More information about the PyQt
mailing list