A python program, "py2flexgui.py," sits between Notepad++ and FlexGui.
I am not going to go over Notepad++ features... they are fantastic. If you haven't thought about Notepad++ for a while, take a look. Color coding, Code Folding, multiple windows open side by side etc. etc.
I previously created a program, "py2pnut," to do the same using PNut. I have made some improvements and you can find both programs attached. I have a dual P2 set-up. The plan is to use PNut to program one board and FlexGui for the other. With Notepad++, I can have both programs open side by side and edit them interactively and then run them using two hotkey's
In order to use it you have to:
1. Go into the code and at the beginning will you see three directory paths to Notepad++, flexgui.exe, and the program you are going to work on. Most importantly, you have to pick which P2 file you want to work on and put that directory path.
2. Next open up Command Prompt... then go back to File Explorer and drag the python executable over onto the Command Prompt. Hit the space bar. Now go to where you put py2FlexGui.py and drag that over and drop it on Command Prompt.
Copy the line... but only the text after the ">".
3. Open Notepad++ and you will find a menu called "RUN". Select the first menu item "Run..." A dialog will open.
Type ctrl-v. Then push the "Run" button. What should happen is that your program should load into NotePad++. FlexGui should open and run your program and then exit.
4. Create the hotkey. With the Run dialog still open. Hit the save button. Now, you do three things... enter a name for your command. I just use py2FlexGUI. Choose a key combination as you "hotkeys" I use "Shift" and "F5" since they aren't used by default. Close it all up and you should be good to go.
Getting the hotkey registered is the fiddliest part and I frequently get it wrong.
1. I'm using 2.7. I suspect this doesn't work in other versions. No problem. Just install 2.7 and set the path to THAT python.exe.
2. Modules: you have to import them so that means you have to download them unless you already have:
from os import system
from pywinauto.findwindows import find_window
from pywinauto.win32functions import SetForegroundWindow
IF YOU DON"T KNOW HOW TO IMPORT MODULES:
Download JetBrains PyCharm Community Edition... you will have to google it:)
This is a complete Python working environment and at the time I was looking it seemed like the most complete and easy to use.
Play with PyCharm until you are comfortable.
Remember... if you change any of the working directories used in the program...you have to delete your hotkey and redo it.
With both py2flexgui.py and py2pnut.py any changes saved in either FlexGui or PNut are automatically updated by NotePad++
OOOh one last thing
In FlexGUI there is a "Commands" menu. The last item is "Configure Commands" You have to have the option set to p2b.
Attached is a simple script just to make sure everything is working... it lights up pin #56
Your hotkey should be created for py2upy.py as above. py2upy.py is attached below. The sample program is "blinker.py" also attached.
This works a little differently. Whatever file you have open as active in Notepad++ will be run. All editing is done in Notepad++.
To work, start FlexGUI, from the "Specials" menu select "Run Micropython on P2" Now go into NotePad++ program your hotkey and open the file "blinker.py"
py2upy.py will close the FlexGui editor but leave the Propeller Output window for MicroPython to use. Hit your hotkey and you should see a couple of blinks on pin #56
After MicroPython gets started, you will be returned to Notepad++. Rinse and repeat.