Hello, and thanks for the visit. Sorry for the confusion, but I think you see complications where there aren't any.
The only file you need is pye.py. It contains the full code of the text editor based on pfalcons Edit widgets. You can run pye.py on any platforn with python3 and a vt100/xterm console, like linux or OS X like any other text editor (e.g. nano, gedit). You would simple issue the command:
Micropython works too, if you install micropython-lib (https://github.com/micropython/micropython-lib
). pye.py runs on pyboard too. A command sequence would be:
Code: Select all
from pye install *
pye("filename") or pye(list_of_strings)
The file pye.py contains special sections to deal with the I/O interfaces of linux, PyBoard and WiPy. To separate them, they start with:
or the like. Without that, python would raise an error, when the code is executed on the other platforms. The file pye.py contains C-Preprocessor statements, which allow variants of the file for specific platforms, like.
Code: Select all
cpp -D LINUX pye.py | grep -v "^# .*$" >pex.py
cpp -D PYBOARD pye.py | grep -v "^# .*$" >peb.py
cpp -D BASIC -D WIPY -D DEFINES pye.py | sed "s/#.*$//" | sed "/^$/d" >wipye.py
The removes the sections for the other platforms, but still keep the "if sys.platform == ..." statements, which do not hurt. The last example is mandatory for WiPy due its restricted memory size. WiPy would not parse the full pye.py code. The -D DEFINES replaces the symbolic key names by numeric constants, and the -D BASIC excludes some of the features. I have seen other ways to achieve that, but for me it works. The shebang file consist of a single line as the first line in the python script:
which tells the linux bash or csh to use python3 to run pye.py. It's not included by default since cpp cannot deall with it.