Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Different file explorer dependent on how application is started.

Different file explorer dependent on how application is started.

Scheduled Pinned Locked Moved Unsolved Qt for Python
7 Posts 3 Posters 423 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dwarrel
    wrote on 8 Jan 2025, 17:00 last edited by
    #1

    This might be partially a linux question. But my pyqt6 application has a different file explorer dependent on how the program is run. When running it from within PyCharm I get the following looking screen:
    bd91283e-6c18-4519-a14d-a531ef8ca7fc-image.png
    I think this is the normal (linux mint) file explorer that I am used to.

    However when executing from normal terminal, or from a .desktop shortcut. I get a very different file explorer window.
    e8eb9dea-e7e8-48f8-b4ee-eb6ca568a597-image.png

    Which seems to be more of a pyQT style explorer.

    I checked that the python that is ran is identical (print(sys.executable) is the same path). The only env variable set in PyCharm for execution is "PYTHONUNBUFFERED=1" which shouldnt cause this difference.

    Does anyone know what settings I am missing and what might be causing this difference?

    Kind regards,

    J 1 Reply Last reply 8 Jan 2025, 19:22
    0
    • D Dwarrel
      8 Jan 2025, 17:00

      This might be partially a linux question. But my pyqt6 application has a different file explorer dependent on how the program is run. When running it from within PyCharm I get the following looking screen:
      bd91283e-6c18-4519-a14d-a531ef8ca7fc-image.png
      I think this is the normal (linux mint) file explorer that I am used to.

      However when executing from normal terminal, or from a .desktop shortcut. I get a very different file explorer window.
      e8eb9dea-e7e8-48f8-b4ee-eb6ca568a597-image.png

      Which seems to be more of a pyQT style explorer.

      I checked that the python that is ran is identical (print(sys.executable) is the same path). The only env variable set in PyCharm for execution is "PYTHONUNBUFFERED=1" which shouldnt cause this difference.

      Does anyone know what settings I am missing and what might be causing this difference?

      Kind regards,

      J Offline
      J Offline
      JonB
      wrote on 8 Jan 2025, 19:22 last edited by
      #2

      @Dwarrel said in Different file explorer dependent on how application is started.:

      a different file explorer

      What is this in the context of Qt code? Do you mean these screenshots are from using Qt's QFileDialog class (for picking a file to open or save)?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 8 Jan 2025, 19:35 last edited by
        #3

        Hi,

        In addition to what @JonB asked, you should start your script with the QT_DEBUG_PLUGINS environment variable set to 1 to check which plugins are getting loaded. You might have a different style for exemple.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        D 1 Reply Last reply 9 Jan 2025, 12:35
        1
        • S SGaist
          8 Jan 2025, 19:35

          Hi,

          In addition to what @JonB asked, you should start your script with the QT_DEBUG_PLUGINS environment variable set to 1 to check which plugins are getting loaded. You might have a different style for exemple.

          D Offline
          D Offline
          Dwarrel
          wrote on 9 Jan 2025, 12:35 last edited by
          #4

          @SGaist said in Different file explorer dependent on how application is started.:

          Hi,

          In addition to what @JonB asked, you should start your script with the QT_DEBUG_PLUGINS environment variable set to 1 to check which plugins are getting loaded. You might have a different style for exemple.

          Thank you this was a good suggestion. I compared the output of the two and there was one difference namely.

          From terminal (where it goes wrong)
          
          qt.core.library: "/home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so" cannot load: Cannot load library /home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so: /home/dwarrel/anaconda3/envs/sweet-potato/bin/../lib/libharfbuzz.so.0: undefined symbol: FT_Get_Transform
          qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so" : "Cannot load library /home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so: /home/dwarrel/anaconda3/envs/sweet-potato/bin/../lib/libharfbuzz.so.0: undefined symbol: FT_Get_Transform"
          
          from pycharm (What I want)
          qt.core.library: "/home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so" loaded library
          

          I tried googling this but havent found anything related to this.

          @JonB said in Different file explorer dependent on how application is started.:

          What is this in the context of Qt code? Do you mean these screenshots are from using Qt's QFileDialog class (for picking a file to open or save)?

          Yes sorry, so this happens when opening a QFileDialog().

                  file_dialog = QFileDialog(self)
                  file_dialog.setDirectory(qt_settings.setValue("file_dialog_start_path", ''))
                  file_dialog.setWindowTitle("Open File")
                  file_dialog.setViewMode(QFileDialog.ViewMode.Detail)
                  file_dialog.setFileMode(QFileDialog.FileMode.ExistingFile)
                  if file_dialog.exec():
                      selected_file = file_dialog.selectedFiles()[0]
          
          J 1 Reply Last reply 9 Jan 2025, 13:16
          0
          • D Dwarrel
            9 Jan 2025, 12:35

            @SGaist said in Different file explorer dependent on how application is started.:

            Hi,

            In addition to what @JonB asked, you should start your script with the QT_DEBUG_PLUGINS environment variable set to 1 to check which plugins are getting loaded. You might have a different style for exemple.

            Thank you this was a good suggestion. I compared the output of the two and there was one difference namely.

            From terminal (where it goes wrong)
            
            qt.core.library: "/home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so" cannot load: Cannot load library /home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so: /home/dwarrel/anaconda3/envs/sweet-potato/bin/../lib/libharfbuzz.so.0: undefined symbol: FT_Get_Transform
            qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so" : "Cannot load library /home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so: /home/dwarrel/anaconda3/envs/sweet-potato/bin/../lib/libharfbuzz.so.0: undefined symbol: FT_Get_Transform"
            
            from pycharm (What I want)
            qt.core.library: "/home/dwarrel/anaconda3/envs/sweet-potato/lib/python3.12/site-packages/PyQt6/Qt6/plugins/platformthemes/libqgtk3.so" loaded library
            

            I tried googling this but havent found anything related to this.

            @JonB said in Different file explorer dependent on how application is started.:

            What is this in the context of Qt code? Do you mean these screenshots are from using Qt's QFileDialog class (for picking a file to open or save)?

            Yes sorry, so this happens when opening a QFileDialog().

                    file_dialog = QFileDialog(self)
                    file_dialog.setDirectory(qt_settings.setValue("file_dialog_start_path", ''))
                    file_dialog.setWindowTitle("Open File")
                    file_dialog.setViewMode(QFileDialog.ViewMode.Detail)
                    file_dialog.setFileMode(QFileDialog.FileMode.ExistingFile)
                    if file_dialog.exec():
                        selected_file = file_dialog.selectedFiles()[0]
            
            J Offline
            J Offline
            JonB
            wrote on 9 Jan 2025, 13:16 last edited by
            #5

            @Dwarrel
            Although I am not sure, I think libqgtk3.so is to do with display/how your dialog might look.
            Start by Googling: undefined symbol: FT_Get_Transform. You get a few hits about libharfbuzz. Have a read through those, e.g. maybe you have to install something else on whatever Linux distro you are using?
            I am not sure what aspect of running under PyCharm makes it different from from command-line, but I would start by investigating the message. Maybe you have more than one libharfbuzz.so in existence?

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Dwarrel
              wrote on 9 Jan 2025, 13:44 last edited by
              #6

              Thank you, from this suggestion I found this post stackoverflow. Pointing me to PYTHONPATH which is something that is set in pycharm.

              Exporting (in the terminal before running) the identical PYTHONPATH that I got from pycharm (run code with prin(os.environ)) gave me the identical file explorer box. I identified the follow path that changes if it works or not:

              /home/dwarrel/.local/share/JetBrains/Toolbox/apps/pycharm-professional/plugins/python/helpers/pycharm_matplotlib_backend
              

              If that is set in pythonpath variable I get the explorer that I want. Within this folder I did not find any reference for libqgtk3. I kinda assume that loading the matplotlib backend changes something about the file explorer used.

              Clearly this is not a solution or explanation of what is going on, however for my current purpose this is good enough.

              Thanks for the help.

              J 1 Reply Last reply 9 Jan 2025, 14:42
              1
              • D Dwarrel
                9 Jan 2025, 13:44

                Thank you, from this suggestion I found this post stackoverflow. Pointing me to PYTHONPATH which is something that is set in pycharm.

                Exporting (in the terminal before running) the identical PYTHONPATH that I got from pycharm (run code with prin(os.environ)) gave me the identical file explorer box. I identified the follow path that changes if it works or not:

                /home/dwarrel/.local/share/JetBrains/Toolbox/apps/pycharm-professional/plugins/python/helpers/pycharm_matplotlib_backend
                

                If that is set in pythonpath variable I get the explorer that I want. Within this folder I did not find any reference for libqgtk3. I kinda assume that loading the matplotlib backend changes something about the file explorer used.

                Clearly this is not a solution or explanation of what is going on, however for my current purpose this is good enough.

                Thanks for the help.

                J Offline
                J Offline
                JonB
                wrote on 9 Jan 2025, 14:42 last edited by
                #7

                @Dwarrel
                Well it kind of is the solution, in that you want to compare the two both running with the same PYTHONPATH.

                1 Reply Last reply
                0

                2/7

                8 Jan 2025, 19:22

                5 unread
                • Login

                • Login or register to search.
                2 out of 7
                • First post
                  2/7
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved