Textedit Activity

From OLPC

Revision as of 13:12, 8 June 2008 by 88.75.69.190 (Talk)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Important note

Textedit does not work with newer builds (e.g. 703) which use rainbow


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.

Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
Projects
OLPC wiki
Toolbox