[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Using custom components and Qt Designer with
From:       "Truls A. Tangstad" <kerfue+pykde () herocamp ! org>
Date:       2004-11-04 7:59:52
Message-ID: 20041104075952.GA25035 () herocamp ! org
[Download RAW message or body]

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:

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

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

_______________________________________________
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