Editing Python Code not persistent

  • Found this thread from 3 months ago. Re: python back to blocks not working

    The problem (for me) is that I see why Blocky is nice: no syntax errors, and it's usable to teach simple programming. Also I like the general UIFlow interface. Very approachable.

    Looking at the Python code is neat. However if you edit it and you click back to the Blocky code, all your Python changes are gone. Saving your code saves the Blocky code only.
    You can send the Python code to the M5Stack unit though and it's correctly executed.

    Basically the Python code is unsavable and very easy to wipe out by looking at the Blocky page.

    This is not expected behavior and it leads to a confused user.

    Possible fixes in order I'd prefer:

    • Adjust Blocky code according to Python code. Haha! Joking. For simple stuff this might be ok, but have fun converting classes and lambdas into Blocky...
    • Remove the Blocky button or disable it once the Python code is modified. Saving then saves the Python code (not the Blocky one)
    • Warn me about "Your changes in Python will be wiped out. Do you want to proceed?" when clicking on the Block button.


  • @hkubota What I'd prefer is to keep track of the changes in the code and that they appear in a different color. A text file with the changes to be applied can be saved together with the blocks code. Then you have a button to either apply the changes, so they appear in the python code in a different color and numbered so you can verify that all of them are in place, or you can choose to remove them to see the blocks code translated to Python for debugging purposes. Does it make sense?

    Best regards / Fernando

  • Sounds great, we will try to improve this feature

  • @f3rn4nd0d @hkubota
    I'm not sure if you know this but you can log into the M5stack via USB and directly write micropython code using the REPL functions.

  • @ajb2k3 Yes, I knew about it. But I think that @hkubota was after is a little different. Maybe to have a way to start designing the ui of the app in UIFlow and then add specific functions in python editor. At least this is what I'm doing. So it would be good to be able to save the blocks and the code separately, and then you can either apply the changes (like a file diff) or not.

    Thanks for your help @ajb2k3!