*

Welcome, Guest. Please login or register.
Did you miss your activation email?

Check out the new and improved 2010 Xtra Ordinary OS for the XO laptop!
Pages: [1]
Print
Author Topic: TuxPaint and the Camera  (Read 4140 times)

TuxPaint and the Camera

xojimox
Commenter

Posts: 14



May 31, 2008, 06:38:18 PM

My child wanted to be able to draw on pictures that she took with her XO's camera, using TuxPaint instead of the Paint activity.

I couldn't find a simple way to do this, but I did come up with this python script to grab the most recent entries from the Journal and copy them to TuxPaint's saved images folder.

The process goes like this:

1. Use the Record activity to take a picture. Use the "Keep" button to save it in the journal. Quit Record.
2. Open up Terminal and run the script. I have this script aliased to a command in my .bashrc file, just to make things easier. Ignore any error messages.
3. Open TuxPaint and click the "Open" button. Your most recent PNG files from the Journal should be in the saved directory.

Here's the python script:

Code:
import os

def copyJournalEntries():
datastore = '~/.sugar/default/datastore/store/'
cmd = 'ls -t '+datastore+' | head | tail -n 8'
dataList = os.popen(cmd).readlines()
for i in range(len(dataList)):
item = dataList[i].strip('\n')
targetName = "tuxTemp_"+str(i)+".png"
cmd='cp '+datastore+item+' ~/.sugar/default/org.tuxpaint.sugar-is-lame/data/.tuxpaint/saved/'+targetName
os.popen(cmd)



copyJournalEntries()

This copies the most recent eight items from the Journal into the TuxPaint folder and renames them as PNG files. TuxPaint then filters out the files it can't recognize, and what remains is your camera images.

I'm not much of a programmer, and I have no idea how to navigate the byzantine levels of the Journal structure, but this seems to work pretty well for me.
Logged
Pages: [1]
Print
Jump to:  

Welcome, Guest. Please login or register.
Did you miss your activation email?
February 08, 2010, 10:28:52 PM

Login with username, password and session length
Recent Topics
[February 06, 2010, 08:21:34 PM]

[February 06, 2010, 01:30:32 PM]

[February 06, 2010, 04:14:13 AM]

[February 05, 2010, 05:14:11 PM]

[February 05, 2010, 02:35:40 PM]

[February 04, 2010, 07:21:32 PM]

[February 04, 2010, 01:50:58 PM]

[February 02, 2010, 07:37:01 PM]

[February 02, 2010, 12:28:12 PM]

[February 02, 2010, 10:55:23 AM]
Members
Total Members: 4128
Latest: divinegrace29
Stats
Total Posts: 30200
Total Topics: 3647
Online Today: 82
Online Ever: 220
(February 05, 2009, 11:29:32 AM)
Users Online
Users: 0
Guests: 54
Total: 54