Editing Documentation/Maemo Eclipse Tutorial/Using PluThon
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 7: | Line 7: | ||
== Creating PluThon Python projects == | == Creating PluThon Python projects == | ||
- | Create new PluThon project from '''File menu > New > PluThon Project''', figure [[# | + | Create new PluThon project from '''File menu > New > PluThon Project''', figure [[#fig:pluthon_usage_project_01_new|7.1]]. |
- | + | {| summary="New Project Menu" | |
- | [[Image:project-01-new.png| | + | |+ align="BOTTOM" |'''Figure 7.1:''' New Project Menu |
- | + | |- | |
+ | | | ||
+ | [[Image:project-01-new.png|Image project-01-new]] | ||
+ | |} | ||
=== PluThon Project Templates === | === PluThon Project Templates === | ||
Line 17: | Line 20: | ||
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. | 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 | + | Select any template under '''Examples'''. Some of the templates are only for <span><font face="monospace">Diablo</font></span> device (N800 or N810) and others for <span><font face="monospace">Fremantle</font></span> (N900), figure [[#fig:pluthon_usage_project_03_template|7.2]]. |
- | + | {| summary="PluThon Project Template" | |
- | [[Image:project-03-template.png| | + | |+ align="BOTTOM" |'''Figure 7.2:''' PluThon Project Template |
- | + | |- | |
+ | | | ||
+ | [[Image:project-03-template.png|Image project-03-template]] | ||
+ | |} | ||
=== PluThon Project Target === | === PluThon Project Target === | ||
Line 27: | Line 33: | ||
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. | 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 | + | 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 [[#fig:pluthon_usage_project_04_target|7.3]] and [[#fig:pluthon_usage_configure_connection|7.4]]. |
- | + | {| summary="PluThon Project Target" | |
- | [[Image:project-04-target.png| | + | |+ align="BOTTOM" |'''Figure 7.3:''' PluThon Project Target |
- | + | |- | |
+ | | | ||
+ | [[Image:project-04-target.png|Image project-04-target]] | ||
+ | |} | ||
- | + | {| summary="PluThon Project Target" | |
- | + | |+ align="BOTTOM" |'''Figure 7.4:''' PluThon Project Target | |
- | + | |- | |
+ | | | ||
+ | [[Image:configure-connection.png|Image configure-connection]] | ||
+ | |} | ||
You can configure connections afterwards from '''Window > Preferences > Maemo > Installed Targets''' or use Remote Systems view '''Window > Show View > Other > Remote Systems > Remote Systems'''. | You can configure connections afterwards from '''Window > Preferences > Maemo > Installed Targets''' or use Remote Systems view '''Window > Show View > Other > Remote Systems > Remote Systems'''. | ||
Line 41: | Line 53: | ||
=== PluThon Project Metadata === | === 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 [[# | + | '''Basic Settings''' page defines some basic variables used by the selected template. You can insert requested information into fields or leave default values, figure [[#fig:pluthon_usage_project_05_metadata|7.5]]. |
- | + | {| summary="PluThon Project Configuration" | |
- | [[Image:project-05-metadata.png| | + | |+ align="BOTTOM" |'''Figure 7.5:''' PluThon Project Configuration |
- | + | |- | |
+ | | | ||
+ | [[Image:project-05-metadata.png|Image project-05-metadata]] | ||
+ | |} | ||
=== PluThon Project Interpreter Configuration === | === PluThon Project Interpreter Configuration === | ||
Line 51: | Line 66: | ||
Python configuration is done on the last page. If existing Python configuration is not found, a wizard suggests creating a new 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 [[# | + | Leave all values as default and press the '''Finish''' button to create project, figure [[#fig:pluthon_usage_project_06_configuration|7.6]]. |
- | |||
- | |||
- | |||
- | |||
- | + | {| summary="PluThon Project Configuration" | |
- | [[Image:project- | + | |+ align="BOTTOM" |'''Figure 7.6:''' PluThon Project Configuration |
- | + | |- | |
+ | | | ||
+ | [[Image:project-06-configuration.png|Image project-06-configuration]] | ||
+ | |} | ||
- | + | If there were no previous configurations for your project, ESbox will ask you to create new configuration. Select '''Yes''' to create one, figure [[#fig:pluthon_usage_project_07_interpreter_dialog|7.7]]. | |
- | + | {| summary="Python Interpreter Dialog" | |
- | [[Image:project- | + | |+ align="BOTTOM" |'''Figure 7.7:''' Python Interpreter Dialog |
- | + | |- | |
+ | | | ||
+ | [[Image:project-07-interpreter-dialog.png|Image project-07-interpreter-dialog]] | ||
+ | |} | ||
+ | |||
+ | For the Python interpreter configuration you can select all Python paths and confirm the addition with '''OK''' button, figure [[#fig:pluthon_usage_project_08_interpreter_paths|7.8]]. | ||
+ | |||
+ | {| summary="Python Interpreter Path Configuration" | ||
+ | |+ align="BOTTOM" |'''Figure 7.8:''' Python Interpreter Path Configuration | ||
+ | |- | ||
+ | | | ||
+ | [[Image:project-08-interpreter-paths.png|Image project-08-interpreter-paths]] | ||
+ | |} | ||
=== Validating PluThon Project Packages on Maemo Device === | === Validating PluThon Project Packages on Maemo Device === | ||
- | PluThon suggests package validation when a new project is created. Answer '''Yes''' to package validations, figure [[# | + | PluThon suggests package validation when a new project is created. Answer '''Yes''' to package validations, figure [[#fig:pluthon_usage_project_09_validate_dialog|7.9]]. |
- | + | {| summary="Validate Packages Dialog" | |
- | [[Image:project-09-validate-dialog.png| | + | |+ align="BOTTOM" |'''Figure 7.9:''' Validate Packages Dialog |
- | + | |- | |
+ | | | ||
+ | [[Image:project-09-validate-dialog.png|Image project-09-validate-dialog]] | ||
+ | |} | ||
- | PluThon installs the required dependencies into the Maemo device after you press ''' | + | PluThon installs the required dependencies into the Maemo device after you press '''Finnish''' button on Package Validation Wizard, figure [[#fig:pluthon_usage_project_10_validate_wizard|7.10]]. |
- | + | {| summary="Validate Packages Wizard" | |
- | + | |+ align="BOTTOM" |'''Figure 7.10:''' Validate Packages Wizard | |
- | + | |- | |
+ | | | ||
+ | [[Image:project-10-validate-wizard.png|Image project-10-validate-wizard]] | ||
+ | |} | ||
Accept any packages PluThon suggests to install and close validation after the packages have been installed. | Accept any packages PluThon suggests to install and close validation after the packages have been installed. | ||
Line 93: | Line 125: | ||
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. | 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 [[# | + | You can run Python applications with PluThon by right-clicking a project and choosing '''Run As > PluThon Application''', figure [[#fig:pluthon_usage_run_01_run_as|7.11]]. |
- | + | {| summary="Run as PluThon Application" | |
- | [[Image:run-01-run-as.png| | + | |+ align="BOTTOM" |'''Figure 7.11:''' Run as PluThon Application |
- | + | |- | |
+ | | | ||
+ | [[Image:run-01-run-as.png|Image run-01-run-as]] | ||
+ | |} | ||
- | Next, select the Python file to be run (do not select setup.py because it is used only for Debian package creation), figure [[# | + | Next, select the Python file to be run (do not select setup.py because it is used only for Debian package creation), figure [[#fig:pluthon_usage_run_02_script|7.12]]. |
- | + | {| summary="Select Executable" | |
- | [[Image:run-02-script.png| | + | |+ align="BOTTOM" |'''Figure 7.12:''' Select Executable |
- | + | |- | |
+ | | | ||
+ | [[Image:run-02-script.png|Image run-02-script]] | ||
+ | |} | ||
- | Then select the download method as Copy Programs (SSH) (as SBRSH requires configuration), figure [[# | + | Then select the download method as Copy Programs (SSH) (as SBRSH requires configuration), figure [[#fig:pluthon_usage_run_03_download|7.13]]. |
- | + | {| summary="Select Download Method" | |
- | [[Image:run-03-download.png| | + | |+ align="BOTTOM" |'''Figure 7.13:''' Select Download Method |
- | + | |- | |
+ | | | ||
+ | [[Image:run-03-download.png|Image run-03-download]] | ||
+ | |} | ||
You can now see the program running on the Maemo device. | You can now see the program running on the Maemo device. | ||
Line 115: | Line 156: | ||
You can use VNC Viewer to control the Maemo device and your application running on the device. Choose '''Window > Show View > Other > VNC Viewer'''. | You can use VNC Viewer to control the Maemo device and your application running on the device. Choose '''Window > Show View > Other > VNC Viewer'''. | ||
- | { | + | {| |
+ | |- | ||
+ | | [[Image:dialog-information.png]] | ||
+ | | '''Note:''' The <span><font face="monospace">x11vnc</font></span> service must be installed on the Maemo device either separately (apt-get install x11vnc) or as part of Maemo PC Connectivity. | ||
+ | |} | ||
== Debugging PluThon Application on Maemo Device == | == 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 [[# | + | 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 [[#fig:pluthon_usage_debug_02_add_breakpoint|7.14]]. |
- | + | {| summary="Add Breakpoint" | |
- | [[Image:debug-02-add-breakpoint.png| | + | |+ align="BOTTOM" |'''Figure 7.14:''' Add Breakpoint |
- | + | |- | |
+ | | | ||
+ | [[Image:debug-02-add-breakpoint.png|Image debug-02-add-breakpoint]] | ||
+ | |} | ||
- | Launch your project in debug mode by right-clicking project and choosing '''Debug As > PluThon Application''' and accept changing to debug perspective, figure [[# | + | Launch your project in debug mode by right-clicking project and choosing '''Debug As > PluThon Application''' and accept changing to debug perspective, figure [[#fig:pluthon_usage_debug_01_menu|7.15]]. |
- | + | {| summary="Debug as PluThon Application" | |
- | + | |+ align="BOTTOM" |'''Figure 7.15:''' Debug as PluThon Application | |
- | + | |- | |
+ | | | ||
+ | [[Image:debug-01-menu.png|Image debug-01-menu]] | ||
+ | |} | ||
- | From the debug perspective, you can stop and continue execution, step lines, inspect variables, and so on. See Figures [[# | + | From the debug perspective, you can stop and continue execution, step lines, inspect variables, and so on. See Figures [[#fig:pluthon_usage_python_debug_03_perspective|7.16]] and [[#fig:pluthon_usage_debug_04_variables|7.17]]. |
{{ambox | {{ambox | ||
Line 137: | Line 188: | ||
}} | }} | ||
- | + | {| summary="Debug View" | |
- | [[Image:debug-03-debug-view.png| | + | |+ align="BOTTOM" |'''Figure 7.16:''' Debug View |
- | + | |- | |
+ | | | ||
+ | [[Image:debug-03-debug-view.png|Image debug-03-debug-view]] | ||
+ | |} | ||
- | + | {| summary="Variables View" | |
- | [[Image:debug-04-variables-view.png| | + | |+ align="BOTTOM" |'''Figure 7.17:''' Variables View |
- | + | |- | |
+ | | | ||
+ | [[Image:debug-04-variables-view.png|Image debug-04-variables-view]] | ||
+ | |} | ||
== Debian Packaging PluThon Project == | == Debian Packaging PluThon Project == | ||
Line 149: | Line 206: | ||
=== Generating Setup Script === | === Generating Setup Script === | ||
- | The setup script (< | + | The setup script (<span><font face="monospace">setup.py</font></span>) 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 < | + | In setup script generator you need to define metadata, packages, executables and datafiles. This information is then used to create <span><font face="monospace">setup.py</font></span> script for the project, figure [[#fig:pluthon_usage_debian_01_setup_wizard|7.18]]. |
- | + | {| summary="Debian Package Setup Wizard" | |
- | [[Image:debian-01-setup-wizard.png| | + | |+ align="BOTTOM" |'''Figure 7.18:''' Debian Package Setup Wizard |
- | + | |- | |
+ | | | ||
+ | [[Image:debian-01-setup-wizard.png|Image debian-01-setup-wizard]] | ||
+ | |} | ||
- | 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 [[# | + | 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 [[#fig:pluthon_usage_debian_02_setup_wizard|7.19]]. |
- | + | {| summary="Debian Package Setup Project" | |
- | [[Image:debian-02-setup-project.png| | + | |+ align="BOTTOM" |'''Figure 7.19:''' Debian Package Setup Project |
- | + | |- | |
+ | | | ||
+ | [[Image:debian-02-setup-project.png|Image debian-02-setup-project]] | ||
+ | |} | ||
- | For the < | + | For the <span><font face="monospace">setup.py</font></span> script you need to define certain metadata for the installation pacakge, figure [[#fig:pluthon_usage_debian_03_setup_parameters|7.20]]. |
- | + | {| summary="Debian Package Setup Parameters" | |
- | [[Image:debian-03-setup-parameters.png| | + | |+ align="BOTTOM" |'''Figure 7.20:''' Debian Package Setup Parameters |
- | + | |- | |
+ | | | ||
+ | [[Image:debian-03-setup-parameters.png|Image debian-03-setup-parameters]] | ||
+ | |} | ||
- | Information about packages included in the installation package, figure [[# | + | Information about packages included in the installation package, figure [[#fig:pluthon_usage_debian_04_setup_package|7.21]]. |
- | + | {| summary="Debian Package Setup Packages" | |
- | [[Image:debian-04-setup-package.png| | + | |+ align="BOTTOM" |'''Figure 7.21:''' Debian Package Setup Packages |
- | + | |- | |
+ | | | ||
+ | [[Image:debian-04-setup-package.png|Image debian-04-setup-package]] | ||
+ | |} | ||
- | Information about extra resources such as modules, scripts and data files included in the installation package, figure [[# | + | Information about extra resources such as modules, scripts and data files included in the installation package, figure [[#fig:pluthon_usage_debian_05_setup_data|7.22]]. |
- | + | {| summary="Debian Package Setup Data" | |
- | [[Image:debian-05-setup-data.png| | + | |+ align="BOTTOM" |'''Figure 7.22:''' Debian Package Setup Data |
- | + | |- | |
+ | | | ||
+ | [[Image:debian-05-setup-data.png|Image debian-05-setup-data]] | ||
+ | |} | ||
You can find more information about the Python setup script from [http://docs.python.org/distutils/setupscript.html Python distutils documentation]. | You can find more information about the Python setup script from [http://docs.python.org/distutils/setupscript.html Python distutils documentation]. | ||
Line 185: | Line 257: | ||
=== Create Debian Installation Package === | === 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 < | + | You can export a project to the Debian installation package from '''File > Export > PluThon > Export to Debian Package'''. This command requires that <span><font face="monospace">setup.py</font></span> script has been defined for the project. |
- | + | {| summary="Export to Debian Package" | |
- | [[Image:debian-08-export-setup.png| | + | |+ align="BOTTOM" |'''Figure 7.23:''' Export to Debian Package |
- | + | |- | |
+ | | | ||
+ | [[Image:debian-08-export-setup.png|Image debian-08-export-setup]] | ||
+ | |} | ||
- | 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 [[# | + | 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 [[#fig:pluthon_usage_debian_08_export_setup|7.23]]. |
=== Install Debian Package to Maemo Device === | === Install Debian Package to Maemo Device === | ||
Line 197: | Line 272: | ||
To install a created Debian package to the Maemo device, right-click project and select '''Install Debian Package on Device''', figure [[#fig:pluthon_usage_debian_06_install_menu|7.24]]. | To install a created Debian package to the Maemo device, right-click project and select '''Install Debian Package on Device''', figure [[#fig:pluthon_usage_debian_06_install_menu|7.24]]. | ||
- | + | {| summary="Install Debian Package Menu" | |
- | [[Image:debian-06-install-menu.png| | + | |+ align="BOTTOM" |'''Figure 7.24:''' Install Debian Package Menu |
- | + | |- | |
+ | | | ||
+ | [[Image:debian-06-install-menu.png|Image debian-06-install-menu]] | ||
+ | |} | ||
- | 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 [[# | + | 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 [[#fig:pluthon_usage_debian_07_install|7.25]]. |
- | + | {| summary="Install Debian Package Wizard" | |
- | + | |+ align="BOTTOM" |'''Figure 7.25:''' Install Debian Package Wizard | |
- | + | |- | |
+ | | | ||
+ | [[Image:debian-07-install.png|Image debian-07-install]] | ||
+ | |} | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Eclipse]] | [[Category:Eclipse]] |
Learn more about Contributing to the wiki.