[Sugar-devel] [PATCH] Remove "Extreme Power Management" control panel option, OLPC #11671
Simon Schampijer
simon at schampijer.de
Mon Apr 23 16:55:24 EDT 2012
From: Simon Schampijer <simon at laptop.org>
It is currently (as of OS11.x series) inoperative.
Disabling the wireless radio (from the network panel) is
the knob to turn to get the desired result.
Signed-off-by: Simon Schampijer <simon at laptop.org>
---
extensions/cpsection/power/model.py | 30 ------------------
extensions/cpsection/power/view.py | 58 +----------------------------------
2 files changed, 1 insertion(+), 87 deletions(-)
diff --git a/extensions/cpsection/power/model.py b/extensions/cpsection/power/model.py
index 041e5cf..8b6a1d3 100644
--- a/extensions/cpsection/power/model.py
+++ b/extensions/cpsection/power/model.py
@@ -92,33 +92,3 @@ def set_automatic_pm(enabled):
client = gconf.client_get_default()
client.set_bool('/desktop/sugar/power/automatic', enabled)
return
-
-
-def get_extreme_pm():
- client = gconf.client_get_default()
- return client.get_bool('/desktop/sugar/power/extreme')
-
-
-def print_extreme_pm():
- print ('off', 'on')[get_extreme_pm()]
-
-
-def set_extreme_pm(enabled):
- """Extreme power management on/off."""
-
- bus = dbus.SystemBus()
- proxy = bus.get_object(OHM_SERVICE_NAME, OHM_SERVICE_PATH)
- keystore = dbus.Interface(proxy, OHM_SERVICE_IFACE)
-
- if enabled == 'on' or enabled == 1:
- keystore.SetKey('suspend.extreme_pm', 1)
- enabled = True
- elif enabled == 'off' or enabled == 0:
- keystore.SetKey('suspend.extreme_pm', 0)
- enabled = False
- else:
- raise ValueError(_('Error in extreme pm argument, use on/off.'))
-
- client = gconf.client_get_default()
- client.set_bool('/desktop/sugar/power/extreme', enabled)
- return 0
diff --git a/extensions/cpsection/power/view.py b/extensions/cpsection/power/view.py
index 1fb9e39..be0815d 100644
--- a/extensions/cpsection/power/view.py
+++ b/extensions/cpsection/power/view.py
@@ -30,8 +30,6 @@ class Power(SectionView):
self._model = model
self.restart_alerts = alerts
self._automatic_pm_valid = True
- self._extreme_pm_valid = True
- self._extreme_pm_change_handler = None
self._automatic_pm_change_handler = None
self.set_border_width(style.DEFAULT_SPACING * 2)
@@ -39,7 +37,6 @@ class Power(SectionView):
group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
self._automatic_pm_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
- self._extreme_pm_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
separator_pm = gtk.HSeparator()
self.pack_start(separator_pm, expand=False)
@@ -81,35 +78,6 @@ class Power(SectionView):
self._automatic_pm_alert.props.msg = self.restart_msg
self._automatic_pm_alert.show()
- box_extreme_pm = gtk.HBox(spacing=style.DEFAULT_SPACING)
- label_extreme_pm = gtk.Label(
- _('Extreme power management (disables ' \
- 'wireless radio, increases battery life)'))
- label_extreme_pm.set_alignment(0, 0.5)
- self._extreme_button = gtk.CheckButton()
- self._extreme_button.set_alignment(0, 0)
- box_extreme_pm.pack_start(self._extreme_button, expand=False)
- self._extreme_button.show()
- box_extreme_pm.pack_start(label_extreme_pm, expand=False)
- group.add_widget(label_extreme_pm)
- label_extreme_pm.show()
- box_pm.pack_start(box_extreme_pm, expand=False)
- box_extreme_pm.show()
-
- self._extreme_pm_alert = InlineAlert()
- label_extreme_pm_error = gtk.Label()
- group.add_widget(label_extreme_pm_error)
- self._extreme_pm_alert_box.pack_start(label_extreme_pm_error,
- expand=False)
- label_extreme_pm_error.show()
- self._extreme_pm_alert_box.pack_start(self._extreme_pm_alert,
- expand=False)
- box_pm.pack_end(self._extreme_pm_alert_box, expand=False)
- self._extreme_pm_alert_box.show()
- if 'extreme_pm' in self.restart_alerts:
- self._extreme_pm_alert.props.msg = self.restart_msg
- self._extreme_pm_alert.show()
-
self.pack_start(box_pm, expand=False)
box_pm.show()
@@ -118,35 +86,24 @@ class Power(SectionView):
def setup(self):
try:
automatic_state = self._model.get_automatic_pm()
- extreme_state = self._model.get_extreme_pm()
-
except Exception, detail:
self._automatic_pm_alert.props.msg = detail
self._automatic_pm_alert.show()
-
- self._extreme_pm_alert.props.msg = detail
- self._extreme_pm_alert.show()
else:
self._automatic_button.set_active(automatic_state)
- self._extreme_button.set_active(extreme_state)
- self._extreme_pm_valid = True
self._automatic_pm_valid = True
self.needs_restart = False
self._automatic_pm_change_handler = self._automatic_button.connect( \
'toggled', self.__automatic_pm_toggled_cb)
- self._extreme_pm_change_handler = self._extreme_button.connect( \
- 'toggled', self.__extreme_pm_toggled_cb)
def undo(self):
self._automatic_button.disconnect(self._automatic_pm_change_handler)
- self._extreme_button.disconnect(self._extreme_pm_change_handler)
self._model.undo()
- self._extreme_pm_alert.hide()
self._automatic_pm_alert.hide()
def _validate(self):
- if self._extreme_pm_valid and self._automatic_pm_valid:
+ if self._automatic_pm_valid:
self.props.is_valid = True
else:
self.props.is_valid = False
@@ -163,16 +120,3 @@ class Power(SectionView):
self._validate()
return False
-
- def __extreme_pm_toggled_cb(self, widget, data=None):
- state = widget.get_active()
- try:
- self._model.set_extreme_pm(state)
- except Exception, detail:
- print detail
- self._extreme_pm_alert.props.msg = detail
- else:
- self._extreme_pm_valid = True
-
- self._validate()
- return False
--
1.7.10
More information about the Sugar-devel
mailing list