views:

106

answers:

2

hi, I wrote python application using svg images as icons.

QtGui.QIcon(':icons/icon.svg') <- just like this

it works on my comuter but after compiling it with py2exe and running on another computer, theres no icons. if i try e.g. bmp format, all works fine. so i think it could be some library problem. I don't know what PyQt4 uses for svg graphics.

in setup.py file i wrote

dllList = ('mfc90.dll','msvcp90.dll','qtnetwork.pyd','qtxmlpatterns4.dll', 'qsvg4.dll', 'qsvgd4.dll') origIsSystemDLL = py2exe.build_exe.isSystemDLL def isSystemDLL(pathname): if os.path.basename(pathname).lower() in dllList: return 0 return origIsSystemDLL(pathname) py2exe.build_exe.isSystemDLL = isSystemDLL

setup(windows=[{"script" : "myApp.py"}], options={"py2exe" : {"includes" : ["sip", "PyQt4.QtNetwork", "PyQt4.QtWebKit", "PyQt4.QtSvg" ]}})

and also have imageformats folder (with qvg4.dll etc.) included in myApp.exe directory

so how solve this problem?

thanks, jarek

A: 

You have to add a qt.conf in your application's main installation directory (actually, the application's working directory), containing:

[Paths]
Plugins = <directory containing the image plugins directory>

So the directory layout is:

  • app.exe
  • qt.conf
  • plugins/
    • imageformats/
      • qsvg4.dll

And then in this case, the directory in qt.conf is plugins.

Ivo
A: 

The plugin used (Qt 4.6) is:

  • plugins/
    • iconengines/
      • qsvgicon4.dll

You still need qt.conf as Ivo explained.

oxullo