Line 1: |
Line 1: |
| + | <noinclude>{{ GoogleTrans-en | es =show | bg =show | zh-CN =show | zh-TW =show | hr =show | cs =show | da =show | nl =show | fi =show | fr =show | de =show | el =show | hi =show | it =show | ja =show | ko =show | no =show | pl =show | pt =show | ro =show | ru =show | sv =show }}{{TOCright}} |
| ==Goal== | | ==Goal== |
− | To describe a new Sugar bundle which supports equally Activity software and prepared Content. | + | To describe a new Sugar bundle which supports equally Activity software and prepared Content. |
| + | |
| + | To describe the changes to Sugar and activities required to support such a bundle. |
| | | |
| ==Problems Addressed== | | ==Problems Addressed== |
Line 75: |
Line 78: |
| exec sugar-etext-activity [options] <etext_file> | | exec sugar-etext-activity [options] <etext_file> |
| | | |
− | ===EToys Content Viewer=== | + | ===Etoys Content Viewer=== |
− | The Sugar EToys Content Viewer is packaged as sugar-etoys-content-viewer. Package dependences are not known at this time. | + | The Sugar Etoys Content Viewer is packaged as sugar-etoys-content-viewer. Package dependences are not known at this time. |
| | | |
| The purpose of having a separate content viewer for Etoys is that the content viewer wrapper script launches Etoys in a mode which bypasses the home screen, and seamlessly launches into the Etoys content. [http://activities.sugarlabs.org/en-US/sugar/addon/4054 FreeCell] is an example of this idea. | | The purpose of having a separate content viewer for Etoys is that the content viewer wrapper script launches Etoys in a mode which bypasses the home screen, and seamlessly launches into the Etoys content. [http://activities.sugarlabs.org/en-US/sugar/addon/4054 FreeCell] is an example of this idea. |
| | | |
− | This package contains some of the source code to the EToys activity, plus the sugar-etoys-activity launcher script. | + | This package contains some of the source code to the Etoys activity, plus the sugar-etoys-activity launcher script. |
| | | |
− | EToys-based Unified content bundles are made up of a Squeak VM. The activity.info file contains the line:
| + | Etoys-based Unified content bundles are made up of a Squeak script or Etoys project. The activity.info file contains the line: |
| | | |
− | exec sugar-etoys-activity [options] <squeak_vm_file> | + | exec sugar-etoys-activity [options] <squeak_file> |
| | | |
| ==Content Viewer implementation== | | ==Content Viewer implementation== |
| Content Viewers require very small changes to Sugar. This is because they are really a special case of Activities. | | Content Viewers require very small changes to Sugar. This is because they are really a special case of Activities. |
| | | |
− | Content viewers are distributed as distro packages. Their activity files are installed into /usr/share/sugar/activities. Their wrapper scripts are installed into /usr/bin. Their activity.info files include a new line "hidden=true" which prevents them from being visible in any of the Home views, which prevents them from being launched directly by the user. | + | Content viewers are distributed as distro packages. Their activity class files are installed into /usr/share/sugar/activities. Their wrapper scripts are installed into /usr/bin. Their activity.info files include a new line "hidden=true" which prevents them from being visible in any of the Home views, which prevents them from being launched directly by the user. |
| | | |
| ==Content Viewers and MIME Types== | | ==Content Viewers and MIME Types== |
− | Tthe content viewer activities will be registered as MIME type handlers for their respective types.
| + | Content viewer "base" activities installed in /usr/share/sugar/activities will be registered as the primary MIME type handlers for their respective types. |
| | | |
| So, when a .html file is opened from the Journal, the sugar-web-content-viewer activity will be launched and a Journal entry will be recorded as "Web Content". | | So, when a .html file is opened from the Journal, the sugar-web-content-viewer activity will be launched and a Journal entry will be recorded as "Web Content". |
| | | |
| ==Content Viewer based Activities== | | ==Content Viewer based Activities== |
− | One advantage of Sugar providing the content viewers versus packaging them as individual activities is that they can be extended by developers to create new activities.
| + | Making Sugar provide the content viewers instead of releasing them as individual activities is that they can be extended by developers to create new activities. |
| | | |
| For example, the WikiBrowse activity is based on the Browse classes. If Browse, is not installed, WikiBrowse cannot launch. With the source code to Browse part of Sugar, web-based activities can be built on top of the Content Viewer classes and extended with additional Python code such as a custom server or PyXPCom code. | | For example, the WikiBrowse activity is based on the Browse classes. If Browse, is not installed, WikiBrowse cannot launch. With the source code to Browse part of Sugar, web-based activities can be built on top of the Content Viewer classes and extended with additional Python code such as a custom server or PyXPCom code. |
| | | |
− | Or, a Flash developer can develop a game in Flash but use Python to manage the toolbars. They would package their Python code and SWF file in a Unified bundle, and reference the sugar-swf-activity classes from their Python code.
| + | As another example, the Gmail activity is a customized copy of an older (now broken) version of the Browse source code. With the content viewer source available, this would no longer be needed. |
| + | |
| + | With the SWF content viewer to base on, a Flash developer can develop a game in Flash but use Python to add toolbars and GTK widgets. They would package their Python code and SWF file in a Unified bundle, and subclass the sugar-swf-activity classes in their Python code. |
| | | |
− | ==Sugar changes== | + | ==Implementation== |
| The primary change to Sugar is that it should gracefully handle failure to find the program specified by the 'exec' line in activity.info, displaying a friendly error message on the launcher screen to the effect of "You do not have the required software to view this content.". | | The primary change to Sugar is that it should gracefully handle failure to find the program specified by the 'exec' line in activity.info, displaying a friendly error message on the launcher screen to the effect of "You do not have the required software to view this content.". |
| | | |
| There is also the new hidden=true line in activity.info to prevent Content Viewers from appearing in the Home view. | | There is also the new hidden=true line in activity.info to prevent Content Viewers from appearing in the Home view. |
| + | |
| + | Most of the work is in converting existing activities to Content Viewer packages, packaging them and writing the sugar-xxx-activity wrapper scripts. Fortunately, this work can be done one content viewer at a time and the old and new systems can coexist. |
| + | |
| + | For example, you can have Read and sugar-pdf-content-viewer installed simultaneously. The user will be allowed to open a PDF file with either, and sugar-pdf-content-viewer will only come into play when a Unified bundle is opened. |