> On Wed, Nov 03, 2004 at 11:37:47PM +0100, Sundance wrote: >> I heard Truls A. Tangstad said: >> >> > Maybe a possible solution might be to create a QWidgetFactory >> > replacement that runtime uses pyuic and execs the result... if >> > nothing else this allows custom components specified in the Designer >> > to be created correctly since pyuic uses code from the Comments field >> > which QWidgetFactory ignores. >> >> You know, what would REALLY kick butt would be a way to import .ui files >> directly. >> >> Like: >> from MyWidgetUIFile import MyWidget >> >> That's how the Python bindings for the ORBit CORBA implementation works. >> You can import IDL files directly. This really, /really/ makes a >> difference in development cleanliness and flexibility. >> >> Anyone has any idea how to do that? > > I'd find having that kind of syntax being too much magic, and I'd > actually like an indication that the module we import/create isn't > available as a python-file, but a .ui-file. > > I'd be quite happy with syntax such as this: > > > 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') > > > > 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. Phil _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde