Opened 13 years ago

Closed 13 years ago

#2475 closed enhancement (fixed)

Integrate Python code block with Turtle Art

Reported by: tonyforster Owned by: walter
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Turtleart Version: Unspecified
Severity: Unspecified Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: Unconfirmed


At the moment a project is split between two files, a *.ta and a *.py, two activities must be launched to edit the project and there can only be one py block in a project.

What I propose is that the py code be saved within the *.ta file and that Turtle Art include a text editor. The text editor launches when a python block is clicked. Multiple py blocks can be included in a ta program.

It could be done that way, but I would prefer that people edit
their python in a python environment, but the problem with the current process is that there is no way to test your python code in Pippy, because the TA modules aren't available. Your proposal would address that issue.

Change History (4)

comment:1 follow-up: Changed 13 years ago by tonyforster

"I would prefer that people edit their python in a python environment"

Pippy features:

  • keywords are coloured
  • examples
  • run button
  • results window rather than log
  • keep a copy (as pippy journal entry)
  • encourage transition to Pippy
  • no undo
  • more?

keyword colours is good, examples would be handy to see syntax examples if there was an undo, run would be meaningless in most cases because you are not writing stand alone code same with results window, keep would be handy.

comment:2 in reply to: ↑ 1 Changed 13 years ago by tonyforster

Replying to tonyforster:
run would be meaningless in most cases because you are not writing stand alone code

I retract that comment, not thought through.

How might run work? Switch the view to the canvas, execute the code, then switch view to the code editor, close button returns you to the canvas. If there were following docked blocks you might continue execution, viewing the canvas.

The code editor might have the following features: undo, immediate mode in bottom pane, tabbed upper pane so you can view samples and execute code fragments. All things that would be good added to Pippy.

Would print and error messages appear in the bottom pane, Log or both?

comment:3 Changed 13 years ago by walter

Another consideration is security. Regardless of whether or not you edit Python within TA I am a bit uncomfortable with the Python code being buried inside the project, because it will allow the opaque distribution of malware. At present, you have to deliberately load the Python code into your project, which provides at least one opportunity for review before running the code. (In fact, if we do add the edit function, we can make the review process explicit.)

I do share the concern about being needlessly restricted to one Python module per project. The current work around, which is overly complex, is to dispatch to different blocks of code depending upon the arguments passed to the block. There is no reason not to have each block load its own code.

comment:4 Changed 13 years ago by walter

  • Resolution set to fixed
  • Status changed from new to closed

Given the new way that Python code is handled--imported from the file system as individual modules per block--I think we can close this one.

Note: See TracTickets for help on using tickets.