UmSenhorQualquer/pyforms

CSS and Pyforms

Closed this issue · 5 comments

I wrote a small script some time ago using Pyforms. I created a custom style.css file for it. At the time it was working well. I just had to use this script again today and since my Python installation changed, I had to reinstall Pyforms. I did so using the repository as suggested in #37. I installed all the optional packages except qscintilla2. My script runs, the forms are created but the style are not applied. I tried the PersonWindow.py script located in the tutorial folder of the repository, same issue.

Could I have missed something in my installation of Pyforms? I am using version 4.11.4 of pyqt.

Thank you in advance for your help!

Hi Jeremy,

You are right I updated the way the stylesheet is imported sometime ago.

Now there are 4 variables that can be set in the settings to update the stylesheet. Checkout the explanation here:
http://pyforms.readthedocs.io/en/v.1.0.0/getting-started/style-layout/
http://pyforms.readthedocs.io/en/v.1.0.0/api-documentation/settings/

I also updated the example PersonWindow.py to include the load of a new settings file, so you understand how it works:

https://github.com/UmSenhorQualquer/pyforms/blob/v2.0.0.beta/tutorials/3.CodeOrganization/PersonWindow.py
https://github.com/UmSenhorQualquer/pyforms/blob/v2.0.0.beta/tutorials/3.CodeOrganization/settings.py

One last note: This week we have updated Pyforms (v2.0.0.beta) to work with Qt5, we have tried to let it compatible with Qt4 but we have not been able to test it yet, because now all your PCs have Qt5 installed.

Let me know if this explanation solved your problem.

Hi @UmSenhorQualquer,

Thank you for the quick response, it did solve the problem!

I also updated Pyforms to the v2.0.0.beta since you mentioned that it works with Qt5. When running my script I get an error No module named PyQt4 from the BaseWidget.py file. I took a look at this file and noticed line 13 if conf.PYFORMS_USE_QT5:, I am guessing that this test fails. Should I update pysettings? I checked the repo but it looks like I have the latest version. Am I missing something else? Thanks again for your help!

If you installed v2.0.0.beta you should have Qt5 activated by default.
checkout the settings file: https://github.com/UmSenhorQualquer/pyforms/blob/v2.0.0.beta/pyforms/settings.py

Does the file of your pyforms installation have the variable PYFORMS_USE_QT5 = True?

can you send me the line where the error occurs?

Yes, the settings.py of my pyforms installation has the variable PYFORMS_USE_QT5 = True. I found out what was going on. I am using Anaconda and for some reason there was a pyform folder under /lib which contained the version 1.0 and the version 2.0 was in /lib/site-packages. I removed the folder in /lib and it worked!

great 👍