Documentation/Maemo Eclipse Tutorial/Using PluThon
PluThon supports only Python projects. This chapter briefly shows hot to create Python projects and applications and run, test and debug Python applications with Maemo device.
PluThon requires Python installed on host PC and Maemo Device. See PluThon installation chapters for detailed information how to install PlutThon itself and needed Python development environments. PC Connectivity is needed to connect Maemo Device to host PC and PluThon. See PC Connectivity documentation for details how to install and configure Maemo PC Connectivity to the Maemo Device and Host PC Connectivity to the host PC you are running PluThon Eclipse environment.
Ensure that you can connect to the Maemo device from the host PC (that PC Connectivity has been properly installed and configured) before creating your first project with PluThon.
Contents |
[edit] Creating PluThon Python projects
Create new PluThon project from File menu > New > PluThon Project, figure 7.1.
[edit] PluThon Project Templates
Templates define the basic structure of the project. Most of the templates are examples, but you can use these examples also as a base structure for your project.
Select any template under Examples. Some of the templates are only for Diablo devices (N800 or N810) and others for Fremantle (N900), figure 7.2.
[edit] PluThon Project Target
Select your connection to the device from the list. Default IP addresses are the same as PC Connectivity uses as default. The connection must be enabled from device PC Connectivity. See the PC Connectivity documentation for more information.
If you only use SSH connection to your device, or you have other IP values in your PC Connectivity properties, you can configure the connection here by right-clicking connection and selecting configure. Then you need to set Host name and Default User ID, figures 7.3 and 7.4.
You can configure connections afterwards from Window > Preferences > Maemo > Installed Targets or use Remote Systems view Window > Show View > Other > Remote Systems > Remote Systems.
[edit] PluThon Project Metadata
Basic Settings page defines some basic variables used by the selected template. You can insert requested information into fields or leave default values, figure 7.5.
[edit] PluThon Project Interpreter Configuration
Python configuration is done on the last page. If existing Python configuration is not found, a wizard suggests creating a new configuration.
Leave all values as default and press the Finish button to create project, figure 7.6.
If there were no previous configurations for your project, ESbox will ask you to create new configuration. Select Yes to create one, figure 7.7.
For the Python interpreter configuration you can select all Python paths and confirm the addition with OK button, figure 7.8.
[edit] Validating PluThon Project Packages on Maemo Device
PluThon suggests package validation when a new project is created. Answer Yes to package validations, figure 7.9.
PluThon installs the required dependencies into the Maemo device after you press Finish button on Package Validation Wizard, figure 7.10.
Accept any packages PluThon suggests to install and close validation after the packages have been installed.
Package validation can be invoked from menu afterwards. Select Project > Project Menu > Validate installed packages.
During a validation project, dependencies are scanned from projects using Python package imports from source files.
[edit] Running Python Application on Maemo Device
In order to run applications on Maemo devices, the Maemo PC Connectivity package must be installed on the device and the Host PC Connectivity package for the host PC. See the PluThon installation chapters for more information.
You can run Python applications with PluThon by right-clicking a project and choosing Run As > PluThon Application, figure 7.11.
Next, select the Python file to be run (do not select setup.py because it is used only for Debian package creation), figure 7.12.
Then select the download method as Copy Programs (SSH) (as SBRSH requires configuration), figure 7.13.
You can now see the program running on the Maemo device.
You can use VNC Viewer to control the Maemo device and your application running on the device. Choose Window > Show View > Other > VNC Viewer.
The x11vnc service must be installed on the Maemo device either separately (apt-get install x11vnc ) or as part of Maemo PC Connectivity. |
[edit] Debugging PluThon Application on Maemo Device
In order to debug the project, set at least one breakpoint into one of the source files where you want to start debugging. Open the source file and place the breakpoint at some position by right-clicking the left source side panel and choosing Add Breakpoint, figure 7.14.
Launch your project in debug mode by right-clicking project and choosing Debug As > PluThon Application and accept changing to debug perspective, figure 7.15.
From the debug perspective, you can stop and continue execution, step lines, inspect variables, and so on. See Figures 7.16 and 7.17.
You can switch back and forth between perspectives from top-right corner. |
[edit] Debian Packaging PluThon Project
[edit] Generating Setup Script
The setup script (setup.py
) is used to create the Debian installation package for Python projects.
In setup script generator you need to define metadata, packages, executables and datafiles. This information is then used to create setup.py
script for the project, figure 7.18.
PluThon provides an automated wizard for creating Debian installation packages with this script. You can create the script from File > New > Other > PyDev > Setup Script, figure 7.19.
For the setup.py
script you need to define certain metadata for the installation pacakge, figure 7.20.
Information about packages included in the installation package, figure 7.21.
Information about extra resources such as modules, scripts and data files included in the installation package, figure 7.22.
You can find more information about the Python setup script from Python distutils documentation.
[edit] Create Debian Installation Package
You can export a project to the Debian installation package from File > Export > PluThon > Export to Debian Package. This command requires that setup.py
script has been defined for the project.
In Debian package export you only need to select the project and setup script. The package is created on the Maemo device using bdist-maemo distutils packages, figure 7.23.
[edit] Install Debian Package to Maemo Device
To install a created Debian package to the Maemo device, right-click project and select Install Debian Package on Device, figure 7.24.
From the Install Debian Package wizard select Browse and set Package location to created package, select the correct connection and install using the Finish button, figure 7.25.
- This page was last modified on 12 November 2010, at 13:08.
- This page has been accessed 8,335 times.