PyMaemo_Tips
Wednesday, 21. March 2007, 03:43:38
Updated : Added a easy to read PDF. PyMaemo-Tips.pdf
Tablet and Coding Tips
You can edit code and move files around between your desktop and the tablet by installing a few extra packages on both. Installing a Xterm, Midnight Commander and OpenSSH can make PyMaemo development outside of scratchbox possible and even easy. You can do most of your coding on the desktop by installing PyGTK. Your program will probably only need to have a few lines of code changed or added to work with the Hildon libraries.

After installing and setting up OpenSSH, KDE users can connect, browse and manage files on the tablet from the Konqueror with sftp. When connecting, you will be prompted for a password but there are many tutorials on the Internet that teach you how to setup OpenSSH to use keys.

Once you are connected, you can drop and drag files between your desktop and the tablet. You can also bookmark the tablet directory or create a desktop shortcut so you can return to the same spot every time. With the Konqueror you can right click on a tablet file and open it with your favorite KDE editor.

After making your changes, you can save it directly back to the device. If you did not setup OpenSSH to use keys, you may be asked to enter the password again.

For GTK users, gFTP can also connect with OpenSSH. This allows you to transfer files back and forth with a single click. Using this method, you can edit your files on the desktop and then push the saved files back to the tablet. You can bookmark the current directories and save the password so that a single click will return you to the last place you were working.

While connected, you can open a xterm on the desktop and ssh into the tablet where you can test your code and run commands. You can also ssh back to desktop from a osso-xterm session on the tablet.

If you installed the Midnight Commander on the tablet, typing mc in the ssh session makes moving files around on the tablet a breeze. There are a lot of options under the various Midnight Commander menus. Spending a little time learning them can make working on the tablet and desktop more productive.

One important option is the edit function. It makes changing text files on the tablet very easy. It is also one the few editors left that allows you to mark and delete columns of text. Most functions work with just a tap of the stylus, thanks to the person who packaged it, if not you can still use the virtual keyboard.

Installing Glade on the desktop is a useful tool to learn how GTK works even if you do not use libglade in your PyGTK programs. You can do your basic design and test the effects of the different options available in real time. You can then use the build function to generate the C code. Opening up the interface.c code in the Project directory with a text editor can reveal how to call the GTK functions and the parameters that are required.

Finding documentation and help.
The first place to look for Python documentation is
http://docs.python.org/
Hildon and PyMaemo documentation can be found at
http://maemo.org/platform/docs/api-index.html
-- and --
http://pymaemo.garage.maemo.org/
The maemo developer list is also a good place to find answers
http://maemo.org/pipermail/maemo-developers/
Then you should go to the PyGTK site.
http://www.pygtk.org/
Where you should download and look at the reference for PyGTK.
http://www.pygtk.org/reference.html
The tutorial is also a must download.
http://www.pygtk.org/tutorial.html
When you have a question about PyGTK, the Whole FAQ is a great source for answers. I usually load and save the whole page so I can look back on it while offline. I bookmark it along with my downloaded references and tutorials.
http://www.async.com.br/faq/pygtk/index.py?req=all
For the really difficult questions you can search the PyGTK mailing lists archive.
http://www.mail-archive.com/pygtk@daa.com.au/
If all else fails, try searches like 'import hildon' or some GTK function like 'gtk.DrawingArea' at
http://www.google.com/codesearch
-- or --
http://www.google.com/
When you are ready to package the application for the tablet, it really only takes a few steps. First you need to read the tutorial at http://maemo.org/platform/docs/python-bora/python_maemo_howto.html
Even though I install and setup the full scratchbox, after configuring the arm target, I just leave everything like that.
From then on, I just :
1) Open a xterm and login with /scratchbox/login
2) Make a package directory.
3) Copy my files there and include the simple Makefile from the tutorial.
4) Run dh_make -e your.email@somewhere.com in the package directory.
5) Edit the files in the created debian directory.
6) Run dpkg-buildpackage -rfakeroot
You're done.
P.S.
Bonus Linux Tips
Most Windows users know how to Crtl-C to copy and Crtl-V to paste.
Most Linux Distro's allow you highlight some text in some part of the screen
and copy it to another without ever touching the keyboard by
Selecting the text.
Move the mouse to the place you want and
Press both mouse buttons on a two button mouse at the same time
-- or --
Press the middle button on a three button mouse.
This includes copying text from your desktop to the ssh session on your tablet.

