Logo Search packages:      
Sourcecode: guidance-power-manager version File versions

def powermanage::PowerManage::onBattery (   self  ) 

Find out if we're on AC or on battery using HAL. 

Definition at line 172 of file powermanage.py.

00172                        :
        """ Find out if we're on AC or on battery using HAL. """
        if not self.hasAC:
            print "No AC adapter found - assume that we are on batteries."
            return False
        properties = self.acObject.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
        if properties.has_key("ac_adapter.present"):
            return not properties['ac_adapter.present']
        else:
            print "Error: ac_adapter has no property \"present\""
            return False

    def _initBattery(self):


Generated by  Doxygen 1.6.0   Back to index