[PyKDE] bad resolution on designer imported PNGs: solution
Hans-Peter Jansen
hpj at urpla.net
Thu Aug 1 14:16:01 BST 2002
On Wednesday 24 July 2002 14:41, Hans-Peter Jansen wrote:
> On Wednesday 24 July 2002 11:40, Willi Richert wrote:
> > Hi,
> >
> > I have some nice PNG images which I want to use for the toolbar. But,
> > when ddesigner/pyuic generates the icons data they don't look as good any
> > more. I have to use the PNG file name instead so that they look good
> > (QPixmap("forward.png")).
> >
> > You can see the difference in the attached picture (1,2K only). The left
> > is the pyuic generated data, the right is the png given QPixmap as a file
> > path.
> >
> > Any hints?
>
> I came across this a few days before. It's releated to xpm conversion
> of semi transparent shadows in the PNG. I got the feeling, this isn't
> supported in xpm format. Please somebody correct me, if I'm wrong.
>
> I'm thinking about a tool to inline the images in a module, and load
> them via StringIO.
Done now. You can find a first shot on this attached.
img2pyqt.py:
Inlines a list of images, and embed them in a Python
module with appropriate code so it can be loaded into
a PyQt program at runtime. The benefit is that since
it is Python source code it can be delivered as a .pyc
or 'compiled' into the program using freeze, py2exe, etc.
Each filename is stripped from ext and non alphanumeric characters,
and 3 functions are created: fileData(), fileIcon() and fileIconSet().
If file extension is not one of (png, xpm, bmp), the last two are
ommited.
It leaves me to the question, how pixmaps are handled internally:
if the same pixmap is used multiple times, do they share memory,
or does each instance occupy additional ram? Phil?
What would the nicest way to integrate this with Qt designer?
Anybody wrapped her/his mind around QMimeSourceFactory here?
> > willi
Enjoy,
Hans-Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: img2pyqt.py
Type: text/x-python
Size: 5344 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020801/d49fe4e0/img2pyqt.py
More information about the PyQt
mailing list