% Designed to be included by presentation.tex or handout.tex.

\usepackage[english,spanish]{babel}
\usepackage{ccicons}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{textcomp}
\usepackage{ifthen}

% TeX function that generates the language commands.
% See: http://en.wikibooks.org/wiki/LaTeX/Internationalization#Multilingual_versions
\def\localedef#1#2{
\ifthenelse{ \equal{\locale}{#1} }{
  \selectlanguage{#2}
  \expandafter\def\csname#1\endcsname ##1{##1}
  }{
  \expandafter\def\csname#1\endcsname ##1{}
  }
}

% Selected language. Can be placed anywhere before the language commands.
\providecommand\locale{es}

%% Language commands.
\localedef{es}{spanish}
\localedef{en}{english}

% Tango colours.
% Syntax highlighting colours from the Tango palette:
% http://pbunge.crimson.ch/2008/12/tango-syntax-highlighting/
\definecolor{LightButter}{rgb}{0.98,0.91,0.31}
\definecolor{LightOrange}{rgb}{0.98,0.68,0.24}
\definecolor{LightChocolate}{rgb}{0.91,0.72,0.43}
\definecolor{LightChameleon}{rgb}{0.54,0.88,0.20}
\definecolor{LightSkyBlue}{rgb}{0.45,0.62,0.81}
\definecolor{LightPlum}{rgb}{0.68,0.50,0.66}
\definecolor{LightScarletRed}{rgb}{0.93,0.16,0.16}
\definecolor{Butter}{rgb}{0.93,0.86,0.25}
\definecolor{Orange}{rgb}{0.96,0.47,0.00}
\definecolor{Chocolate}{rgb}{0.75,0.49,0.07}
\definecolor{Chameleon}{rgb}{0.45,0.82,0.09}
\definecolor{SkyBlue}{rgb}{0.20,0.39,0.64}
\definecolor{Plum}{rgb}{0.46,0.31,0.48}
\definecolor{ScarletRed}{rgb}{0.80,0.00,0.00}
\definecolor{DarkButter}{rgb}{0.77,0.62,0.00}
\definecolor{DarkOrange}{rgb}{0.80,0.36,0.00}
\definecolor{DarkChocolate}{rgb}{0.56,0.35,0.01}
\definecolor{DarkChameleon}{rgb}{0.30,0.60,0.02}
\definecolor{DarkSkyBlue}{rgb}{0.12,0.29,0.53}
\definecolor{DarkPlum}{rgb}{0.36,0.21,0.40}
\definecolor{DarkScarletRed}{rgb}{0.64,0.00,0.00}
\definecolor{Aluminium1}{rgb}{0.93,0.93,0.92}
\definecolor{Aluminium2}{rgb}{0.82,0.84,0.81}
\definecolor{Aluminium3}{rgb}{0.73,0.74,0.71}
\definecolor{Aluminium4}{rgb}{0.53,0.54,0.52}
\definecolor{Aluminium5}{rgb}{0.33,0.34,0.32}
\definecolor{Aluminium6}{rgb}{0.18,0.20,0.21}

% Listings setup. http://pbunge.crimson.ch/2008/12/tango-syntax-highlighting/
\lstset{numbers=none,breaklines=true}
\lstset{
    keywordstyle=[1]{\color{DarkSkyBlue}},
    keywordstyle=[2]{\color{DarkScarletRed}},
    keywordstyle=[3]{\bfseries},
    keywordstyle=[4]{\color{DarkPlum}},
    keywordstyle=[5]{\color{SkyBlue}},
    commentstyle={\color{Aluminium4}},
    stringstyle={\color{Chocolate}},
    basicstyle={\ttfamily},
}

% Document properties.
\title{\en{Introduction to Python}\es{Introducción a Python}}
\author{Philip Withnall}
\date{\en{August 2013}\es{agosto 2013}}


\begin{document}

\frame[plain]{
\maketitle
\hfill
\begin{center}\ccbysa\end{center}
}


\section{\en{Introduction}\es{Introducción}}

\en{Python is an interpreted programming language, and we're going to learn it
because most of Sugar is written in it, and it's one of the recommended ways to
develop new activities.}
\es{Python es un lenguaje de programación interpretado, y vamos a aprender
porque la mayoría de Sugar está escritorio en ella.}

\en{Python is well-supported; so if you encounter a problem you can't solve,
googling the error message is often helpful.}
\es{Hay mucho apoyo disponible para Python; así que si usted tiene un problema
que no puede resolvar, google el mensaje de error.}

\en{There are currently two versions of Python: Python 2 and Python 3. Python 3
is the future of Python, but many projects, including Sugar, still use Python 2;
so we will use Python 2. Python 3 is mostly the same, with a few important
differences.}
\es{Hay actualmente dos versiones de Python: Python 2 y Python 3. Python 3 es
el futuro de Python, pero muchos proyectos, Sugar incluido, aún utilizan
Python 2; así que aprenderemos Python 2. Python 3 es prácticamente el mismo,
con algunas diferencias importantes.}

\note{\en{Please ask questions throughout.}
      \es{Por favor, hacer preguntas durante.}}

\begin{frame}{Python}
\begin{itemize}
    \item{\en{Interpreted programming language}\es{Lenguaje de programación interpretado}}
    \item{\en{Used to write most of Sugar}\es{Utiliza para escribir la mayoría de Sugar}}
    \item{\en{Popular and well-supported}\es{Popular y hay mucho apoyo}}
    \item{\en{Two versions: Python 2 and Python 3}\es{Dos versiones: Python 2 y Python 3}}
\end{itemize}
\end{frame}


\section{\en{Course structure}\es{Estructura de capacitación}}

\en{The best way to learn a programming language is to practice with it and write a
lot of programs. Therefore the lecturing (and my poor Spanish) is kept to a
minimum, and exercises are available for you to complete in your own time.}
\es{La mejor manera que aprender un lenguaje de programación es practicar con
ella y escribir una gran cantidad de programas. Por lo tanto la docencia (y
mi mal español) se mantiene al mínimos y hay ejercicios para usted para
completar en su propio tiempo.}

\en{Teaching a programming language from scratch would normally take 16--32 hours in
a university, plus independent learning time. We don't have that much time, so
this training is compressed and many of the advanced features of Python have
been omitted. You are encouraged to learn about them yourselves once you're more
comfortable with the basics of Python.}
\es{La enseñanza de un lenguaje de programación desde cero toma normalmente 16
a 32 horas en una universidad, más el tiempo de aprendizaje autónomo. No tenemos
mucho tiempo, así que esta capacitación se comprime y muchas de las funciones
avanzadas de Python han sido omitido. Todos ustedes están animamos a aprender
acerca de ellos cuando están más cómodo con los conceptos básicos de Python.}

\en{There are some fantastic Python resources available online which you should
investigate in your spare time. The Spanish
``\href{http://docs.python.org.ar/tutorial/2/}{Tutorial de Python}''
from Argentina is good, as is \href{http://pythonmonk.com/}{Python Monk} (only
available in English though).}
\es{Hay algunos recursos fantásticos para Python disponibles en línea que
ustedes deben en su tiempo libre. El español
``\href{http://docs.python.org.ar/tutorial/2/}{Tutorial de Python}'' de
Argentina es bueno, al igual que \href{http://pythonmonk.com/}{Python Monk}
(sólo disponible en inglés).}

\begin{frame}{\en{Course structure}\es{Estructura de capacitación}}
\begin{itemize}
    \item{\en{A couple of hours' lectures}\es{Clases para un par de horas}}
    \item{\en{Exercises to complete in your own time}
          \es{Ejercicios para su propio tiempo}}
    \item{\en{More resources available}\es{Más recursos disponible}:\begin{itemize}
        \item{\url{http://docs.python.org.ar/tutorial/2/}}
        \item{\url{http://pythonmonk.com/}}
    \end{itemize}}
\end{itemize}
\end{frame}


\section{\en{Development environment}\es{Entorno de desarrollo}}

\en{While Python can run on Windows or Linux, Sugar activities can only be developed
on Linux, so we will use Linux. There are three options available: booting into
a Live USB image of Fedora, using a Fedora VM from Windows, or using VNC to
program on an XO from Windows.}
\es{Aunque Python se ejecutar en Windows o en Linux, actividades de Sugar sólo
se pueden desarrollar en Linux, así que vamos a utilizar Linux. Hay trés
opciones disponibles: arrancar en un medio vivo de Fedora, utilizar una maquína
virtual Fedora desde Windows, o utilizar VNC para programar en un XO desde
Windows.}

\note{\en{I'll help you set up the VMs later.}
      \es{Yo les ayudaré a configurar las maquínas virtuales después.}}

\begin{frame}{\en{Development environment}\es{Entorno de desarrollo}}
\begin{itemize}
    \item{\en{Develop on Linux}\es{Desarrollar en Linux}}
    \item{\en{Necessary for Sugar development}\es{Necesario para desarrollo para Sugar}}
    \item{\en{Fedora Live USB, VM or VNC to an XO}\es{Fedora medio vivo, VM o VNC a un XO}}
\end{itemize}
\end{frame}


\part{\en{Introduction to Python}\es{Introducción a Python}}
\frame{\partpage}
\mode<all>{\input{introduction-to-python}}


\part{\en{Python functions and classes}\es{Funciones y clases en Python}}
\frame{\partpage}
\mode<all>{\input{python-functions-and-classes}}


\part{\en{Writing Sugar activities}\es{Escribir actividades para Sugar}}\label{part:writing-sugar-activities}
\frame{\partpage}
\mode<all>{\input{writing-sugar-activities}}

\end{document}
