×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Basic PySymbian application - series1

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Bot change of links to internal format.)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Add ArticleMetaData)
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
[[Category:S60]][[Category:Python]]
+
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20080717
 +
|author= [[User:Gaba88]]
 +
}}
 +
[[Category:Symbian]][[Category:PySymbian]]
  
 
==Introduction==
 
==Introduction==
Line 8: Line 30:
 
==Application Structure==
 
==Application Structure==
  
The figure below tells us about the application structure of a PyS60 application. A good developer at the time of designing a application should always keep this application structure in mind and should try to port his application according to the figure below.
+
The figure below tells us about the application structure of a PySymbian application. A good developer at the time of designing a application should always keep this application structure in mind and should try to port his application according to the figure below.
  
[[File:Appli_struct.jpg]]
+
[[File:Appli struct.jpg]]
  
 
==Explanation==
 
==Explanation==
Line 16: Line 38:
 
The figure above tells most part of the story, and we will also make lesson out of it.
 
The figure above tells most part of the story, and we will also make lesson out of it.
  
* At the top of the figure you can see the application title. That's the portion of our application one should set the title. In PyS60, we can set the title by using.  
+
* At the top of the figure you can see the application title. That's the portion of our application one should set the title. In PySymbian, we can set the title by using.  
 
<code python>
 
<code python>
 
appuifw.app.title = u"My First App"
 
appuifw.app.title = u"My First App"
Line 26: Line 48:
 
==Body==
 
==Body==
  
Below navigation tabs comes the body of the application, which is indeed the most important part of the application. In PyS60, basically four kinds of objects can be assigned to the body part:
+
Below navigation tabs comes the body of the application, which is indeed the most important part of the application. In PySymbian, basically four kinds of objects can be assigned to the body part:
  
 
* A canvas that handles graphics on screen.
 
* A canvas that handles graphics on screen.
Line 35: Line 57:
 
==Dialog==
 
==Dialog==
  
Inside the body of the application we can see a dialog window. In a dialog window we can handle the application input and output. In PyS60 we have queries, notes and much more. Below is a code example.
+
Inside the body of the application we can see a dialog window. In a dialog window we can handle the application input and output. In PySymbian we have queries, notes and much more. Below is a code example.
  
 
<code python>
 
<code python>
Line 50: Line 72:
 
'''Access To The Right Soft Key'''
 
'''Access To The Right Soft Key'''
  
We can use the the left soft key in our application to access the options or the application menus. In PyS60, we can do as following:
+
We can use the the left soft key in our application to access the options or the application menus. In PySymbian, we can do as following:
 
<code python>
 
<code python>
 
appuifw.app.menu=[(u"menu1",callback_1),
 
appuifw.app.menu=[(u"menu1",callback_1),
Line 56: Line 78:
 
</code>
 
</code>
  
The right soft key in our Python application is used to exit our application. In PyS60, we can do it as:
+
The right soft key in our Python application is used to exit our application. In PySymbian, we can do it as:
 
<code python>
 
<code python>
 
appuifw.exit_key_handler = function
 
appuifw.exit_key_handler = function
Line 68: Line 90:
 
* [[How to draw on canvas]]
 
* [[How to draw on canvas]]
  
* [[How to use Forms]]
+
* [[How to use Form in PySymbian|How to use Forms]]
  
* [[Basic PyS60 Application: Series2|Basic PyS60 Application Series2]]
+
* [[Basic PySymbian Application: Series2|Basic PySymbian Application Series2]]
  
* [[Basic PyS60 Application: Series3|Basic PyS60 Applications series3]]
+
* [[Basic PySymbian Application: Series3|Basic PySymbian Applications series3]]

Revision as of 05:39, 27 July 2012

Article Metadata
Article
Created: gaba88 (17 Jul 2008)
Last edited: hamishwillee (27 Jul 2012)

Contents

Introduction

Mobile applications we know are very interesting and attractive. This article series will help a beginner to develop a good mobile application using the Python for the S60 platform.

The first series will make us understand the structure of an application. A good mobile application developer must have a clear vision about the application structure s/he wants to design.

Application Structure

The figure below tells us about the application structure of a PySymbian application. A good developer at the time of designing a application should always keep this application structure in mind and should try to port his application according to the figure below.

Appli struct.jpg

Explanation

The figure above tells most part of the story, and we will also make lesson out of it.

  • At the top of the figure you can see the application title. That's the portion of our application one should set the title. In PySymbian, we can set the title by using.
appuifw.app.title = u"My First App"
  • The navigation tabs are below the title. If you would like to use tabs in your application, look here.

Body

Below navigation tabs comes the body of the application, which is indeed the most important part of the application. In PySymbian, basically four kinds of objects can be assigned to the body part:

  • A canvas that handles graphics on screen.
  • A form that is used to built a complex forms that include combination of various fields such as text numbers and lists.
  • A text object that handles a free form text input.
  • A listbox that shows a list of items with

Dialog

Inside the body of the application we can see a dialog window. In a dialog window we can handle the application input and output. In PySymbian we have queries, notes and much more. Below is a code example.

appuifw.query(u"GO","query")
 
appuifw.note(u"stop","info")

Menu & Exit

After every thing there leaves the two important aspects in our application they are

Access To The Left Soft Key

Access To The Right Soft Key

We can use the the left soft key in our application to access the options or the application menus. In PySymbian, we can do as following:

appuifw.app.menu=[(u"menu1",callback_1),
(u"menu2",callback_2)]

The right soft key in our Python application is used to exit our application. In PySymbian, we can do it as:

appuifw.exit_key_handler = function

where function is a callback function that is called when the left key is pressed.

Helpful Links

84 page views in the last 30 days.