diff options
author | m32 <grzegorz.makarewicz@gmail.com> | 2022-02-20 01:29:42 +0300 |
---|---|---|
committer | m32 <grzegorz.makarewicz@gmail.com> | 2022-02-20 01:29:42 +0300 |
commit | 1b624d4c8a05e53db5356806e456f675931a8363 (patch) | |
tree | 147cc72637adb68be09947dc547c1ad9bdcdf781 /python/configs | |
parent | a7b531abe9b481704d054d82185627289df57ff1 (diff) |
python initializacion in main thread, more efficient connection with cffi
Diffstat (limited to 'python/configs')
-rw-r--r-- | python/configs/plug/far2l/pluginmanager.py | 4 | ||||
-rw-r--r-- | python/configs/plug/plugins/.vscode/launch.json | 28 | ||||
-rw-r--r-- | python/configs/plug/plugins/ucharmap.py | 3 | ||||
-rw-r--r-- | python/configs/plug/plugins/udebug.py | 19 |
4 files changed, 34 insertions, 20 deletions
diff --git a/python/configs/plug/far2l/pluginmanager.py b/python/configs/plug/far2l/pluginmanager.py index 0d14a070..54b5fd9e 100644 --- a/python/configs/plug/far2l/pluginmanager.py +++ b/python/configs/plug/far2l/pluginmanager.py @@ -41,8 +41,8 @@ from .plugin import PluginBase # py:load <python modulename> # py:unload <registered python module name> -from .far2lcffi import cffi, ffi -ffic = ffi.dlopen("c" if sys.platform != "darwin" else "libSystem.dylib") +from .far2lcffi import ffi +ffic = ffi.dlopen(None) class PluginManager: Info = None diff --git a/python/configs/plug/plugins/.vscode/launch.json b/python/configs/plug/plugins/.vscode/launch.json index f1f15142..3e2b5b1a 100644 --- a/python/configs/plug/plugins/.vscode/launch.json +++ b/python/configs/plug/plugins/.vscode/launch.json @@ -5,10 +5,18 @@ "name": "Python Attach", "type": "python", "request": "attach", - "localRoot": "${workspaceRoot}", - "remoteRoot": "${workspaceRoot}", - "port": 5678, - "host": "localhost" + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "${workspaceFolder}" + } + ], + "connect": { + "port": 5678, + "host": "localhost" + }, + //"console": "integratedTerminal", + "console": "externalTerminal", }, { "name": "FAR2L", @@ -16,18 +24,16 @@ "request": "launch", "program": "/devel/bin/farg/far2l", "stopAtEntry": true, - "args": [ - ], + "args": [], "cwd": "/tmp", - "environment": [ - ], + "environment": [], "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true } ] } diff --git a/python/configs/plug/plugins/ucharmap.py b/python/configs/plug/plugins/ucharmap.py index bf2d3323..ee61903e 100644 --- a/python/configs/plug/plugins/ucharmap.py +++ b/python/configs/plug/plugins/ucharmap.py @@ -22,6 +22,9 @@ class Plugin(PluginBase): self.info.SendDlgMessage(hDlg, self.ffic.DM_ENABLEREDRAW, 1, 0) def OpenPlugin(self, OpenFrom): + if 0: + import debugpy + debugpy.breakpoint() symbols = [] for i in range(256): symbols.append(chr(i)) diff --git a/python/configs/plug/plugins/udebug.py b/python/configs/plug/plugins/udebug.py index 052f2f16..907c1163 100644 --- a/python/configs/plug/plugins/udebug.py +++ b/python/configs/plug/plugins/udebug.py @@ -8,7 +8,7 @@ log = logging.getLogger(__name__) class Config: configured = False logto = '/tmp' - host = 'localhost' + host = '127.0.0.1' port = 5678 class Plugin(PluginBase): @@ -20,13 +20,18 @@ class Plugin(PluginBase): log.debug('udebug can be configured only once') return - Config.configured = True - debugpy.log_to(Config.logto) - # in vs code debuger select attach, port = 5678 - # commands in shell: - # py:debug-start - debugpy.listen((Config.host, Config.port)) + if not Config.configured: + Config.configured = True + debugpy.log_to(Config.logto) + # in vs code debuger select attach, port = 5678 + # commands in shell: + # py:debug + # elsewhere in python code: + # import debugpy + # debugpy.breakpoint() + debugpy.listen((Config.host, Config.port)) debugpy.wait_for_client() + #debugpy.breakpoint() def breakpoint(self): debugpy.breakpoint() |