How to upload .ico files in PyQt4 from the network

I have an application developed in PyQt4.

He has installed icons for windows and QMenus.

All client systems have installed python. And PyQt4 boots from a network location (\\system_xyz\PyQt4).

The application works fine on developer systems with properly loaded icons. But when the same script is run on clients, the application works, but the icons do not load.

In my application, I also used Qsql drivers. He also had the same problem. It works in the developer system, but not in the client system.

I was able to overcome this issue with the sql driver by adding the sql plugin path to the application as shown below

SQLDriverPath = (r'\\system_xyz\PyQt4\plugins\sqldrivers')
QtGui.QApplication.addLibraryPath(SQLDriverPath)

I realized that pyqt4 needs qico4.dllto read .ico files. so I added the path imageformatsto the application. but it didn’t work.

ImageDriverPath = (r'\\system_xyz\PyQt4\plugins\imageformats')
QtGui.QApplication.addLibraryPath(ImageDriverPath)

Can someone suggest me the right approach to solve my problem of loading .ico in PyQt application from the network.

MY UPDATES

I did the following to list the supported image formats.

import sys

sys.path.append(r'r'\\system_xyz')

from PyQt4 import QtGui

for imageType in QtGui.QImageReader.supportedImageFormats():
    print imageType

OUTPUT

bmp
pbm
pgm
png
ppm
xbm
xpm

I tried to list as above, after adding imageformats, OP is the same even tried to create QtGui,QApplication(). The same result does not change.

+3
source share
2 answers

You can set the paths in the qt.conf file and put this file in the location of the executable file of your application.

Access PyQt4 from a network location say \ somesystem \ Share \ PyQt4

qt.conf \\somesystem\Share\PyQt4, .conf .

qt.conf

[Paths]
Prefix = //somesystem/Share/PyQt4
Binaries = //somesystem/Share/PyQt4

, sqldrivers. app.addLibraryPath , .

0

, PyQt4.

addLibraryPath , QtCore.QCoreApplication.addLibraryPath(). QtGui :

QtCore.QCoreApplication.addLibraryPath( '//server/location/PyQt4/plugins' )
app = QtGui.QApplication(sys.argv)

QApplication, . qt.conf .

+3

All Articles