Skip to content

PR: Add missing QtWebEngineWidgets.QWebEngineScript import for PyQt5 and PySide2#322

Closed
EasyIsrael wants to merge 6 commits intospyder-ide:masterfrom
EasyIsrael:master
Closed

PR: Add missing QtWebEngineWidgets.QWebEngineScript import for PyQt5 and PySide2#322
EasyIsrael wants to merge 6 commits intospyder-ide:masterfrom
EasyIsrael:master

Conversation

@EasyIsrael
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Member

@CAM-Gerlach CAM-Gerlach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the other two, assuming it is available, it seems to make sense, but I'm unsure why this imports QWebEngineScript for PyQT6 and PYSIDE6, when its already imported by the import *.

The test failures on Python 3.10 are unrelated; I can look into fixing them—for some reason, the installed qtpy package isn't getting found on import in the tests.

from PyQt6.QtWebEngineCore import QWebEnginePage
from PyQt6.QtWebEngineCore import QWebEngineSettings
from PyQt6.QtWebEngineCore import QWebEngineProfile
from PyQt6.QtWebEngineWidgets import QWebEngineScript
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused why this is one needed is. Isn't this name already imported by from PyQt6.QtWebEngineWidgets import *?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from PyQt6.QtWebEngineWidgets import QWebEngineScript

from PySide6.QtWebEngineCore import QWebEnginePage
from PySide6.QtWebEngineCore import QWebEngineSettings
from PySide6.QtWebEngineCore import QWebEngineProfile
from PySide6.QtWebEngineWidgets import QWebEngineScript
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from PySide6.QtWebEngineWidgets import QWebEngineScript

@CAM-Gerlach
Copy link
Copy Markdown
Member

CAM-Gerlach commented Feb 26, 2022

FYI, I've solved the CI issues in #324 ; once that's merged, you can git fetch upstream && git rebase upstream/master && git push -f to get the fix here.

@EasyIsrael
Copy link
Copy Markdown
Contributor Author

EasyIsrael commented Feb 26, 2022 via email

@CAM-Gerlach
Copy link
Copy Markdown
Member

For the others i just added it the same way, because i thought it is necessary.

Actually, it isn't—they already work with those bindings, because right above where they were added, QtPy has the lines

from PyQt6.QtWebEngineWidgets import *

and

from PySide6.QtWebEngineWidgets import *

This imports all top-level non-private names from the QtWebEngineWidgets module, including QWebEngineScript.

Therefore, those two lines added can be removed, as I've made GitHub suggestions for (you can either batch-apply them, or do so manually).

…ssion

PR: Restrict broken Pytest versions to those not affected by the Pytest 7.0.0 import-mode=importlib behavior regression
Copy link
Copy Markdown
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your help with this @EasyIsrael ! Already merged the PR to fix our tests (#324) so you can go ahead and rebase to get the changes 👍 Also, besides @CAM-Gerlach comments regarding the removal of some lines added on PyQt6 and PySide6, it would be nice to add a new assertion when testing the module here:

@pytest.mark.skipif(PYSIDE6 or PYQT6, reason="Only available in Qt<6,>=6.2 bindings")
def test_qtwebenginewidgets():
"""Test the qtpy.QtWebEngineWidget namespace"""
QtWebEngineWidgets = pytest.importorskip("qtpy.QtWebEngineWidgets")
assert QtWebEngineWidgets.QWebEnginePage is not None
assert QtWebEngineWidgets.QWebEngineView is not None
assert QtWebEngineWidgets.QWebEngineSettings is not None

So adding the a line like:

assert QtWebEngineWidgets.QWebEngineScript is not None

Let us know if you have any question or if you need help with the rebase or to do the changes

@dalthviz dalthviz changed the title QWebEngineScript added PR: Add missing QtWebEngineWidgets.QWebEngineScript import for PyQt5 and PySide2 Feb 28, 2022
@dalthviz dalthviz added this to the v2.1.0 milestone Feb 28, 2022
@CAM-Gerlach
Copy link
Copy Markdown
Member

(As a reminder, the commands to rebase this:)

git fetch upstream
git rebase upstream/master
git push -f

@CAM-Gerlach CAM-Gerlach marked this pull request as draft March 1, 2022 17:21
@CAM-Gerlach CAM-Gerlach marked this pull request as draft March 1, 2022 17:21
@CAM-Gerlach
Copy link
Copy Markdown
Member

Hey @EasyIsrael, thanks for bearing with us! It looks like things went wrong with Git here—seems like the original issue, which I should have noticed before, is that the PR was submitted from your master branch, rather than a feature branch with the changes. As a consequence things went haywire when you tried to pull in the CI fixes, with my changes are showing up on your PR, while the commit history shows multiple merges and the same commits multiple times, which not only is an issue here, but also will cause even more issues for you next time you try to submit a PR.

While you could cherry-pick the commits, since its only two lines in one file being changed, its probably easier to just copy them and redo them. So what I suggest to fix your repo is:

  1. Copy (or just remember) the two lines you've changed.

  2. Run the following to fix your master branch locally and remotely and set up a new feature branch:

    git fetch --all
    git reset --hard upstream/master
    git push -f
    git checkout -b add-qwebenginescript
  3. Paste/type in the two changed lines

  4. Run the following to commit and push (as normal):

    git commit -am "Add missing QWebEngineScript import for PyQt5 and PySide2"
    git push -u origin add-qwebenginescript
  5. Create a new PR here off that branch and close this one

Thanks!

@EasyIsrael
Copy link
Copy Markdown
Contributor Author

Thank you CAM-Gerlach and dalthviz for your help
to push my changes to the qtpy repository.
It seems to be a bit more complicated. I'm not so familiar with git and the branch stuff. I will try to copy n paste my changes to the original master branch and make another pull request. I hope that works then.

@CAM-Gerlach
Copy link
Copy Markdown
Member

Thanks, @EasyIsrael , looks like it did, so I'll close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants