[PyKDE] The thingie that makes your user interfaces....

Truls A. Tangstad kerfue+pykde at herocamp.org
Tue Apr 5 17:55:10 BST 2005


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

-- 
Truls A. Tangstad - <kerfue+pykde at h e r o c a m p.org>




More information about the PyQt mailing list