[Butia-devel-list] [PATCH] Deshabilitar Energía

Andres Aguirre aaguirre en fing.edu.uy
Jue Feb 21 19:09:45 UYST 2013


mejor ponerlo en el plugin, esta bien que tortuga ahorre energía. Esto
es un tema de cuando laburamos con robots por usb.
saludos
andrés

On Thu, Feb 21, 2013 at 7:08 PM, Ignacio Rodríguez <nachoel01 en gmail.com> wrote:
> Hablo con Walter ;) (No creo que tenga problema). Pero asi evitamos
> muchos "dolores" de cabeza. Y si lo probe y me funciono...
>
> 2013/2/21, Andres Aguirre <aaguirre en fing.edu.uy>:
>> pensandolo bien, lo ideal no es agregarlo al tortuga, sino que solo a
>> nuestro plugin y cuando se da stop al comportamiento (programa
>> ejecutando) debería desactivarse.
>> saludos
>>
>>
>> On Thu, Feb 21, 2013 at 4:47 PM, Andres Aguirre <aaguirre en fing.edu.uy>
>> wrote:
>>> Lo probaste?
>>> Por lo que veo es un parche de tortuga y no de los plugins que
>>> mantenemos, conviene que se
>>> lo pasemos a walter bender, te animas?
>>> saludos
>>>
>>>
>>> On Thu, Feb 21, 2013 at 3:16 PM,  <nachoel01 en gmail.com> wrote:
>>>> From: Ignacio Rodríguez <nachoel01 en gmail.com>
>>>>
>>>> ---
>>>>  TurtleArtActivity.py |   37 ++++++++++++++++++++++++++++++++++++-
>>>>  1 files changed, 36 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
>>>> index 1de91d7..c5bc227 100644
>>>> --- a/TurtleArtActivity.py
>>>> +++ b/TurtleArtActivity.py
>>>> @@ -2,6 +2,7 @@
>>>>  #Copyright (c) 2008-13, Walter Bender
>>>>  #Copyright (c) 2009-10 Raul Gutierrez Segales
>>>>  #Copyright (c) 2012 Alan Aguiar
>>>> +#Copyright (c) 2013 Ignacio Rodriguez
>>>>
>>>>  #Permission is hereby granted, free of charge, to any person obtaining a
>>>> copy
>>>>  #of this software and associated documentation files (the "Software"),
>>>> to deal
>>>> @@ -26,6 +27,7 @@ pygtk.require('2.0')
>>>>  import gtk
>>>>  import cairo
>>>>  import gobject
>>>> +import gconf
>>>>  import dbus
>>>>
>>>>  import logging
>>>> @@ -99,6 +101,8 @@ class TurtleArtActivity(activity.Activity):
>>>>          _logger.debug('_setup_palette_toolbar')
>>>>          self._setup_palette_toolbar()
>>>>          self._setup_extra_controls()
>>>> +        self.__set_energy_mode(None)
>>>> +        self.connect("destroy", self.__set_energy_mode)
>>>>
>>>>          _logger.debug('_setup_sharing')
>>>>          self._setup_sharing()
>>>> @@ -135,6 +139,37 @@ class TurtleArtActivity(activity.Activity):
>>>>          gobject.timeout_add(250, self.save_as_logo.set_icon,
>>>> 'logo-saveoff')
>>>>          self._notify_successful_save(title=_('Save as Logo'))
>>>>
>>>> +    def __set_energy_mode(self, widget):
>>>> +        """Evitamos el apagado del usb"""
>>>> +
>>>> +        # Constantes #
>>>> +        OHM_SERVICE_NAME = 'org.freedesktop.ohm'
>>>> +        OHM_SERVICE_PATH = '/org/freedesktop/ohm/Keystore'
>>>> +        OHM_SERVICE_IFACE = 'org.freedesktop.ohm.Keystore'
>>>> +        PATH = '/etc/powerd/flags/inhibit-suspend'
>>>> +
>>>> +        client = gconf.client_get_default()
>>>> +        self._actual =
>>>> client.get_bool('/desktop/sugar/power/automatic')
>>>> +
>>>> +        if widget is None:
>>>> +            VALUE = False
>>>> +        else:
>>>> +            VALUE = self._actual
>>>> +
>>>> +        client.set_bool('/desktop/sugar/power/automatic', VALUE)
>>>> +
>>>> +        try:
>>>> +            bus = dbus.SystemBus()
>>>> +            proxy = bus.get_object(OHM_SERVICE_NAME, OHM_SERVICE_PATH)
>>>> +            self._keystore = dbus.Interface(proxy, OHM_SERVICE_IFACE)
>>>> +            self._keystore.SetKey("suspend.automatic_pm", bool(VALUE))
>>>> +        except:
>>>> +            if widget is None:
>>>> +                fd = open(PATH, "w")
>>>> +                fd.close()
>>>> +            else:
>>>> +                os.remove(PATH)
>>>> +
>>>>      def do_load_ta_project_cb(self, button):
>>>>          ''' Load a project from the Journal. '''
>>>>          chooser(self, 'org.laptop.TurtleArtActivity',
>>>> self._load_ta_project)
>>>> @@ -462,7 +497,7 @@ class TurtleArtActivity(activity.Activity):
>>>>
>>>>      def is_fullscreen(self):
>>>>          ''' Are we in fullscreen mode (toolbars hidden)? '''
>>>> -        # Fixme: this should be a exposed as a window property, not
>>>> private
>>>> +        # Fixme: this should be a exposed as a window property, not
>>>> private
>>>>          return self._is_fullscreen
>>>>
>>>>      def toolbars_expanded(self, palette=False):
>>>> --
>>>> 1.6.2.5
>>>>
>>>> _______________________________________________
>>>> Butia-devel-l site list
>>>> Butia-devel-l en fing.edu.uy
>>>> https://www.fing.edu.uy/mailman/listinfo/butia-devel-l
>>
>
>
> --
> Saludos
> Juan Ignacio Rodríguez
> *CeibalJAM!*
> *Somos Azucar*



Más información sobre la lista de distribución Butia-devel-l