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

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

Setup the the values from the config file in the UI.

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

00333                         :
        """ Setup the the values from the config file in the UI."""
        # brightness.
        if self.powermanager.hasBrightness:
            brightness_high = self.powermanager.brightness_levels
            self.BatteryBrightnessSlider.setMaximum(self.powermanager.brightness_levels-1)
            self.PoweredBrightnessSlider.setMaximum(self.powermanager.brightness_levels-1)
            batteryBrightness = self.config.readEntry("batteryBrightness", QVariant(int(brightness_high/2)))
            batteryBrightness = batteryBrightness.toInt()
            batteryBrightness = batteryBrightness[0]
            poweredBrightness = self.config.readEntry("poweredBrightness", QVariant(brightness_high))
            poweredBrightness = poweredBrightness.toInt()
            poweredBrightness = poweredBrightness[0]
            self.BatteryBrightnessSlider.setValue(batteryBrightness) #default middle
            self.PoweredBrightnessSlider.setValue(poweredBrightness) #default highest

            tt_text = "Every step increases or decreases the brightness by %i%%" % int(100/brightness_high)
            self.BatteryBrightnessSlider.setToolTip(tt_text)
            self.PoweredBrightnessSlider.setToolTip(tt_text)

        lockOnResume = self.config.readEntry("lockOnResume", QVariant(True))
        lockOnResume = lockOnResume.toBool()
        self.lockScreenOnResume.setChecked(lockOnResume)

        # Idletime-related configuration
        self._setCB(self.PoweredIdleCombo, self.cb_act, 0, str(self.config.readEntry("poweredIdleAction")))
        poweredIdleTime = self.config.readEntry("poweredIdleTime", QVariant(60))
        poweredIdleTime = poweredIdleTime.toInt()
        poweredIdleTime = poweredIdleTime[0]
        self.PoweredIdleTime.setValue(poweredIdleTime)
        self._setCB(self.BatteryIdleCombo, self.cb_act, 0, str(self.config.readEntry("batteryIdleAction")))
        batteryIdleTime = self.config.readEntry("batteryIdleTime", QVariant(10))
        batteryIdleTime = batteryIdleTime.toInt()
        batteryIdleTime = batteryIdleTime[0]
        self.BatteryIdleTime.setValue(batteryIdleTime)

        self._setCB(self.PoweredFreqCombo, self.cb_freq, self.cb_freq_def, str(self.config.readEntry("poweredFreqPolicy")))
        self._setCB(self.BatteryFreqCombo, self.cb_freq, self.cb_freq_def, str(self.config.readEntry("batteryFreqPolicy")))

        batteryIdleTime = self.config.readEntry("batteryIdleTime", QVariant(10))
        batteryIdleTime = batteryIdleTime.toInt()
        batteryIdleTime = batteryIdleTime[0]
        self.BatteryIdleTime.setValue(batteryIdleTime) # default Do nothing
        # battery critical and lid actions.
        self._setCB(self.BatteryCriticalCombo, self.cb_act, self.cb_act_def_critical, self._checkOldConfig(self.config.readEntry("batteryCriticalAction", ""), False))
        self._setRB(self.LaptopLidRadios, self.lid_act, self.lid_act_def, self._checkOldConfig(self.config.readEntry("laptopLidAction", ""), True))
        criticalRemainTime = self.config.readEntry("criticalRemainTime", QVariant(BATTERY_CRITICAL_MINUTES))
        criticalRemainTime = criticalRemainTime.toInt()
        criticalRemainTime = criticalRemainTime[0]
        self.CriticalRemainTime.setValue(criticalRemainTime)
        self.criticalLevel = self.CriticalRemainTime.value()

        # Call some slots to disable various spinboxes if necessary
        self.slotBatteryCriticalActivated()
        self.slotPoweredIdleActivated()
        self.slotBatteryIdleActivated()

    def uiToConfig(self):


Generated by  Doxygen 1.6.0   Back to index