Remove bundle specific stuff from env.
Move get_bundle_path to activity.
This commit is contained in:
parent
02f375b710
commit
c4435397fc
@ -21,7 +21,6 @@ import gtk
|
|||||||
|
|
||||||
from sugar.presence import PresenceService
|
from sugar.presence import PresenceService
|
||||||
from sugar.activity.activityservice import ActivityService
|
from sugar.activity.activityservice import ActivityService
|
||||||
from sugar import env
|
|
||||||
|
|
||||||
class Activity(gtk.Window):
|
class Activity(gtk.Window):
|
||||||
"""Base Activity class that all other Activities derive from."""
|
"""Base Activity class that all other Activities derive from."""
|
||||||
@ -49,13 +48,13 @@ class Activity(gtk.Window):
|
|||||||
|
|
||||||
self.present()
|
self.present()
|
||||||
|
|
||||||
def get_type(self):
|
def get_service_name(self):
|
||||||
"""Gets the activity type."""
|
"""Gets the activity service name."""
|
||||||
return env.get_bundle_service_name()
|
return os.environ['SUGAR_BUNDLE_SERVICE_NAME']
|
||||||
|
|
||||||
def get_default_type(self):
|
def get_default_type(self):
|
||||||
"""Gets the type of the default activity network service"""
|
"""Gets the type of the default activity network service"""
|
||||||
return env.get_bundle_default_type()
|
return os.environ['SUGAR_BUNDLE_DEFAULT_TYPE']
|
||||||
|
|
||||||
def get_shared(self):
|
def get_shared(self):
|
||||||
"""Returns TRUE if the activity is shared on the mesh."""
|
"""Returns TRUE if the activity is shared on the mesh."""
|
||||||
@ -103,3 +102,6 @@ class Activity(gtk.Window):
|
|||||||
self._bus = None
|
self._bus = None
|
||||||
if self._service:
|
if self._service:
|
||||||
self._pservice.unregister_service(self._service)
|
self._pservice.unregister_service(self._service)
|
||||||
|
|
||||||
|
def get_bundle_path():
|
||||||
|
return os.environ['SUGAR_BUNDLE_BUNDLE_PATH']
|
||||||
|
@ -52,9 +52,9 @@ class ActivityService(dbus.service.Object):
|
|||||||
return self._activity.get_id()
|
return self._activity.get_id()
|
||||||
|
|
||||||
@dbus.service.method(_ACTIVITY_INTERFACE)
|
@dbus.service.method(_ACTIVITY_INTERFACE)
|
||||||
def get_type(self):
|
def get_service_name(self):
|
||||||
"""Get the activity type"""
|
"""Get the activity service name"""
|
||||||
return self._activity.get_type()
|
return self._activity.get_service_name()
|
||||||
|
|
||||||
@dbus.service.method(_ACTIVITY_INTERFACE)
|
@dbus.service.method(_ACTIVITY_INTERFACE)
|
||||||
def get_shared(self):
|
def get_shared(self):
|
||||||
|
18
sugar/env.py
18
sugar/env.py
@ -24,30 +24,12 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from sugar.__installed__ import *
|
from sugar.__installed__ import *
|
||||||
|
|
||||||
def get_bundle_path():
|
|
||||||
if os.environ.has_key('SUGAR_BUNDLE_PATH'):
|
|
||||||
return os.environ['SUGAR_BUNDLE_PATH']
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def is_emulator():
|
def is_emulator():
|
||||||
if os.environ.has_key('SUGAR_EMULATOR'):
|
if os.environ.has_key('SUGAR_EMULATOR'):
|
||||||
if os.environ['SUGAR_EMULATOR'] == 'yes':
|
if os.environ['SUGAR_EMULATOR'] == 'yes':
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_bundle_service_name():
|
|
||||||
if os.environ.has_key('SUGAR_BUNDLE_SERVICE_NAME'):
|
|
||||||
return os.environ['SUGAR_BUNDLE_SERVICE_NAME']
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_bundle_default_type():
|
|
||||||
if os.environ.has_key('SUGAR_BUNDLE_DEFAULT_TYPE'):
|
|
||||||
return os.environ['SUGAR_BUNDLE_DEFAULT_TYPE']
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_profile_path():
|
def get_profile_path():
|
||||||
if os.environ.has_key('SUGAR_PROFILE'):
|
if os.environ.has_key('SUGAR_PROFILE'):
|
||||||
profile_id = os.environ['SUGAR_PROFILE']
|
profile_id = os.environ['SUGAR_PROFILE']
|
||||||
|
Loading…
Reference in New Issue
Block a user