Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Natron 2.5 Qt.Alignment Flags Unrecognized (As Int) #854

Open
B4adle7 opened this issue Dec 23, 2022 · 8 comments
Open

Natron 2.5 Qt.Alignment Flags Unrecognized (As Int) #854

B4adle7 opened this issue Dec 23, 2022 · 8 comments
Labels
status:confirmed type:bug Something isn't working

Comments

@B4adle7
Copy link

B4adle7 commented Dec 23, 2022

It is wonderful to see Natron 2.5 with Python 3 support.
However once python tools with Qt UIs were introduced, Natron did not allow python scripts to recognize QtCore.Qt.AlignmentFlags correctly.
Python exception: PySide.QtCore.Qt.AlignmentFlag' object cannot be interpreted as an integer

In the python apps for Natron, if applying an alignment flag to a Qt widget, discovered that the flag needed to be forced into an int() or else it would error out (as above)

splash.showMessage(splash_pun,  
                   alignment=int(QtCore.Qt.AlignHCenter),  
                   color=splash_color)

When doing a common Qt Flag function, such as combining flags, it fails with the same problem.

print(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)  
Python exception: PySide.QtCore.Qt.AlignmentFlag' object cannot be interpreted as an integer

qtpy is installed as advised and in use.
It feels like an incomplete binding of the Python functions or methods.
Did attempt to force it. Coding to use int(Qt.AlignmentFlag) in place of Qt.AlignmentFlag. However that breaks all other code that uses shared UI code.

So far, it seems only to be the Qt.AlignmentFlags, and only in Natron 2.5
Same code and UI works in 2.4.4 and before.

Looking at a flag, e.g. dir(QtCore.Qt.AlignRight), it seems to have all the expected methods and attributes. (__le__, __int__, __or__, etc). However in use it seems to not use the class methods. as expected.

@BigRoy
Copy link

BigRoy commented Dec 28, 2022

I'm getting these seems issues in Natron 2.5.0.

Furthermore, I also got this error when trying to integrate OpenPype pipeline:

afbeelding

Object has no setWindowFlags - which seems odd since the same logic has worked across different DCCs for many years so it definitely seems like an odd behavior to Natron.

Or technically -it could be related to some changes required for QtPy as this PR for OpenPype does to support PySide6: ynput/OpenPype#4255 - however that explicitly mentions it'll make it incompatible with PySide which Natron 2.5.0 appears to use so directly seems to counter that argument.

@rodlie
Copy link
Contributor

rodlie commented Dec 28, 2022

When doing a common Qt Flag function, such as combining flags, it fails with the same problem.

print(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)  
Python exception: PySide.QtCore.Qt.AlignmentFlag' object cannot be interpreted as an integer

Confirmed on macOS (the app also crashes after the exception), works fine on 2.4.

@rodlie rodlie added type:bug Something isn't working status:confirmed labels Dec 28, 2022
@B4adle7
Copy link
Author

B4adle7 commented Jan 28, 2023

Oddly enough, only today realized it even had PySide included.
This might contribute to the bug(s) or other Qt UI programming issues.

Agreement, and stressing, what @BigRoy addresses, that Natron needs to upgrade to PySide6. Especially making use of Python3.10

Over the past week, a fellow developer and I have been upgrading our work to 2023 VFX standards.
In doing so, we discovered PySide2 seems to fail when using Python 3.10.
Hadn't tried using PySide6 yet. But once PySide2 was replaced with PySide6, everything was working reliably.

@rodlie While updating to make use of PySide6, discovered PySide(x) becomes VERY particular with input types.
AND now working with PySide6, finding flag values that are now drastically changing.
We'd both run into the isn't an . I believe it might be due to crossing PySide versions.
e.g. applying a PySide6 flag into a PySide function might be what is happening?

Yes I'm thinking out loud this morning while trying to figure out. Thanks for your input everyone.

@B4adle7
Copy link
Author

B4adle7 commented Jan 28, 2023

Oh, and oddly enough, the Natron documentation states to use qtpy as the PySide importing.
qtpy doesn't support PySide, only PySide2/6
Natron is PySide.

@B4adle7
Copy link
Author

B4adle7 commented Jan 28, 2023

Well it does seem to support PySide in Natron. O.k. That stops it from crashing Natron. But have a feeling since the rest of the modules used might be pulling from PySide2/6. Yes. Brain storming rhetorically.

@devernay
Copy link
Member

when building Natron with Qt4, we use the last qtpy version that supported PySide/Qt4 (qtpy==1.11.2)

@devernay
Copy link
Member

We need some help packaging Natron 2.6 with Qt5/PySide2 on Windows and Linux. The docker image to build it on Linux is ready with Qt5, so that one should be easy.
@B4adle7 what platform are you using?

@devernay
Copy link
Member

devernay commented Apr 10, 2023

And btw PySide2 5.15.2.1 is supposed to support Python 3.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:confirmed type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants