Textedit Activity

From OLPC
Revision as of 00:49, 31 March 2008 by Tony37 (talk | contribs) (New page: The Textedit activity - Image:TexteditActivity-1.xo - is a simple text editor to support program debugging and development on the Xo. It is a temporary solution since Textedit allows a...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Textedit activity - File:TexteditActivity-1.xo - is a simple text editor to support program debugging and development on the Xo. It is a temporary solution since Textedit allows access to files within other activities. The activity consists of a simple wrapper for gtksourceview2.

Pre-installed activities are located on the Xo in /usr/share/activities. Other activities are found in /home/olpc/Activities. When the activity is started the 'bundle' tab on the toolbar defaults to the the Textedit activity folder (/home/olpc/textedit.activity). An entry is provided to allow the user to enter the path to the activity that he is working on (bundle path). Enter the activity path (e.g. /home/olpc/my.activity) and hit enter. The 'file' tab is used to enter the file name to be edited. It defaults to 'new.txt'. Enter the file name to be edited (e.g. myactivity.py) and hit enter. The label to the left shows the current path and file name. The 'open' button opens the file. If the file doesn't exist, the text buffer will be cleared; otherwise, the content of the file will be loaded into the buffer. The 'save' button writes the content of the buffer to the file specified in the label.

In summary:

1. The 'new' file function consists of using the toolbar 'bundle' tab to set the bundle_path (e.g. /home/olpc/my.activity), using the 'file' tab to set the file name, check the label in the toolbar 'file' tab to see that the path and filename are set correctly. (Enter must be pressed to record the change in the bundle path or file name). Finally, The 'open' button clears the buffer.

2. The 'open' file function consists of checking the label in the 'file' tab to make sure the right file is specified and then pressing the 'open' button. The contents of the file will be loaded into the edit buffer.

3. The 'save' file function consists of checking the label in the 'file' tab to make sure the right file is specified and then pressing the 'save' button. The contents of the edit buffer will be written to the file.

4. The 'save as' file function consists of changing the file name (using the entry in the 'file' tab) and, possibly, changing the bundle path in the 'bundle' tab. After checking that the right file is specified, hit 'save' to copy the contents of the edit buffer to the file.

Currently, the edit buffer is set for plain text and no highlighting.

This activity is used in a cross-platform development scenario in which the activity is written and tested on an Ubuntu system, copied to a usb stick, and then copied to /home/olpc/Activities on the Xo. The log view activity is used for debugging (esp. to check the output of print statements in the code and tracebacks). When the activity doesn't start (reports 'starting' for a long time), the log viewer can show the reason for the failure.