Try this:
Open the xterm on the tablet.
type cd /h then tap the Tab key on the virtual keyboard. [Note: There is a space between the d and the /]
tap the Tab key on the virtual keyboard again
and again.
Tablet and Coding Tips
You can edit code and move files around between your desktop and the tablet by installing a few extra packages on both. Installing a Xterm, Midnight Commander and OpenSSH can make PyMaemo development outside of scratchbox possible and even easy. You can do most of your coding on the desktop by installing PyGTK. Your program will probably only need to have a few lines of code changed or added to work with the Hildon libraries.

After installing and setting up OpenSSH, KDE users can connect, browse and manage files on the tablet from the Konqueror with sftp. When connecting, you will be prompted for a password but there are many tutorials on the Internet that teach you how to setup OpenSSH to use keys.

Once you are connected, you can drop and drag files between your desktop and the tablet. You can also bookmark the tablet directory or create a desktop shortcut so you can return to the same spot every time. With the Konqueror you can right click on a tablet file and open it with your favorite KDE editor.

After making your changes, you can save it directly back to the device. If you did not setup OpenSSH to use keys, you may be asked to enter the password again.

For GTK users, gFTP can also connect with OpenSSH. This allows you to transfer files back and forth with a single click. Using this method, you can edit your files on the desktop and then push the saved files back to the tablet. You can bookmark the current directories and save the password so that a single click will return you to the last place you were working.

While connected, you can open a xterm on the desktop and ssh into the tablet where you can test your code and run commands. You can also ssh back to desktop from a osso-xterm session on the tablet.

If you installed the Midnight Commander on the tablet, typing mc in the ssh session makes moving files around on the tablet a breeze. There are a lot of options under the various Midnight Commander menus. Spending a little time learning them can make working on the tablet and desktop more productive.

One important option is the edit function. It makes changing text files on the tablet very easy. It is also one the few editors left that allows you to mark and delete columns of text. Most functions work with just a tap of the stylus, thanks to the person who packaged it, if not you can still use the virtual keyboard.

Installing Glade on the desktop is a useful tool to learn how GTK works even if you do not use libglade in your PyGTK programs. You can do your basic design and test the effects of the different options available in real time. You can then use the build function to generate the C code. Opening up the interface.c code in the Project directory with a text editor can reveal how to call the GTK functions and the parameters that are required.

Finding documentation and help.
The first place to look for Python documentation is
http://docs.python.org/
Hildon and PyMaemo documentation can be found at
http://maemo.org/platform/docs/api-index.html
-- and --
http://pymaemo.garage.maemo.org/
The maemo developer list is also a good place to find answers
http://maemo.org/pipermail/maemo-developers/
Then you should go to the PyGTK site.
http://www.pygtk.org/
Where you should download and look at the reference for PyGTK.
http://www.pygtk.org/reference.html
The tutorial is also a must download.
http://www.pygtk.org/tutorial.html
When you have a question about PyGTK, the Whole FAQ is a great source for answers. I usually load and save the whole page so I can look back on it while offline. I bookmark it along with my downloaded references and tutorials.
http://www.async.com.br/faq/pygtk/index.py?req=all
For the really difficult questions you can search the PyGTK mailing lists archive.
http://www.mail-archive.com/pygtk@daa.com.au/
If all else fails, try searches like 'import hildon' or some GTK function like 'gtk.DrawingArea' at
http://www.google.com/codesearch
-- or --
http://www.google.com/
When you are ready to package the application for the tablet, it really only takes a few steps. First you need to read the tutorial at http://maemo.org/platform/docs/python-bora/python_maemo_howto.html
Even though I install and setup the full scratchbox, after configuring the arm target, I just leave everything like that.
From then on, I just :
1) Open a xterm and login with /scratchbox/login
2) Make a package directory.
3) Copy my files there and include the simple Makefile from the tutorial.
4) Run dh_make -e your.email@somewhere.com in the package directory.
5) Edit the files in the created debian directory.
6) Run dpkg-buildpackage -rfakeroot
You're done.
P.S.
Bonus Linux Tips
Most Windows users know how to Crtl-C to copy and Crtl-V to paste.
Most Linux Distro's allow you highlight some text in some part of the screen
and copy it to another without ever touching the keyboard by
Selecting the text.
Move the mouse to the place you want and
Press both mouse buttons on a two button mouse at the same time
-- or --
Press the middle button on a three button mouse.
This includes copying text from your desktop to the ssh session on your tablet.

Try this:
Open the xterm on the tablet.
type cd /h then tap the Tab key on the virtual keyboard. [Note: There is a space between the d and the /]
tap the Tab key on the virtual keyboard again
and again.

