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

def guidance-power-manager::PowerManager::checkIdletime (   self  ) 

Reads the idle time and does some action. 

Definition at line 991 of file guidance-power-manager.py.

00991                            :
        """ Reads the idle time and does some action. """
        idlesec = round(self.powermanager.getIdleSeconds()/60, 2)

        disableSuspend = self.config.readEntry("disableSuspend", QVariant(False)).toBool()
        disableHibernate = self.config.readEntry("disableHibernate", QVariant(False)).toBool()

        if self.powermanager.onBattery():
            idleTime = self.config.readEntry("batteryIdleTime", QVariant(10)).toInt()
            action = str(self.config.readEntry("batteryIdleAction", QString("")))
        else:
            idleTime = self.config.readEntry("poweredIdleTime", QVariant(60)).toInt()
            action = str(self.config.readEntry("poweredIdleAction", QString("")))
        if not self.act_name.has_key(action):
            action = 'nothing'

        if idlesec - self.lastidlesec > 100:
            debug("last: %u" % (idlesec - self.lastidlesec))
            return # probably bogus idleseconds right after suspend
        self.lastidlesec = idlesec
        if self.act_call[action] == None:
            return # doing nothing anyway
        if idlesec > idleTime:
            if action == "nothing":
                note = i18np("System idle for at least %1 minute, doing nothing now.", "System idle for at least %1 minutes, doing nothing now.", idleTime)
            elif action == "blank":
                note = i18np("System idle for at least %1 minute, blanking screen now.", "System idle for at least %1 minutes, blanking screen now.", idleTime)
            elif action == "suspend":
                note = i18np("System idle for at least %1 minute, suspending now.", "System idle for at least %1 minutes, suspending now.", idleTime)
            elif action == "hibernate":
                note = i18np("System idle for at least %1 minute, hibernating now.", "System idle for at least %1 minutes, hibernating now.", idleTime)
            elif action == "shutdown":
                note = i18np("System idle for at least %1 minute, shutting down now.", "System idle for at least %1 minutes, shutting down now.", idleTime)
            self.notify(note, self.act_icon[action])
            QTimer.singleShot(2000, self.act_call[action])

class PowermanagerApp(KDialog):


Generated by  Doxygen 1.6.0   Back to index