×
Namespaces

Variants
Actions

Archived:How to use the PySymbian Envy module

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


This articles show how to use the PySymbian "Envy" module. The module allows you to prevent Python scripts from closing in response to the device "red" key (or under low memory conditions). It also allows you to hide the app and run it as a background task, and to determine the capabilities available to the current script environment.

Article Metadata
Code ExampleCompatibility
Platform(s): PyS60 2.0 (S60 3rd Edition and later)
Article
Created: User:Kandyfloss (26 Apr 2008)
Last edited: hamishwillee (31 May 2013)

Contents

Overview

This article explains how to use the Python extension "Envy" by Cyke64.

Envy is mainly used to prevent the python application closing when the red/disconnect key is pressed or under low memory conditions (it sets the app as a "system app"). It also allows you to check what Platform security capabilities are available in the current scripting environment, and to make your application run as a background task - removing its icon from the system GUI and the task list.

The envy module is for 3rd Edition devices only. Download here:

Setting the script as a system app

The code below sets the script as a system app:

#importing the module envy
import envy
 
#Print version of envy
print envy.version
 
print envy.is_app_system()
try:
envy.set_app_system(1) # trying to set system your application
# (standalone) or python shell if you run it from there !
except:
print 'exception !' #exception encountered
 
print envy.is_app_system()
#After this code it the pythonshell would not exit
#on pressing the red/disconnect key

Checking capabilities of scripting environment

The code below shows how to tell what platform security capabilities are requested by your application, and what certificate the application is signed with.

from envy import *
# testing selfsigned
print has_capabilities(SELFSIGNED) # return 1 if True / 0 if false
print has_capabilities('selfsigned')
print has_capabilities('ALL-ReadDeviceData-WriteDeviceData-TrustedUI-ProtServ-SwEvent-Location-SurroundingsDD-PowerMgmt-NetworkControl-CommDD-MultimediaDD-DiskAdmin-DRM-TCB-AllFiles') print has_capabilities((ECapabilityReadUserData,ECapabilityWriteUserData,ECapabilityUserEnvironment,ECapabilityNetworkServices,ECapabilityLocalServices)) print has_capabilities('ReadUserData+WriteUserData+UserEnvironment+NetworkServices+LocalServices')
 
# testing unsigned
print has_capabilities('unsigned')
 
# testing your against any capabilities set
print has_capabilities('ALL-TCB-AllFiles')
 
# Display capacity in Python Script shell or your standalone application if running
#from this location !
 
print app_capabilities()

Set your application as background task

The envy extension can also make your application run as a background task - removing its icon from the system GUI and the task list.

importing the module envy
import envy
 
#Print version of envy
print envy.version
 
print envy.is_app_hidden()
 
try:
envy.set_app_hidden(1) # try to hide your application from tasklist
# (standalone) or python shell if you run it from there !
except:
print 'exception !'
 
print envy.is_app_hidden()
#Now pythonshell would have disappeared from the Taskbar/Tasklist.
This page was last modified on 31 May 2013, at 04:09.
48 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×