コード例 #1
0
ファイル: thready.py プロジェクト: ewerybody/PysidePlayground
    def closeEvent(self, event):
        """
        Make sure all is shut down properly.

        With `shiboken2.isValid` we can avoid try/excepting this
          RuntimeError: Internal C++ object already deleted.
        which would be inevitable without further book keeping.
        """
        if shiboken6.isValid(self.thread) and self.thread is not None:
            # If not interrupted already, request and wait as long as it takes.
            self.thread.requestInterruption()
            while self.thread.isRunning():
                time.sleep(0.05)

        return super(SimpleThreadDemo, self).closeEvent(event)
コード例 #2
0
def is_deleted(obj) -> bool:
    if qt.API == "pyside2":
        import shiboken2

        return not shiboken2.isValid(obj)
    elif qt.API == "pyside6":
        import shiboken6

        return not shiboken6.isValid(obj)
    elif qt.API == "pyqt5":
        try:
            from PyQt5 import sip
        except ImportError:
            import sip  # type: ignore[import, no-redef]
        return sip.isdeleted(obj)
    else:
        try:
            from PyQt6 import sip
        except ImportError:
            import sip  # type: ignore[import, no-redef]
        return sip.isdeleted(obj)
コード例 #3
0
ファイル: qt_compat.py プロジェクト: timhoffm/matplotlib
 def _isdeleted(obj):
     return not shiboken6.isValid(obj)
コード例 #4
0
ファイル: qt_compat.py プロジェクト: luzpaz/matplotlib
     def _isdeleted(obj): return not shiboken6.isValid(obj)
 elif QT_API == QT_API_PYQT5: