[PyKDE] Using custom components and Qt Designer with
QWidgetFactory in PyQt
Phil Thompson
phil at riverbankcomputing.co.uk
Thu Nov 4 10:52:46 GMT 2004
> On Thu, Nov 04, 2004 at 09:28:26AM -0000, Phil Thompson wrote:
>> Truls A. Tangstad wrote:
>> > I'd be quite happy with syntax such as this:
>> >
>> > <snippet>
>> > from uiloader import ModuleFactory
>> >
>> > mymodule = ModuleFactory('/path/to/ui/file/here.ui')
>> > MyClass = mymodule.MyClass # if you really need the direct name
>> >
>> > my_object = MyClass("some", "happy", "parameters")
>> >
>> > # or if you really just need the class
>> > mymodule = ModuleFactory('/path/to/ui/file/here.ui').MyClass
>> >
>> > # or if you'd really like a class factory too, for convinience
>> > from uiloader import ClassFactory
>> > MyClass = ClassFactory('/path/to/ui/file/here.ui', 'MyClass')
>> >
>> > </snippet>
>> >
>> > Creating an implementation of ModuleFactory and ClassFactory should be
>> > pretty straightforward as long as they use pyuic, which brings me to
>> > my most important point: I _really_ want pyuic available as a module
>> > in the pyqt-library, and not have to run it as a shell program.
>>
>> Yes, I've been thinking about this for Qt v4. Normally with a new major
>> release of Qt (v1, v2 etc) I re-implement pyuic based on the new uic.
>> This
>> time I'm considering re-implementing it in Python which could then be
>> run
>> from the command line, or imported as a module.
>
> That would solve alot of our problems so I'd say go for it ;)
>
> Would it be viable to implement something like ModuleFactory and
> ClassFactory as part of a future pyuic-module, or should that be in
> the hands of us application developers?
>
> I can easily imagine a module-factory being just another function
> available in a pyuic module, which would be very very cool.
Yes, I'd be happy to add Python specific functionality. It being in a
separate module clearly separates it from the regular Qt API.
Of course, somebody else could take it on as a nice little project...
Phil
More information about the PyQt
mailing list