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

fix translate arguments #382

Merged
merged 4 commits into from
Feb 6, 2023
Merged

fix translate arguments #382

merged 4 commits into from
Feb 6, 2023

Conversation

jdorr
Copy link
Contributor

@jdorr jdorr commented Feb 6, 2023

In this pull request, I update the logic in translate() to allow optional arguments.

I decided to open this pull request after I ran into a ui file compilation difference:

pyside2-uic foo.ui --> QCoreApplication.translate("MainWindow", u"MainWindow", None) (pyside-5.15.4)
pyside2-uic foo.ui --> QCoreApplication.translate("MainWindow", u"MainWindow", None, -1) (pyside-5.12.6)

Notice how the first compilation with pyside-5.15.4 returns translate with 3 arguments instead of 4.
When we eventually use QtCompat.translate() we run into the following error:

  File "/dd/shows/DEV01/user/work.akelada/tools/cent7_64/package/launchpad/0.1.2/python/launchpad/Ui_launchpad_UI.py", line 205, in retranslateUi
    MainWindow.setWindowTitle(QtCompat.translate("MainWindow", u"MainWindow", None))
  File "/dd/tools/cent7_64/package/qt_py/1.3.6/python/Qt.py", line 844, in _translate
    "Expected 4 or 5 arguments, got {0}.".format(len(args) + 2))
TypeError: Expected 4 or 5 arguments, got 3.

Now translate("MainWindow", u"MainWindow", None) will work since n defaults to -1.

@CLAassistant
Copy link

CLAassistant commented Feb 6, 2023

CLA assistant check
All committers have signed the CLA.

@jandorr jandorr mentioned this pull request Feb 6, 2023
@mottosso
Copy link
Owner

mottosso commented Feb 6, 2023

Success, thanks for jumping through those hoops.

@mottosso mottosso merged commit 9dbae3d into mottosso:master Feb 6, 2023
jdorr added a commit to digitaldomain/Qt.py that referenced this pull request Feb 6, 2023
Merge pull request mottosso#382 from digitaldomain/master
@jdorr
Copy link
Contributor Author

jdorr commented Feb 9, 2023

Thanks @mottosso ! When do you think we can get a release?

@mottosso
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants