Packing with Pyinstaller: PyQt4.QtGui.setStyle ignored?

Question:

How to customize PyQt style for my application using Pyinstaller on Ubuntu 14.04?

Details:

I have packaged the PyQt4 / Python application using pyinstaller on Windows, and it seems to work fine, no difference between the package and when run only in my IDE. I tried to reproduce this process using Ubuntu 14.04, and I have some problems that I cannot solve.

I can set the PyQt style when working in my IDE using: app = QtGui.QApplication(sys.argv) app.setStyle('sgi') However, this is ignored during the build process. Everything else works the same as building Windows, but the packaged Ubuntu application is very different from when it runs in the IDE on Ubuntu:

IDE:

enter image description here

Pyinstaller result:

enter image description here

I am creating an application using:

james@james-PC :~$ pyinstaller --distpath /path/myApp/tmp --onedir /path/myApp/myApp.spec

I launched the application using the terminal to find out if there is anything, but only what appears when the application first loads:

(myApp:8312): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",

Googling Gtk-WARNING has a number of suggested solutions. I tried every time several times, no luck. From what I read, I'm not sure if this is related to my PyQt setStyle problem either.

Just in case, this is useful, the spec file I use is as follows:

 # -*- mode: python -*- block_cipher = None added_files = [('some/file.txt','.')] a = Analysis(['/path/myApp.py'], pathex=['/home/'], binaries=None, datas=added_files, hiddenimports=['numpy','os','sys','joblib.Parallel','joblib.delayed','scipy.signal.spectrogram','matplotlib','mplwidget','multiprocessing','matplotlib.pyplot','matplotlib.cm','platform','time','ctypes','matplotlib.gridspec','scipy.constants','tkinter','tkFileDialog','myGUI','scipy.interpolate.interp1d','itertools.combinations','pyfftw'], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_ciper) pyz = PYZ(a.pure, a.zipped_data, cipher=block_ciper) exe = EXE(pyz, a.scripts, exclude_binaries=True, name='maApp', debug=False, strip=False, upx=True, console=True) coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, name='myApp') 

Thanks in advance for any pointers or solutions.

+2
source share

Source: https://habr.com/ru/post/1275179/


All Articles