appwiki:notepadplusplus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
appwiki:notepadplusplus [2021/08/22 19:52] – created yingappwiki:notepadplusplus [2023/02/06 06:40] (current) – [Plugin - PythonScript] ying
Line 10: Line 10:
   * Full screen (F11, F12)   * Full screen (F11, F12)
  
 +**find non ascii**
 +  * find in regex <code>[^\x00-\x7F]+</code>
 **replace tips** **replace tips**
  
Line 88: Line 90:
  
   * install:   * install:
-    * from plugin manager +    * install/get latest notepad++ 
-    * or download manually and put in plugin folder from http://npppythonscript.sourceforge.net/ +    * from plugin manager, search python script, check and install (default is v2, w python 2.7.18, you can use same method to manually use alpha py3.10.9 version with same method) 
 +    * for tkinter lib, go lastest release version: https://github.com/bruderstein/PythonScript/releases/ 
 +      * unzip PythonScript_TclTk_xxx.xxx.zip, and copy lib into npp/plugins/PythonScripts lib folder. 
 +      * (optional) unzip  PythonScript_ExtraLibs_xxxx.zip if you need lib2to3, distutils,bsddb 
 +    * (outdate) <del>or download manually and put in plugin folder from http://npppythonscript.sourceforge.net/ 
 +</del>
   * Python for Npp document   * Python for Npp document
     * http://npppythonscript.sourceforge.net/docs/latest/     * http://npppythonscript.sourceforge.net/docs/latest/
Line 248: Line 254:
   * the default loading directory for NppPythonScript plugin, any script will be automatically add to path for import <code>   * the default loading directory for NppPythonScript plugin, any script will be automatically add to path for import <code>
 npp\plugins\PythonScript\lib npp\plugins\PythonScript\lib
-npp\plugins\PythonScript\scripts +npp\plugins\PythonScript\scripts (default startup.py is here)
 npp\plugins\Config\PythonScript\lib npp\plugins\Config\PythonScript\lib
 npp\plugins\Config\PythonScript\scripts npp\plugins\Config\PythonScript\scripts
Line 321: Line 327:
 </code> </code>
  
 +
 +==== 3rd party addon using notepad++ and pythonscript ====
 +
 +  * pythonscript git: https://github.com/bruderstein/PythonScript
 +  * use notepad as interactive python runner: https://github.com/bitagoras/PyPadPlusPlus
 +
 +==== Qt GUI and PythonScript ====
 +
 +  * To get Qt (PySide or PyQt4) to work with PythonScript, (depends on your pythonscript's python version)
 +    * if you use Plugins > PythonScript > Show Console, it will show the python 2.7.18 in 64bit (my case) as the python version
 +    * download the same or similar version of Python from python offical website, 
 +      * search version number in https://www.python.org/downloads/
 +      * (my case) https://www.python.org/downloads/release/python-2718/
 +    * download "Windows x86-64 MSI installer", you can install to a special path if you want to make it not affect your system.
 +      * in install step, you can choose where to install, and where add python.exe to path, by default it won't, as if you already have multiple python versions installed, choose not add to path will not affect your current setup, choose add to path, if you want it to be your default python as well. (my case, I just want it to be a py2.7 package download, so I don't check add python.exe to path during install)
 +    * once ok, you can use your own python to install package, and add the site-packages path to PythonScript python's sys.path
 +    * start your standalone python, and run (PySide,PyQt4,PySide2,PyQt5 depends on your PythonScript plugin's python version) <code python>
 +import subprocess
 +import sys
 +def install(package):
 +    subprocess.check_call([sys.executable, "-m", "pip", "install", package])
 +# py2 case: 2.7 = PySide
 +install("PySide")
 +
 +# py3 case: 3.x = PySide2
 +install("PySide2")
 +</code>
 +  * add that standalone package path to PythonScript config startup.py file <code>
 +# notepad path\plugins\Config\PythonScript\scripts\startup.py
 +</code> and code <code python>
 +# optional clear multiple python registered system path issue
 +old_path = sys.path
 +old_path = [x for x in old_path if not x.startswith('D:\\my_other_system_env_registered_python_path\\Python27') ]
 +sys.path = old_path
 +
 +# register lib path
 +import os
 +my_path_list =[
 +    r'D:\my_path_match_version_local_python_path\Python27\Lib\site-packages',
 +    r'D:\my_path_to_other_mpp_app_i_write\NppCoder',
 +    r'D:\my_path_to_other_npp_script\npp_script'
 +    ]
 +for x in my_path_list:
 +    if os.path.isdir(x):
 +        sys.path.append(x)
 +
 +</code>
 ==== My Npp Python Script ==== ==== My Npp Python Script ====
  
  • appwiki/notepadplusplus.1629661972.txt.gz
  • Last modified: 2021/08/22 19:52
  • by ying