leoInteg status report

29 views
Skip to first unread message

Edward K. Ream

unread,
Jun 10, 2021, 1:53:39 PM6/10/21
to leo-editor
With ed5b6d66 in leoInteg master, and the latest code per PR #1971:

Stage 1

leoInteg worked for me, but only when I did the following:

1. Add <path to>leo-editor in my sitecustomize.py file.
2. Specify leobridgeserver.py (not leoserver.py) as the server.

Stage 2

1. I copied leobridgeserver.py to leo/core/leoserver.py and changed the leoInteg setting to point to leo/core/leoserver.py instead of leointeg/leobridgeserver.py.

2. I disabled the code in sitecustomize.py that added the leo-editor directory to sys.path.

3. I changed the imports at the start of leoserver.py so they are:

#! python3
# pylint: disable=wrong-import-position
import asyncio
import getopt
import json
import os.path
import sys
import time
import traceback
# Third-party.
import websockets
# #1970: Adjust sys.path so that the following imports will always work.
_leo_editor_path = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
if _leo_editor_path not in sys.path:
    sys.path.append(_leo_editor_path)
# Leo
import leo.core.leoBridge as leoBridge
import leo.core.leoNodes as leoNodes
from leo.core.leoGui import StringFindTabManager

This works!

Suggestions and conclusions

leoInteg should be able to find leo/core/leoserver.py given only the path to the leo-editor directory. The latest code in Leo's devel branch reports the path to leo-editor. So there should be no need for the user even to know that leoserver.py exists, and a single setting (the path to leo-editor) is probably the only path-related setting that should be needed.

The import code shown above should work without any additions whatever to the user's system path, or to python's path environment variable.

The code in leobridgeserver.py must eventually be copied to leoserver.py, with the additions shown above.

So this is good progress. I'll be playing with leoInteg over the next few days.

Edward

Félix

unread,
Jun 11, 2021, 12:22:32 AM6/11/21
to leo-editor
l'll make sure to put it into the leo-editor/leo/core/leoserver.py that i'm developping.

Thanks for this!! 

(I'll try to get something going in the felix-server branch by this weekend)

Thanks again for taking the time to make those tests and finding solutions to implement and make it smooth for people to start the server and connect to it easily 
--
Félix

Reply all
Reply to author
Forward
0 new messages