blob: 07ff544b528d9dbe3b9b5feba528da9c750caf7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
import logging
from ConfigParser import ConfigParser
class Bundle:
"""Info about an activity bundle. Wraps the activity.info file."""
def __init__(self, info_path):
self._name = None
self._icon = None
self._service_name = None
self._show_launcher = False
self._valid = True
cp = ConfigParser()
cp.read([info_path])
if cp.has_option('Activity', 'service_name'):
self._service_name = cp.get('Activity', 'service_name')
else:
self._valid = False
logging.error('%s must specify a service name' % info_path)
if cp.has_option('Activity', 'name'):
self._service_name = cp.get('Activity', 'name')
else:
self._valid = False
logging.error('%s must specify a name' % info_path)
if cp.has_option('Activity', 'show_launcher'):
if cp.get('Activity', 'show_launcher') == 'yes':
self._show_launcher = True
if cp.has_option('Activity', 'icon'):
self._icon = cp.get('Activity', 'icon')
def is_valid(self):
return self._valid
def get_name(self):
"""Get the activity user visible name."""
return self._name
def get_service_name(self):
"""Get the activity service name"""
return self._service_name
def get_icon(self):
"""Get the activity icon name"""
return self._icon
def get_show_launcher(self):
"""Get whether there should be a visible launcher for the activity"""
return self._show_launcher
|