GithubHelp home page GithubHelp logo

Comments (8)

clemisch avatar clemisch commented on August 18, 2024 1

Thanks!

When I click "Press" the script does open a new window. This works both with $ python script.py and inside $ ipython3 --gui=qt5.

It just occured to me that e.g. the histogram window inside $ silx view does open. It seems that only the line plot doesn't work.

from silx.

clemisch avatar clemisch commented on August 18, 2024 1

...but to me the lineplot is by far the most used feature! πŸ˜ƒ

I understand though that this is not high priority for you. The workaround with QT_QPA_PLATFORM=wayland is working for now. I mainly wanted to open an issue about it because I was confused at first and didn't know if the lineplot was working at all.

from silx.

t20100 avatar t20100 commented on August 18, 2024

Hi,

I don't have access to a machine to try this.

To be sure, can you check which version of Qt and which binding silx view is loading? You can see it from the Help -> About menu.
It would also be good to check which rendering backend is used (OpenGL or matplotlib). You can see it in the Options -> Plot rendering backend: <backend> menu.

Also, can you run the following code from ipython3 --gui=qt5 and do a line profile as you do with silx view? This reproduces what you do in silx view, and would allow to check if the behavior is different.

from silx import sx; import numpy as np
w = sx.imshow(np.arange(100*100).reshape(100, 100))

To know which platform is used by default, you can run QT_DEBUG_PLUGINS=1 silx view.
It's quite verbose, but checking the loaded library ... lines allows to find which platform is used by default (xcb I guess).

from silx.

loichuder avatar loichuder commented on August 18, 2024

I am also on Gnome on Wayland (Ubuntu 22.04) and I cannot reproduce this, whether it is with Python 3.9 or 3.12.

I think further information is needed then: see the instructions given by @t20100

from silx.

clemisch avatar clemisch commented on August 18, 2024

Thanks for looking into this! Sorry for my delayed response.

can you check which version of Qt and which binding silx view is loading?

Qt version 5.15.2, Qt binding PyQt5

It would also be good to check which rendering backend is used

At the moment it's matplotlib. Behavior is unchanged for opengl (after restart and confirming it's using opengl).

Also, can you run the following code

The lineplot also doesn't show up here.

To know which platform is used by default, you can run QT_DEBUG_PLUGINS=1 silx view

It looks to me like that's also using qt5? Only in the first line it's PyQt5/.../libqxcb.so.

$ grep "loaded library" silx_log.txt 
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so"
loaded library "Xcursor"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/platformthemes/libqgtk3.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/imageformats/libqgif.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/imageformats/libqicns.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/imageformats/libqico.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/imageformats/libqjpeg.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/imageformats/libqsvg.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/imageformats/libqtga.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/imageformats/libqtiff.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/imageformats/libqwbmp.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/imageformats/libqwebp.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/iconengines/libqsvgicon.so"
loaded library "/home/clem/.local/share/pipx/venvs/silx/lib/python3.12/site-packages/PyQt5/Qt5/plugins/xcbglintegrations/libqxcb-glx-integration.so"

from silx.

t20100 avatar t20100 commented on August 18, 2024

Can you try to run this script? It reproduces what silx view profile does with regarding windows but without silx.
My guess is that there is an issue when opening a sub-window in an application, this would allow to check it.

from PyQt5 import QtCore, QtGui, QtWidgets

class MainWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()
        btn = QtWidgets.QPushButton("Press")
        self.setCentralWidget(btn)
        btn.clicked.connect(self._clicked)

    def _clicked(self):
        print("new window")
        new_window = QtWidgets.QMainWindow(self)
        new_window.show()

app = QtWidgets.QApplication([])

window = MainWindow()
window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
window.show()

app.exec()

You can also try with the latest version of PyQt5 (5.15.11) and with other Qt bindings: PyQt6 and/or PySide6 to see if it is better.
silx gives priority to PyQt5 if it is installed, so to try the other Qt bindings, you either need to set QT_API=PyQt6 (or PySide6) or to uninstall PyQt5.

from silx.

t20100 avatar t20100 commented on August 18, 2024

Thanks for opening the issue! It's the first time we hear about this issue.

I currently don't have much time to work on this project, but we'll figure out what is going wrong (It might take some time since we cannot reproduce it though).

I would still bet on an issue with sub-windows in your particular set-up:
The histogram uses a QWidget with flags=QtCore.Qt.Window while the profile uses a QMainWindow with flags=QtCore.Qt.Dialog.

Did you try with the latest PyQt5 and with PyQt6 and PySide6? Do you have the same issue?

Could you try this code? It's almost the same as the previous one, except for flags=QtCore.Qt.Dialog which I missed the first time I checked the profile code:

from PyQt5 import QtCore, QtGui, QtWidgets

class MainWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()
        btn = QtWidgets.QPushButton("Press")
        self.setCentralWidget(btn)
        btn.clicked.connect(self._clicked)

    def _clicked(self):
        print("new window")
        new_window = QtWidgets.QMainWindow(self, flags=QtCore.Qt.Dialog)
        new_window.show()

app = QtWidgets.QApplication([])

window = MainWindow()
window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
window.show()

app.exec()

You can also try patching silx by removing flags=QtCore.Qt.Dialog here:

qt.QMainWindow.__init__(self, parent=parent, flags=qt.Qt.Dialog)

from silx.

clemisch avatar clemisch commented on August 18, 2024

Thanks for coming back on this.

Did you try with the latest PyQt5 and with PyQt6 and PySide6? Do you have the same issue?

Ha! It seems to work with pyqt6. I can either force it with ipython3 --gui=qt6, or I uninstall pyqt5, install pyqt6, and then silx view file uses qt6 (reported in Help-About).

I see no downside of switching my overall workflow to --gui=qt6.

The default of silx seems to be qt5, though? Installed with pipx, it uses pyqt5 by default.

Could you try this code? It's almost the same as the previous one, except for flags=QtCore.Qt.Dialog which I missed the first time I checked the profile code:

This code opens a new window on click. The previous version of it also worked though.

You can also try patching silx by removing flags=QtCore.Qt.Dialog here:

Curiously, this does not change anything. Qt5 doesn't work, Qt6 works.

from silx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.