ExecCommand (activity): Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
m (Undo revision 233385 by 83.65.35.99 (Talk))
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Cleanup}}

{{Status box
{{Status box
|icon=ExecCommand.svg
|icon=ExecCommand.svg
Line 8: Line 10:
|contributors=JT Olds
|contributors=JT Olds
}}
}}

'''This activity does not work with Update.1, due to the improved security policies Update.1 contains. This activity tries to launch other Linux processes, which seems to be disliked by the activity-sandboxing system. If anyone has any ideas on how to fix this, let me know. -JT'''


===Summary===
===Summary===
Line 16: Line 20:
===Packages===
===Packages===


You can find the current version at [http://jtolds.googlepages.com/ExecCommand.xo http://jtolds.googlepages.com/ExecCommand.xo]. This version starts a simple xdialog that requests for a command to run.
You can find the current version at [http://files.getdropbox.com/u/129990/googlepages/ExecCommand.xo http://files.getdropbox.com/u/129990/googlepages/ExecCommand.xo]. This version starts a simple xdialog that requests for a command to run.
Also, there is a modified version that just starts XMMS. [http://jtolds.googlepages.com/Xmms.xo http://jtolds.googlepages.com/Xmms.xo]
Also, there is a modified version that just starts XMMS. [http://files.getdropbox.com/u/129990/googlepages/Xmms.xo http://files.getdropbox.com/u/129990/googlepages/Xmms.xo]


===Justification for implementation===
===Justification for implementation===
Line 73: Line 77:


[[Category:Developers]] [[Category:Software development]]
[[Category:Developers]] [[Category:Software development]]
{{Activity page
|icon=Image:ExecCommand.svg
|genre=Other
|short description=This utility is targeted at experienced Linux/Unix users who hope to feel more at home with the XO. On launch, this activity either launches a predefined Unix command (you have to edit the script contained in the activity), or starts an graphical dialog and queries the user for what command to run. Useful for starting vncviewer or xmms.
|contact person=Unknown
|devel status=4. Beta
}}
{{Activity bundle
|bundle URL=http://files.getdropbox.com/u/129990/googlepages/ExecCommand.xo
|activity version=1
|releases=7.1.2 (656)
|devel status=4. Beta
}}

Latest revision as of 02:21, 1 May 2011


ExecCommand
ExecCommand.svg
Status: beta
Version: 1
Base: No
Source: unknown
l10n: missing
Contributors
JT Olds

This activity does not work with Update.1, due to the improved security policies Update.1 contains. This activity tries to launch other Linux processes, which seems to be disliked by the activity-sandboxing system. If anyone has any ideas on how to fix this, let me know. -JT

Summary

This utility is targeted at experienced Linux/Unix users who hope to feel more at home with the XO. On launch, this activity either launches a predefined Unix command (you have to edit the script contained in the activity), or starts an graphical dialog and queries the user for what command to run. Useful for starting vncviewer or xmms.

Packages

You can find the current version at http://files.getdropbox.com/u/129990/googlepages/ExecCommand.xo. This version starts a simple xdialog that requests for a command to run. Also, there is a modified version that just starts XMMS. http://files.getdropbox.com/u/129990/googlepages/Xmms.xo

Justification for implementation

Looking through the Sugarizing page, it seems fairly clear that getting an Activity to simply start a non-activity application cleanly is non-trivial. Many attempts end up leaving a "loading" icon for the activity, or have multiple icons displayed as running activities, or other things.

Native X applications on the XO simply show as a little circle icon, but a lot of work has gone into customizing this behavior for specific X applications.

Personally, I couldn't care less what the icon looks like in the running activities disc, just so long as I can easily start my desired app.

I realized a simple solution would be to create an Activity that simply starts, forks a new app in the process, and then closes itself, cleaning up all of the Activity mess left behind from a rapid exit.

Bugs

The previous justification might be pretty poor considering it still doesn't work sometimes. It seems it works the least when the processor is under a heavier load. It makes me think that my method is working due to some side effect that isn't being noticed by Sugar when the processor has too much to do.

Implementation

import os
# get the exec script started right away.
os.system("bin/exec-script.sh &")

from sugar.activity import activity

class ExecActivity(activity.Activity):

   def __init__(self, handle):
       activity.Activity.__init__(self, handle)

       self.set_title('Executing...')

       # this strategy doesn't seem to work if there's no toolbox
       toolbox = activity.ActivityToolbox(self)
       self.set_toolbox(toolbox)
       toolbox.show()

       # close, removing the unuseful icon from the activities disc
       activity.Activity.close(self)

In retrospect, os.fork/execv would have been a better choice than os.system.

Testing

This activity was written and tested on a G1G1 laptop, build 656.

Contributing

This project really isn't big enough to warrant a full GIT or source-control setup. If you have a suggestion, or know of a way of making this system better (i.e., if it's possible to bypass the whole activity thing and still not have dangling activity icons), please let me know and I'll update the package. To contact the author, please visit http://jtolds.com/contact/

Use Cases

ExecCommand is successfully being used on XO laptops in NYC to help with manual network configuration. Check it out

Activity Summary

Icon: Sugar icon::Image:ExecCommand.svg
Genre: Activity genre::Other
Activity group: ,|x|Activity group::x}}
Short description: [[Short description::This utility is targeted at experienced Linux/Unix users who hope to feel more at home with the XO. On launch, this activity either launches a predefined Unix command (you have to edit the script contained in the activity), or starts an graphical dialog and queries the user for what command to run. Useful for starting vncviewer or xmms.]]
Description:
Maintainers: ,|x|Contact person::x}}
Repository URL:
Available languages: ,|x|Available languages::x}}
Available languages (codes): ,|x|Language code::x}}
Pootle URL:
Related projects: Related projects,|x|Related projects::x}}
Contributors: ,|x|Team member::x}}
URL from which to download the latest .xo bundle Activity bundle::
Last tested version number:
The releases with which this version of the activity has been tested. ,|x|Software release::x}}
Development status: Devel status::4. Beta
Ready for testing (development has progressed to the point where testers should try it out): ,|x|Ready for testing::x}}
smoke tested :
test plan available :
test plan executed :
developer response to testing :


URL from which to download the last .xo bundle that works with old releases Activity bundle::http://files.getdropbox.com/u/129990/googlepages/ExecCommand.xo
Activity version number: Activity version::1
The releases with which this version of the activity has been tested. ,|x|Software release::x}}
Development status: Devel status::4. Beta