Community
    • Login

    Little Dialog-wrapper for PythonScript

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    74 Posts 8 Posters 13.1k Views
    Loading More Posts
    • 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.
    • SN-CHS
      SN-CH
      last edited by

      @Alan-Kilborn said in Little Dialog-wrapper for PythonScript:

      z = notepad.prompt(‘prompt text:’, ‘title bar of window’, ‘’)

      Works perfectly. Much appreciated.

      1 Reply Last reply Reply Quote 2
      • Michael VincentM Michael Vincent referenced this topic on
      • PeterJonesP
        PeterJones @Ekopalypse
        last edited by

        @Ekopalypse ,

        After reading this post, I wanted to try out @Michael-Vincent’s translation script.

        So I went to my portable that has PythonScript 3.0.17 installed, and tried to install based on the README instructions and tried to run the first example there. I get

        Python 3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]
        Initialisation took 406ms
        Ready.
        Traceback (most recent call last):
          File "C:\usr\local\apps\npp\npp862.ps3\plugins\Config\PythonScript\scripts\windlg_ex1.py", line 1, in <module>
            from WinDialog import Dialog, Button, create_dialog_from_rc
        ModuleNotFoundError: No module named 'WinDialog'
        

        In following the instructions, I put the WinDialog folder in the user directory ...plugins\Config\PythonScript\lib, as instructed. I can verify it’s there:

        > cd plugins
        > dir
         Directory of C:\usr\local\apps\npp\npp862.ps3\plugins
        
        02/08/2024  01:28 PM    <DIR>          .
        02/08/2024  01:28 PM    <DIR>          ..
        02/08/2024  01:29 PM    <DIR>          ColumnTools
        03/29/2024  09:36 AM    <DIR>          Config
        01/14/2024  03:33 AM    <DIR>          doc
        02/08/2024  01:09 PM    <DIR>          mimeTools
        02/08/2024  01:09 PM    <DIR>          NppConverter
        02/08/2024  01:09 PM    <DIR>          NppExport
        02/08/2024  01:12 PM    <DIR>          PythonScript
        
        > dir Config
         Directory of C:\usr\local\apps\npp\npp862.ps3\plugins\Config
        
        03/29/2024  09:36 AM    <DIR>          .
        03/29/2024  09:36 AM    <DIR>          ..
        03/29/2024  10:27 AM               179 ColumnTools.ini
        02/08/2024  01:12 PM               646 converter.ini
        02/08/2024  01:07 PM           208,728 nppPluginList.dll
        03/29/2024  10:23 AM    <DIR>          PythonScript
        
        > dir Config\PythonScript
         Directory of C:\usr\local\apps\npp\npp862.ps3\plugins\Config\PythonScript
        
        03/29/2024  10:23 AM    <DIR>          .
        03/29/2024  10:23 AM    <DIR>          ..
        03/29/2024  10:08 AM    <DIR>          lib
        03/29/2024  10:25 AM    <DIR>          scripts
        
        > dir Config\PythonScript\lib\WinDialog
         Directory of C:\usr\local\apps\npp\npp862.ps3\plugins\Config\PythonScript\lib\WinDialog
        
        03/29/2024  10:08 AM    <DIR>          .
        03/29/2024  10:08 AM    <DIR>          ..
        03/29/2024  10:08 AM    <DIR>          controls
        03/29/2024  10:08 AM             2,748 readme.md
        03/29/2024  10:08 AM    <DIR>          resource_parser
        03/29/2024  10:08 AM         2,145,865 test_dynamic_dialog2.gif
        03/29/2024  10:08 AM    <DIR>          win_helper
        03/29/2024  10:08 AM            22,893 __init__.py
        03/29/2024  10:08 AM    <DIR>          __tests__
        

        If I move WinDialog from the user directory to the machine directory (C:\usr\local\apps\npp\npp862.ps3\plugins\PythonScript\lib), then the script can see WinDialog and it loads and runs fine.

        Is there some magic that needs to go in the startup.py to make PS3 see the user-lib directory for a portable installation?

        Debug Info

        Notepad++ v8.6.2   (64-bit)
        Build time : Jan 14 2024 - 02:16:00
        Path : C:\usr\local\apps\npp\npp862.ps3\notepad++.exe
        Command Line : 
        Admin mode : OFF
        Local Conf mode : ON
        Cloud Config : OFF
        OS Name : Windows 10 Enterprise (64-bit)
        OS Version : 22H2
        OS Build : 19045.4170
        Current ANSI codepage : 1252
        Plugins : 
            ColumnTools (1.4.5.1)
            mimeTools (3)
            NppConverter (4.5)
            NppExport (0.4)
            PythonScript (3.0.17)
        
        Michael VincentM 2 Replies Last reply Reply Quote 1
        • Michael VincentM
          Michael Vincent @PeterJones
          last edited by

          @PeterJones said in Little Dialog-wrapper for PythonScript:

          PythonScript 3.0.17

          That’s “most likely” the problem. See here:

          https://github.com/bruderstein/PythonScript/issues/322

          I have stayed on 3.0.16 because of this and until this gets fixed.

          Cheers.

          PeterJonesP mpheathM 2 Replies Last reply Reply Quote 4
          • PeterJonesP
            PeterJones @Michael Vincent
            last edited by PeterJones

            @Michael-Vincent said in Little Dialog-wrapper for PythonScript:

            I have stayed on 3.0.16 because of this and until this gets fixed.

            Okay, switching to 8.6.4 portable with 3.0.16, I can get it to work using the user-lib instead of machine-lib. Thanks.

            update: moved remainder of this post to the other Topic, since it’s translate.py specific, and this Dialog-wrapper Topic is already pretty full…

            1 Reply Last reply Reply Quote 1
            • mpheathM
              mpheath @Michael Vincent
              last edited by

              @Michael-Vincent You can add paths to sys.path if want to use PythonScript version 3.0.17.0.

              This is what I have been using in startup.py .

              # Fix for sys.path bug in 3.0.17
              if notepad.getPluginVersion() in ('3.0.17.0',):
                  sys.path.append(notepad.getPluginConfigDir() + r'\PythonScript\lib')
              

              It is a workaround until a fixed version is released.

              Michael VincentM 1 Reply Last reply Reply Quote 5
              • Michael VincentM
                Michael Vincent @mpheath
                last edited by Michael Vincent

                @mpheath said in Little Dialog-wrapper for PythonScript:

                It is a workaround until a fixed version is released.

                Afraid it’s not that easy for me. I’ve added all my missing directories to make it “on par” with the previous version, but I still get a ImportError that I do not get in the previous version:

                ImportError: DLL load failed while importing win32gui: The specified module could not be found.
                

                Rest assured, the module is installed correctly. I can import it from my system Python and from PythonScript 3.0.17 commit right before the commit that breaks the path that I note in my issue. I’ve tried adding the specific directories to both sys.path and os.environ["PATH"] as described in https://github.com/mhammond/pywin32/issues/1730 and other Google results.

                Cheers.

                Michael VincentM 1 Reply Last reply Reply Quote 1
                • Michael VincentM
                  Michael Vincent @Michael Vincent
                  last edited by

                  @Michael-Vincent said in Little Dialog-wrapper for PythonScript:

                  Afraid it’s not that easy for me.

                  @mpheath points out it is indeed “that easy” if you know what you are doing and thank you @mpheath for showing me what to do:
                  https://github.com/bruderstein/PythonScript/issues/322#issuecomment-2041020162

                  And my specific fix:
                  https://github.com/bruderstein/PythonScript/issues/322#issuecomment-2045932479

                  Cheers.

                  Michael VincentM 1 Reply Last reply Reply Quote 3
                  • Michael VincentM
                    Michael Vincent @Michael Vincent
                    last edited by

                    @Michael-Vincent said in Little Dialog-wrapper for PythonScript:

                    And my specific fix:

                    Not needed anymore - 3.0.18 is released which fixes this bug.

                    Cheers.

                    1 Reply Last reply Reply Quote 0
                    • Michael VincentM
                      Michael Vincent @PeterJones
                      last edited by

                      @PeterJones said in Little Dialog-wrapper for PythonScript:

                      Is there some magic that needs to go in the startup.py to make PS3 see the user-lib directory for a portable installation?

                      This is now fixed in the 3.0.18 release.

                      Cheers.

                      1 Reply Last reply Reply Quote 3
                      • Bruno BonaspettiB
                        Bruno Bonaspetti
                        last edited by

                        Hello, could someone show me how to download and install this translation plugin on notepad++, as I have a lot of things to translate and word translation doesn’t work as it should.

                        PeterJonesP 1 Reply Last reply Reply Quote 0
                        • PeterJonesP
                          PeterJones @Bruno Bonaspetti
                          last edited by PeterJones

                          @Bruno-Bonaspetti ,

                          Have a little patience. You already asked that question yesterday here. This is not paid support that is guaranteed to get a reply in 5 minutes or your money back; this is a Community of fellow users of Notepad++, and as such, any who read here regularly and answer questions do so solely on their free time, and they might not always have time to answer a specific question – especially one that might take more knowledge of a specific sub-tool of Notepad++.

                          Furthermore, this topic, “Little Dialog-wrapper for PythonScript” is focused on the Dialog Wrapper library for the PythonScript plugin; it briefly mentioned a script that was using that wrapper to help with the user interface, but the translation is not the focus of this discussion.

                          Your original question was in the right place. This question was not. I will try to give a brief answer in the other topic.

                          1 Reply Last reply Reply Quote 1
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors