A tool to teach kids that sharing is a good thing.
Go to file
2021-10-13 19:40:44 +02:00
getprojectlist.py recovers this old project 2021-10-13 19:40:44 +02:00
logo.png recovers this old project 2021-10-13 19:40:44 +02:00
manage.py recovers this old project 2021-10-13 19:40:44 +02:00
README.txt recovers this old project 2021-10-13 19:40:44 +02:00
tuxpnt.project.sh recovers this old project 2021-10-13 19:40:44 +02:00
xmlrpc.server.py recovers this old project 2021-10-13 19:40:44 +02:00

Note: This code is old. ~ 2005.


My kids' school uses gnu/linux in the classrooms.
The teachers want the children to learn that sharing is not a bad thing.
Tuxpaint is cool.
Tuxpaint-config has an option that causes drawings to be saved as a new drawing.
When teachers encourage students to build upon existing drawings, each drawing
becomes a 'fork' and art evolves in many directions.

-Projects are a way of grouping drawings together under the same theme or subject.
-Teachers can create and delete projects.
-Teachers can copy, move and delete drawings within the projects.
-All projects are available to all students.
-All students can create new drawings.
-All students can open any drawing and build upon it.
-Students cannot modify or delete drawings.
-Students cannot create or delete projects.

These scripts rely on tuxpaint's 'save as new' option. It must be set in the tuxpaint configuration.
If it is not set, modifications to any drawing will simply not be saved.

Drawings are saved on a samba server. Projects are, in reality, samba shares.
There are only use two users, 'teacher' and 'student' on the samba server.
Teachers create and delete projects (via web).
Students easily join projects via a Zentiy dialog. (mount.cifs ~/.tuxpaint/saved)

The fact that all students access the projects using the same username
means a malicious student could fill projects with rubbish.
However, we wanted to at least try an open environment based on trust and respect.
Projects are available to children of the same class, the same age, school wide, etc.

-Installation on the server
-Installation on the client

1. Students' computers
-A GNU/Linux operating system.
-Tuxpaint ;)
-Zenity. Comes with Gnome, Xfce. If you're using KDE you may need to install it.
-Python and xmlrpclib. Test you have it installed like this.

$ python
>>> import xmlrpclib

2. A network. PC's that run tuxpaint need to be on the LAN.

3. A server.
-It doesn't need to be a new machine.
-It must have a static IP.

4. You might consider a backup system (it would be terrible to loose all those drawings)

Installation on the server

These are Debian orientated instructions.
Do a minimal installation and then..

--Create user accounts.
Only two users are used. A generic user used by all teachers,
and a generic user used by all students.
If you choose different usernames you will have to adjusts the configuration(easy to do).

adduser --shell /bin/false teacher
adduser --shell /bin/false student

--Install Samba.

apt-get install samba

Create the base share directory where all projects will be saved.

mkdir /shares

Samba will import the users 'teacher' and 'student'.
If you wish to change the passwords.

smbpasswd teacher
smbpasswd student

Note: You may wish to remove [homes] and other things in /etc/samba/smb.conf

--Install Apache.

apt-get install apache

cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default.orig

Now edit /etc/apache2/sites-available/default (you can copy/paste the example below).
and restart apache.

If you are not using Debian, you may need to modify the cgi-bin path.
If you have chosen a username different than 'teacher', you must change the line:
'require user teacher'

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        Redirect /index.html /cgi-bin/manage.py
        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                <Files manage.py>
                        AuthType Basic
                        AuthUserFile  /usr/local/apache2/passwords
                        AuthName "Enter in Tuxpaint Management"
                        ##### Change user name if not using 'teacher' ####
                        require user teacher
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        ErrorLog /var/log/apache2/error.log
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined
    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128

---The project management page is password protected.
Create the htaccess password file with the teacher's username and password.

mkdir /usr/local/apache2
htpasswd -c /usr/local/apache2/passwords teacher

---Create a directory to ease installation at the client.

mkdir /var/www/download
cp tuxpnt_project.sh getprojectlist.py /var/www/download

Now edit the two files..
changing the first few lines to fit your configuration.

---Create a directory for the logo

mkdir /var/www/images
cp logo.png /var/www/images

---Install xmlrpc server.
cp xmlrpc.server.py /usr/local/bin/
chmod u+x /usr/local/bin/xmlrpc.server.py

Edit usr/local/bin/xmlrpc.server.py and change the first
few lines to fit your configuration.

Automatically start the xmlrpc server when the server boots.
In Debian, you can paste this line into /etc/rc.local

/usr/bin/nohup /usr/local/bin/xmlrpc.server.py  </dev/null >&/dev/null &

Now start the xmlrcp server


---Install manage.py.
The script manage.py belongs in the cgi-bin directory defined in the
default apache site config file.

cp manage.py /usr/lib/cgi-bin/
chown www-data.root /usr/lib/cgi-bin/manage.py
chmod go-rwx /usr/lib/cgi-bin/manage.py
chmod u+x /usr/lib/cgi-bin/manage.py

Edit /usr/lib/cgi-bin/manage.py and change the first
few lines to fit your configuration.

Installation on the client

--Install the scripts
Open a web browser and download the two scripts

Then move them.
mv tuxpnt.project.sh getprojectlist.py /usr/local/bin
chmod a+x /usr/local/bin/tuxpnt.project.sh

The client PC needs to mount and umount samba shares.
Open a terminal and identify a group with the command:


Let's say you choose the group 'cdrom'.
Now (as root) add a line to this end of the sudo file

%cdrom ALL = NOPASSWD: /sbin/mount.cifs, /sbin/umount.cifs

--set some permissions
chmod u+s /sbin/*cifs

--Create a launcher.
The students need to run /usr/local/bin/tuxpnt_project.sh
Create a launcher that makes it easy for them.

--Creating projects
Only the teacher can create and delete projects.

1. Open a web browser and go to http://your_tuxpnt_server_ip/
2. Enter the teacher username and password.
3. Create a project

--Using the project.
Students can now select the project.

1. Students run /usr/local/bin/tuxpnt_project.sh (launcher makes this easy).
2. Select a project
3. Open Tuxpaint (if not already open)

All drawings are saved on the samba share.
Students can change from one project to another at any time by
running the tuxpnt_project.sh script.

--Manipulating projects and project content.
Teachers can browse the shares from Nautilus.
Hint: The 'Connect to Server' option is helpful.

Students cannot delete either drawings or projects.

A teacher can delete an _empty_ project via the web inteface.
The teacher can copy, move, and delete drawings from a project by
browsing the shares from Nautilus.

I live in Barcelona, Spain.

The scripts in this tar are licensed under the GPL3 or later.

Good luck!