Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
Conflicts: NEWS
This commit is contained in:
commit
9b68754ba5
@ -21,6 +21,8 @@ import gst
|
||||
import gst.interfaces
|
||||
|
||||
from hardware.nmclient import NMClient
|
||||
from sugar.profile import get_profile
|
||||
from sugar import env
|
||||
|
||||
_HARDWARE_MANAGER_INTERFACE = 'org.laptop.HardwareManager'
|
||||
_HARDWARE_MANAGER_SERVICE = 'org.laptop.HardwareManager'
|
||||
@ -80,6 +82,17 @@ class HardwareManager(object):
|
||||
logging.error('Cannot mute the audio channel')
|
||||
self._mixer.set_mute(self._master, mute)
|
||||
|
||||
def startup(self):
|
||||
if env.is_emulator() is False:
|
||||
profile = get_profile()
|
||||
self.set_volume(profile.sound_volume)
|
||||
|
||||
def shutdown(self):
|
||||
if env.is_emulator() is False:
|
||||
profile = get_profile()
|
||||
profile.sound_volume = self.get_volume()
|
||||
profile.save()
|
||||
|
||||
def set_dcon_freeze(self, frozen):
|
||||
if not self._service:
|
||||
return
|
||||
|
@ -147,6 +147,9 @@ if __name__ == '__main__':
|
||||
|
||||
main()
|
||||
|
||||
hw_manager = hardwaremanager.get_manager()
|
||||
hw_manager.startup()
|
||||
|
||||
try:
|
||||
gtk.main()
|
||||
except KeyboardInterrupt:
|
||||
|
@ -24,6 +24,7 @@ import gtk
|
||||
import hippo
|
||||
import dbus
|
||||
|
||||
from hardware import hardwaremanager
|
||||
from sugar.graphics import style
|
||||
from sugar.graphics.xocolor import XoColor
|
||||
from sugar.graphics.palette import Palette, CanvasInvoker
|
||||
@ -167,6 +168,9 @@ class _MyIcon(MyIcon):
|
||||
|
||||
pm = self._get_power_manager()
|
||||
|
||||
hw_manager = hardwaremanager.get_manager()
|
||||
hw_manager.shutdown()
|
||||
|
||||
if env.is_emulator():
|
||||
self._close_emulator()
|
||||
else:
|
||||
@ -178,6 +182,9 @@ class _MyIcon(MyIcon):
|
||||
|
||||
pm = self._get_power_manager()
|
||||
|
||||
hw_manager = hardwaremanager.get_manager()
|
||||
hw_manager.shutdown()
|
||||
|
||||
if env.is_emulator():
|
||||
self._close_emulator()
|
||||
else:
|
||||
|
@ -25,6 +25,7 @@ from sugar import util
|
||||
from sugar.graphics.xocolor import XoColor
|
||||
|
||||
DEFAULT_JABBER_SERVER = 'olpc.collabora.co.uk'
|
||||
DEFAULT_VOLUME = 81
|
||||
|
||||
_profile = None
|
||||
|
||||
@ -93,6 +94,8 @@ class Profile(object):
|
||||
|
||||
_set_key(cp, 'Jabber', 'Registered', self.jabber_registered)
|
||||
|
||||
_set_key(cp, 'Sound', 'Volume', self.sound_volume)
|
||||
|
||||
f = open(self._config_path, 'w')
|
||||
cp.write(f)
|
||||
f.close()
|
||||
@ -115,6 +118,10 @@ class Profile(object):
|
||||
self.jabber_registered = True
|
||||
if cp.has_option('Server', 'Backup1'):
|
||||
self.backup1 = cp.get('Server', 'Backup1')
|
||||
if cp.has_option('Sound', 'Volume'):
|
||||
self.sound_volume = float(cp.get('Sound', 'Volume'))
|
||||
else:
|
||||
self.sound_volume = DEFAULT_VOLUME
|
||||
|
||||
del cp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user