Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Starting And Customizing s2aio for Snap

Alan Yorinks edited this page Mar 21, 2018 · 1 revision

Starting s2aio

From a command or terminal window, simply type: s2aio

This will start Snap! and load the Snap! editor into your browser from the Internet URL.

To import a Snap! specific project for the desired language, in a terminal or command window type:

s2aio -v

Using the Python path returned, The Snap! project files are found in the Snap!Files directory. To go into that directory, type:

cd Snap*

to avoid having to escape the ! in the name.

Command Line Options

You can affect the start up behavior of s2aio by using its command line options:

usage: s2aio [-h] [-c CLIENT] [-l LANGUAGE] [-p COMPORT] [-b BASE_PATH] [-v]

optional arguments:
  -h, --help    show this help message and exit
  -c CLIENT     default = scratch [scratch | snap | no_client]
  -l LANGUAGE   1=English(default) 2=Chinese(zh-CN) 3=Chinese(zh-TW)
                4=Dutch(NL) 5=French(FR) 6=German(DE) 7=Greek(GR) 8=Korean(KO)
                9=Italian(IT) 10=Portuguese(PT) 11=Spanish(ES)
  -p COMPORT    Arduino COM port - e.g. /dev/ttyACMO or COM3
  -b BASE_PATH  Python File Path - e.g. /usr/local/lib/python3.5/dist-
                packages/s2aio
  -v            Print version and Python path

CLIENT OPTION

The default client is Scratch. If you wish to launch Snap! on your internet browser, use the -c snap option. For more information on using Snap!, see Starting s2aio for Snap! If you want to launch a client manually, select the no_client option.

Note: The Scratch client option will auto detect when the Scratch editor is closed. Within 2 seconds, s2aio will close as well. If you select no_client, this feature is disabled.

LANGUAGE OPTION

The language option is only functional when using Scratch. Language blocks for Snap! must be loaded or imported manually.

COMPORT OPTION

The program will automatically detect the Arduino COM PORT. If you wish to explicitly use a different COM PORT, use this option. So for example, to start s2aio for COM23, you would type:

s2aio -p COM23

BASE_PATH OPTION

The program automatically determines where the s2aio library files were installed during the pip installation. If you wish to explicitly change the path to these files, you may use this option. Example:

s2aio -b /usr/local/lib/python3.5/dist-packages/s2aio

VERSION OPTION

The -v option will print both the s2aio version number and the Python path to the s2aio library files.

~$ s2aio -v

s2aio version 1.4 - 16 Nov 2015
Python path = /usr/local/lib/python3.5/dist-packages/s2aio

Customizing s2aio Startup Behavior

The s2aio library contains a file called configuration.cfg that is located in the configuration directory of the library. Using the path shown above, the configuration file would be found in the /usr/local/lib/python3.5/dist-packages/s2aio/configuration directory. The path for your system may be different. Use the -v option to determine the path.

The s2aio library contains a file called configuration.cfg that is located in the configuration directory of the library.

Before making any changes to this file, it is strongly suggested that you make a backup copy of the file.

Changing The Snap! URL

By default, s2aio will load http://snap.berkeley.edu/snapsource/snap.html.

If you wish to load Snap! from a local copy of the editor, you can change the default URL by editing the snap_url option in the configuration.cfg file.