Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1618

aboutToQuit and commitDataRequest not emitted on logout when installed through pip

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 6.1.1
    • PySide
    • None
    • Manjaro (Arch-based) KDE Stable
    • Linux/X11

    Description

      import sys
      from PySide6.QtCore import QLibraryInfo, qVersion
      from PySide6.QtWidgets import QApplication,QWidget
      
      class Window(QWidget):
          def __init__(self):
              super(Window, self).__init__()
      
      def about_to_quit():
          print("about_to_quit")
          with open('about_to_quit.txt', 'w') as f:
              f.write("a")
      
      def commit_data():
          print("commit_data")
          with open('commit_data.txt', 'w') as f:
              f.write("a")
      
      if __name__ == '__main__':
          print('Python {}.{}'.format(sys.version_info[0], sys.version_info[1]))
          print(QLibraryInfo.build())
          app = QApplication(sys.argv)
          window = Window()
          window.setWindowTitle(qVersion())
          window.show()
      
          app.aboutToQuit.connect(about_to_quit)
          app.commitDataRequest.connect(commit_data)
      
          app.exec_()    
          sys.exit(app.exec_())
      

      When I install pyside6 though my package manager (Arch repositories), this code works perfectly, both aboutToQuit and commitDataRequest are emitted (both files are created) when I logout while the app is running.

      However when I run this code under a pip-installed pyside6 (system pip or virtual env) and logout while it is running, the signals are not emitted and none of the files are created. I think this also happens on shutdown/reboot (not fully tested).

      This makes virtual environments (pipenv, etc) unusable. This doesn't seem like intended behaviour as the quick start guide refers venvs/pip install with no disclaimer/caution. Not sure if this is a Qt bug, but I would be grateful if I get pointed in the right direction or if at least someone can reproduce it.

      I am fairly certain this also happens on PySide2, PyQt5 and spills over to a executable using PyInstaller based on a project I was working on.

      Attachments

        1. logoff_signals.py
          0.8 kB
        2. pyside1618_cpp.zip
          2 kB
        3. pyside1618.py
          1 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              shirokuma Shiro K.
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes