Pys60 App Skeleton

By October 20, 2009pyS60

Over the development of a few applications with pys60 I have standardized on an app skeleton that simplifies and speeds-up the initial process of getting something going. The basic idea is to have an application shell up and running on various environments without needing a lot of configuration changes as quickly as possible. By default the app will run fine in the following environments without any changes: emulator, phone (script shell), phone (stand-alone).

The core idea behind the skeleton is that of a simple launcher and a directory holding the application. The launcher is responsible for setting the import paths based on the environment and bootstraping the application with generic exception handling. The actual application code is in a separate module. The application and data views are also based on individual classes. This allows for simple navigation between views / screens even in situations where the hierarchy is quite complex.

The sample skeleton project zip file has the following contents:

Here is how you can get started with your own app in seconds in a emulator (the steps below are based on N97 emulator installed in default location and the paths will have to change to reflect any other emulator editions) :

  1. Unzip the app_skeleton into a temp folder
  2. Copy to python examples folder (in my case here it would be c:s60….)
  3. Copy the app folder to any location on the emulator C: drive. I usually place the app directory in the c:data folder

At this point you can either launch the app from the Python Script Shell

Hopefully the launcher code is self explanatory and will illustrate whats happening behind the scenes when you launch the app:

The launcher will create a ‘myapp’ application object and call the run method. From then on, the run method is responsible for creating the first view and for creating a signal lock until the view is closed or an app exit is requested by the user.

Leave a Reply