Before Width: | Height: | Size: 564 B |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 830 B |
Before Width: | Height: | Size: 859 B |
Before Width: | Height: | Size: 841 B |
Before Width: | Height: | Size: 841 B |
Before Width: | Height: | Size: 835 B |
Before Width: | Height: | Size: 836 B |
Before Width: | Height: | Size: 831 B |
Before Width: | Height: | Size: 855 B |
Before Width: | Height: | Size: 867 B |
Before Width: | Height: | Size: 849 B |
Before Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 394 B |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 400 B |
Before Width: | Height: | Size: 400 B |
Before Width: | Height: | Size: 398 B |
Before Width: | Height: | Size: 396 B |
Before Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 909 B |
Before Width: | Height: | Size: 12 KiB |
@ -1,49 +0,0 @@
|
||||
guidance-power-manager TODO:
|
||||
------------------------------
|
||||
- [brightness preview], see below
|
||||
- make power-manager non-blocking
|
||||
- Wait with hibernate / suspending if the plug has just been pulled
|
||||
Some batteries only report remaining_time correctly after 30 or so
|
||||
seconds
|
||||
|
||||
|
||||
DUNNO's:
|
||||
---------
|
||||
- How to detect how long the machine is idle?
|
||||
- How to perform actions that need root privileges (and are not available via HAL)?
|
||||
- Should we notify when battery is fully charged?
|
||||
|
||||
FIXED:
|
||||
-------
|
||||
- What is "blank"? "Screen Saver", "Blank Screen" or "Monitor off"?
|
||||
- Handle CPU hotplugging gracefully (try switching off one CPU when g-p-m is running...)
|
||||
- Make use of kstandardirs
|
||||
- Add icons to contextmenu
|
||||
- Remove brightness controls when not hasBrighness
|
||||
- Remove battery-specifif items from tooltip when there's no battery
|
||||
- Make settings dialogue not apply instantly (Save config only on OK and Apply)
|
||||
- Add cpu frequency to tooltip
|
||||
- Add icons to tooltip
|
||||
- Make tooltip size properly
|
||||
- battery hotplugging
|
||||
- Implement switchToBattery(), collecting all stuff for onBattery
|
||||
- notify
|
||||
- blantdescreensaveronly
|
||||
- lowerbrightness
|
||||
|
||||
- Implement switchToAC(), collecting stuff to run when plugged in:
|
||||
- notify
|
||||
- undo blantdescreensaveronly
|
||||
- up brightness
|
||||
- Clicking onto the slider should move the handle to the closest tick, but how?
|
||||
- support for second battery
|
||||
|
||||
[brightness preview]
|
||||
Currently there is only a brightness preview for the currently active scheme (_either_ mains or battery powered).
|
||||
That means if you want to set the battery brightness when you are currently mains powered, you'll probably
|
||||
move the battery slider, realise that there is no preview, go to the mains slider, move it till you found a nice
|
||||
brightness level, then go back to the battery slider and set it there. Would be nicer to have a preview for both sliders:
|
||||
Whenever you move to a new location, the brightness is adjusted. Has to be tested if it should be set back to
|
||||
previous value after 5 seconds, or if it should remain till you either move the other slider or click save (assuming
|
||||
explicit apply).
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "stopping guidance-power-manager ..."
|
||||
dcop `dcopfind -a "power-manager*"` MainApplication-Interface quit
|
||||
|
||||
echo "starting guidance-power-manager ..."
|
||||
guidance-power-manager.py &
|
@ -1,147 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: UTF-8 -*-
|
||||
"""
|
||||
Copyright 2008 Sebastian Kügler, Canonical Ltd, Luka Renko
|
||||
|
||||
Authors:
|
||||
Andreas Wenning <awen@awen.dk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
A frontend to HAL's power features for KDE - Helper application
|
||||
This application listens for HAL signals and issues dcop-calls to the
|
||||
kde-power-manager that originally started it. To avoid the need for
|
||||
kde-power-manager to shut it's helper down, this application
|
||||
will automatically shut down if it's kde-power-manager isn't running.
|
||||
"""
|
||||
|
||||
import dbus, sys, time
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
import gobject
|
||||
from dcopext import DCOPClient, DCOPObj, DCOPApp
|
||||
|
||||
class GPMHelper():
|
||||
def mother_alive(self):
|
||||
"""Check that our mother is still alive"""
|
||||
found = False
|
||||
for name in self.dcop.registeredApplications():
|
||||
name = str(name)
|
||||
if name == self.motherName:
|
||||
found = True
|
||||
if not found:
|
||||
"""No mother; commit suicide"""
|
||||
print "guidance-power-manager not alive; exiting"
|
||||
loop.quit()
|
||||
|
||||
"""Called when signal is received"""
|
||||
def signal_recv(self, *args):
|
||||
if args[0] == "ButtonPressed":
|
||||
if args[1] == "brightness-up":
|
||||
if time.time()-0.02 <= self.last_brightness_up <= time.time():
|
||||
"""Most likely an extra brightness-up call, discarding"""
|
||||
print "Extra brightness-up call discarded"
|
||||
return
|
||||
try:
|
||||
ok, foo = self.mother.brightnessUp()
|
||||
if not ok:
|
||||
print "brightnessUp-call failed"
|
||||
return self.mother_alive()
|
||||
self.last_brightness_up = time.time()
|
||||
except:
|
||||
print "brightnessUp-call failed"
|
||||
return self.mother_alive()
|
||||
elif args[1] == "brightness-down":
|
||||
if time.time()-0.02 <= self.last_brightness_down <= time.time():
|
||||
"""Most likely an extra brightness-down call, discarding"""
|
||||
print "Extra brightness-down call discarded"
|
||||
return
|
||||
try:
|
||||
ok, foo = self.mother.brightnessDown()
|
||||
if not ok:
|
||||
print "brightnessDown-call failed"
|
||||
return self.mother_alive()
|
||||
self.last_brightness_down = time.time()
|
||||
except:
|
||||
print "brightnessDown-call failed"
|
||||
return self.mother_alive()
|
||||
elif args[1] == "sleep":
|
||||
if time.time()-1 <= self.last_sleep <= time.time():
|
||||
"""Most likely an extra sleep-call, discarding"""
|
||||
print "Extra sleep-call discarded"
|
||||
return
|
||||
try:
|
||||
ok, foo = self.mother.suspend()
|
||||
if not ok:
|
||||
print "suspend-call failed"
|
||||
return self.mother_alive()
|
||||
self.last_sleep = time.time()
|
||||
except:
|
||||
print "suspend-call failed"
|
||||
return self.mother_alive()
|
||||
elif args[1] == "hibernate":
|
||||
if time.time()-1 <= self.last_hibernate <= time.time():
|
||||
"""Most likely an extra hibernate-call, discarding"""
|
||||
print "Extra hibernate-call discarded"
|
||||
return
|
||||
try:
|
||||
ok, foo = self.mother.hibernate()
|
||||
if not ok:
|
||||
print "hibernate-call failed"
|
||||
return self.mother_alive()
|
||||
self.last_hibernate = time.time()
|
||||
except:
|
||||
print "hibernate failed"
|
||||
return self.mother_alive()
|
||||
|
||||
def __init__(self):
|
||||
"""Connect to HAL"""
|
||||
self.dbus_loop = DBusGMainLoop(set_as_default=True)
|
||||
self.bus = dbus.SystemBus(mainloop=self.dbus_loop)
|
||||
hal_manager_obj = self.bus.get_object("org.freedesktop.Hal",u'/org/freedesktop/Hal/Manager')
|
||||
self.hal_manager = dbus.Interface(hal_manager_obj, "org.freedesktop.Hal.Manager")
|
||||
|
||||
"""Find button-devices and to connect to"""
|
||||
button_devices = self.hal_manager.FindDeviceByCapability("button")
|
||||
for device in button_devices:
|
||||
self.bus.add_signal_receiver(self.signal_recv,
|
||||
"Condition",
|
||||
"org.freedesktop.Hal.Device",
|
||||
"org.freedesktop.Hal",
|
||||
device)
|
||||
"""Let's find our mother"""
|
||||
self.dcop = DCOPClient()
|
||||
self.dcop.attach()
|
||||
found = False
|
||||
for name in self.dcop.registeredApplications():
|
||||
name = str(name)
|
||||
if name.startswith('guidance-'):
|
||||
self.motherName = name
|
||||
try:
|
||||
self.mother = DCOPObj(name, self.dcop, 'power-manager')
|
||||
found = True
|
||||
except:
|
||||
"""Do nothing, catched by found=False"""
|
||||
break
|
||||
if not found:
|
||||
"""No mother; commit suicide"""
|
||||
print "No guidance-power-manager is running"
|
||||
sys.exit()
|
||||
|
||||
"""Some laptops issue double sleep/hibernate-calls, we need to discard one in that case"""
|
||||
self.last_sleep = 0
|
||||
self.last_hibernate = 0
|
||||
|
||||
"""And multiple brightness calls is also possible"""
|
||||
self.last_brightness_up = 0
|
||||
self.last_brightness_down = 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
gpmh = GPMHelper()
|
||||
loop = gobject.MainLoop()
|
||||
loop.run()
|
@ -1,35 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=Power Manager
|
||||
Name[el]=Διαχειριστής ενέργειας
|
||||
Name[es]=Administrador de energía
|
||||
Name[et]=Toitehaldur
|
||||
Name[it]=Gestore dell'energia
|
||||
Name[ja]=電源管理
|
||||
Name[nl]=Energiebeheer
|
||||
Name[pt]=Gestor de Energia
|
||||
Name[pt_BR]=Gerenciador de Energia
|
||||
Name[sr]=Управљач енергијом
|
||||
Name[sr@Latn]=Upravljač energijom
|
||||
Name[sv]=Energisparfunktion
|
||||
Name[xx]=xxPower Managerxx
|
||||
Comment=Power management applet
|
||||
Comment[el]=Μικροεφαρμογή διαχείρισης ενέργειας
|
||||
Comment[es]=Applet de administrador de potencia
|
||||
Comment[et]=Toitehalduse aplett
|
||||
Comment[it]=Applicazione per la gestione dell'energia
|
||||
Comment[ja]=電源管理アプレット
|
||||
Comment[nl]=Energiebeheer-applet
|
||||
Comment[pt]='Applet' de gestão de energia
|
||||
Comment[pt_BR]=Mini-aplicativo de gerenciamento de energia
|
||||
Comment[sr]=Аплет за управљање енергијом
|
||||
Comment[sr@Latn]=Aplet za upravljanje energijom
|
||||
Comment[sv]=Miniprogram för energisparfunktion
|
||||
Comment[xx]=xxPower management appletxx
|
||||
Icon=guidance-power-manager
|
||||
Exec=guidance-power-manager
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Qt;TDE;
|
||||
OnlyShowIn=TDE;
|
||||
X-DCOP-ServiceType=Unique
|
@ -1,530 +0,0 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>PowerManagerUI</class>
|
||||
<widget class="TQWidget">
|
||||
<property name="name">
|
||||
<cstring>PowerManagerUI</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>505</width>
|
||||
<height>374</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>PowerManagerUI</string>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQGroupBox">
|
||||
<property name="name">
|
||||
<cstring>GeneralSettingsBox</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>General Settings</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQCheckBox">
|
||||
<property name="name">
|
||||
<cstring>lockScreenOnResume</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lock screen on resume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="TQGroupBox">
|
||||
<property name="name">
|
||||
<cstring>MainsPoweredBox</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Mains Powered</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout17</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQLabel">
|
||||
<property name="name">
|
||||
<cstring>PoweredBrightnessLabel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQSlider">
|
||||
<property name="name">
|
||||
<cstring>PoweredBrightnessSlider</cstring>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maxValue">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="lineStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickmarks">
|
||||
<enum>Both</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>With this slider you can set the brightness when the system is plugged into the socket outlet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="TQLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout13</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer12_3_2_2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="TQLabel">
|
||||
<property name="name">
|
||||
<cstring>PoweredIdleLabel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When the system is idle for more than</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQSpinBox">
|
||||
<property name="name">
|
||||
<cstring>PoweredIdleTime</cstring>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> min</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>To prevent data loss or other damage, you can have the system suspend or hibernate, so you don't run accidentally out of battery power. Configure the number of minutes below which the machine will run the configured action.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQComboBox">
|
||||
<property name="name">
|
||||
<cstring>PoweredIdleCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="TQLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout13_2_2</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer12_3_2_2_3_2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="TQLabel">
|
||||
<property name="name">
|
||||
<cstring>PoweredFreqLabel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CPU frequency scaling policy</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQComboBox">
|
||||
<property name="name">
|
||||
<cstring>PoweredFreqCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="TQGroupBox">
|
||||
<property name="name">
|
||||
<cstring>BatteryBox</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Battery Powered</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout16</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQLabel">
|
||||
<property name="name">
|
||||
<cstring>BatteryBrightnessLabel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQSlider">
|
||||
<property name="name">
|
||||
<cstring>BatteryBrightnessSlider</cstring>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maxValue">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickmarks">
|
||||
<enum>Both</enum>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>This slider controls the brightness when the system runs on batteries</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="TQLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout14</cstring>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQComboBox" row="1" column="4">
|
||||
<property name="name">
|
||||
<cstring>BatteryIdleCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQLabel" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>BatteryIdleLabel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When the system is idle for more than</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQComboBox" row="0" column="4">
|
||||
<property name="name">
|
||||
<cstring>BatteryCriticalCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQLabel" row="0" column="1" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>BatteryCriticalLabel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When battery remaining time drops below</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQSpinBox" row="1" column="3">
|
||||
<property name="name">
|
||||
<cstring>BatteryIdleTime</cstring>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> min</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>To prevent data loss or other damage, you can have the system suspend or hibernate, so you don't run accidentally out of battery power. Configure the number of minutes below which the machine will run the configured action.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQSpinBox" row="0" column="3">
|
||||
<property name="name">
|
||||
<cstring>CriticalRemainTime</cstring>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> min</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>To prevent data loss or other damage, you can have the system suspend or hibernate, so you don't run accidentally out of battery power. Configure the number of minutes below which the machine will run the configured action.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>spacer12_3</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<spacer row="1" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>spacer12_3_2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="TQLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout13_2</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer12_3_2_2_3</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="TQLabel">
|
||||
<property name="name">
|
||||
<cstring>BatteryFreqLabel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CPU frequency scaling policy</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQComboBox">
|
||||
<property name="name">
|
||||
<cstring>BatteryFreqCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="TQButtonGroup">
|
||||
<property name="name">
|
||||
<cstring>LaptopLidRadios</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>GroupBoxPanel</enum>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>When Laptop Lid Closed</string>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="TQRadioButton">
|
||||
<property name="name">
|
||||
<cstring>laptopClosedNone</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do nothing</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQRadioButton">
|
||||
<property name="name">
|
||||
<cstring>laptopClosedBlank</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lock screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQRadioButton">
|
||||
<property name="name">
|
||||
<cstring>laptopClosedSuspend</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suspend</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Suspend to Memory</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Suspend is a sleep state, the system will consume only very little energy when suspended</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQRadioButton">
|
||||
<property name="name">
|
||||
<cstring>laptopClosedHibernate</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hibernate</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Suspend to Disk</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Hibernate or "Suspend to Disk" is a deep sleepstate, allowing the system to power off completely</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQRadioButton">
|
||||
<property name="name">
|
||||
<cstring>laptopClosedShutdown</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Shutdown</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Halt the machine</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer12_2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>213</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer11</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>31</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</vbox>
|
||||
</widget>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
@ -1,35 +0,0 @@
|
||||
import dbus
|
||||
|
||||
bus = dbus.SystemBus()
|
||||
hal_manager_obj = bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/Manager")
|
||||
hal_manager = dbus.Interface(hal_manager_obj, "org.freedesktop.Hal.Manager")
|
||||
#device_names = hal_manager.GetAllDevices()
|
||||
|
||||
ac = hal_manager.FindDeviceByCapability("ac_adapter")
|
||||
|
||||
#all_devices = hal_manager.GetAllDevices()
|
||||
|
||||
#for n in device_names: print n
|
||||
#obj = bus.get_object("org.freedesktop.Hal", u'/org/freedesktop/Hal/devices/acpi_AC')
|
||||
#obj.GetAllProperties()
|
||||
|
||||
name = ac[0]
|
||||
device_dbus_obj = bus.get_object("org.freedesktop.Hal" ,ac[0])
|
||||
properties = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
|
||||
|
||||
try:
|
||||
parent_name = properties["info.parent"]
|
||||
except KeyError:
|
||||
# no parent, must be parent of virtual_root
|
||||
parent_name = "/"
|
||||
except TypeError:
|
||||
print "Error: no properties for device %s"%name
|
||||
#continue
|
||||
print properties['ac_adapter.present']
|
||||
#for p in properties:
|
||||
# print p, " :: ", properties[p]
|
||||
if properties['ac_adapter.present']:
|
||||
print "plugged in"
|
||||
else:
|
||||
print "unplugged"
|
||||
|
@ -1,75 +0,0 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>NotifyWidget</class>
|
||||
<widget class="TQWidget">
|
||||
<property name="name">
|
||||
<cstring>NotifyWidgetUI</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>151</width>
|
||||
<height>60</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
<vsizetype>3</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Form3</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQLabel" row="0" column="0" rowspan="2" colspan="1">
|
||||
<property name="name">
|
||||
<cstring>Icon</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap></pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQLabel" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>Text</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQLabel" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>Caption</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><b>Powermanager:</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<pixmapfunction>TQPixmap</pixmapfunction>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
@ -1,606 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: UTF-8 -*-
|
||||
###########################################################################
|
||||
# Copyright (C) 2006 by Sebastian Kügler
|
||||
# <sebas@kde.org>
|
||||
#
|
||||
# Copyright: See COPYING file that comes with this distribution
|
||||
#
|
||||
###########################################################################
|
||||
# An API for changing the powerstate of a notebook
|
||||
|
||||
import dbus
|
||||
import dbus.glib
|
||||
import os, time
|
||||
from dcopext import DCOPClient, DCOPApp # Used for tdescreensaver
|
||||
import xf86misc
|
||||
|
||||
DEBUG = False
|
||||
|
||||
def debug(msg):
|
||||
""" Print debug message to terminal. """
|
||||
if DEBUG:
|
||||
print msg
|
||||
|
||||
# Default values for actions when battery runs out.
|
||||
BATTERY_CRITICAL_MINUTES=5
|
||||
|
||||
# Only do an emergency suspend if charge level percentage is below ...
|
||||
CHARGE_LEVEL_THRESHOLD = 10
|
||||
|
||||
isroot = os.environ["USER"] == "root"
|
||||
|
||||
# Send suspend / hibernate commands to HAL or use Sx_COMMANDS
|
||||
SUSPEND_USE_HAL = True
|
||||
|
||||
# Show the cpu frequency widgets in the tooltip?
|
||||
SHOW_CPUFREQ = True
|
||||
|
||||
|
||||
# Command to initiate suspend-to-disk when not using HAL
|
||||
S4_COMMAND = "/usr/local/bin/hibernate"
|
||||
# Command to initiate suspend-to-ram when not using HAL
|
||||
S3_COMMAND = "/usr/local/bin/s2ram"
|
||||
|
||||
# Override isLaptop method
|
||||
#IS_LAPTOP = True
|
||||
|
||||
def _readValue(filename, line=0):
|
||||
""" Reads a single value from the first line of a file. """
|
||||
fhandle = open(filename)
|
||||
value = fhandle.readlines()[line][:-1]
|
||||
fhandle.close()
|
||||
return value
|
||||
|
||||
class PowerManage:
|
||||
""" Class providing low-level power managerment functionality. """
|
||||
|
||||
def __init__(self):
|
||||
# (En|Dis)able using hdparm to set disk timeout
|
||||
self.USE_HDPARM = True
|
||||
# (En|Dis)able using laptop_mode to make the disk spin up less often
|
||||
self.USE_LAPTOP_MODE = True
|
||||
# (En|Dis)able using cpufreq to control cpu frequency scaling
|
||||
self.USE_CPUFREQ = True
|
||||
# (En|Dis)able using wireless adapter powermanagement (causes lag in network connection)
|
||||
self.USE_WI_PM = True
|
||||
# (En|Dis)able using display powermanagement
|
||||
self.USE_DPMS = True
|
||||
# (En|Dis)able using display brightness switching
|
||||
self.USE_DISPLAY = True
|
||||
# (En|Dis)able screensaver blankonly
|
||||
self.SCREENSAVER_BLANKONLY = True
|
||||
|
||||
|
||||
try:
|
||||
xg = xf86misc.XF86Server()
|
||||
self.xscreen = xg.getDefaultScreen()
|
||||
except xf86misc.XF86Error:
|
||||
print "Problem connecting to X server for idletime detection."
|
||||
# Currently only used in the test method
|
||||
self.display_dark = 0.5
|
||||
self.display_light = 1
|
||||
|
||||
# Some status initialisations
|
||||
self.lowBatteryState = False
|
||||
self.warningBatteryState = False
|
||||
self.criticalBatteryState = False
|
||||
|
||||
self.criticalBatteryState = False
|
||||
self.lidClosedState = False
|
||||
|
||||
# What does HAL support on this machine
|
||||
self.hasBrightness = False
|
||||
self.hasAC = False
|
||||
self.hasLid = False
|
||||
self.hasBattery = False
|
||||
self.hasCpuFreqGovernors = False
|
||||
|
||||
# Used to track if the previous check reported a battery to determine
|
||||
# if we want to fire a notice "battery removed|plugged in"
|
||||
self.wasOnBattery = False
|
||||
self._initHAL()
|
||||
self._initBrightness()
|
||||
self._initBattery()
|
||||
self._initAc()
|
||||
self._initLid()
|
||||
self._checkSuspend()
|
||||
self._checkCpuCapabilities()
|
||||
self._findDisks()
|
||||
|
||||
def checkHAL(self):
|
||||
""" Handle HAL and DBus restarts """
|
||||
try:
|
||||
self.hal_manager.FindDeviceByCapability("")
|
||||
except dbus.DBusException, e:
|
||||
if str(e) == 'org.freedesktop.DBus.Error.Disconnected: Connection is closed' \
|
||||
or str(e) == 'org.freedesktop.DBus.Error.Disconnected: Connection was disconnected before a reply was received':
|
||||
# DBus doesn't support on-the-fly restart
|
||||
print "connection with DBus lost, please restart the display manager"
|
||||
return
|
||||
|
||||
if os.system("ps aux|grep [h]ald-runner") == 0:
|
||||
print "connection with HAL lost, trying to reconnect"
|
||||
self._initHAL()
|
||||
self._initBrightness()
|
||||
self._initBattery()
|
||||
self._initAc()
|
||||
self._initLid()
|
||||
self._checkSuspend()
|
||||
self._checkCpuCapabilities()
|
||||
else:
|
||||
print "HAL is not running"
|
||||
|
||||
def isLaptop(self):
|
||||
""" Detect if system is laptop. """
|
||||
try:
|
||||
return IS_LAPTOP
|
||||
except NameError:
|
||||
pass
|
||||
self.computerObject = self.bus.get_object("org.freedesktop.Hal",
|
||||
u'/org/freedesktop/Hal/devices/computer')
|
||||
properties = self.computerObject.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
|
||||
# formfactor sometimes (ppc) also reports "unknown" for laptops
|
||||
# workaround: consider laptop anything with primary battery (see LP #64053)
|
||||
return properties["system.formfactor"] == "laptop" or self.hasBattery
|
||||
|
||||
def _findDisks(self):
|
||||
""" Scan /sys/block for non-removable and non-ramdisks, used for hdparm actions,
|
||||
currently not implemented in the powermanager frontend. """
|
||||
self.disks = []
|
||||
blk_path = "/sys/block/"
|
||||
for d in os.listdir(blk_path):
|
||||
# No RAM disks, no DM-RAID
|
||||
if d.startswith("ram") or d.startswith("dm"):
|
||||
continue
|
||||
fhandle = open(blk_path+d+"/removable")
|
||||
if fhandle.readlines()[0][:-1] == "0":
|
||||
self.disks.append(d)
|
||||
debug("Detected disks: "+" ".join(self.disks))
|
||||
|
||||
def onBattery(self):
|
||||
""" 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):
|
||||
""" Looks for a battery in HAL. """
|
||||
batteryDevices = self.hal_manager.FindDeviceByCapability("battery")
|
||||
self.batteries = {}
|
||||
self.batteryIsPresent = {}
|
||||
|
||||
numBatt = 0
|
||||
for batt in batteryDevices:
|
||||
battObj = self.bus.get_object("org.freedesktop.Hal", batt)
|
||||
properties = battObj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
|
||||
if properties['battery.type'] != "primary":
|
||||
continue
|
||||
self.batteries[numBatt] = battObj
|
||||
self.batteryIsPresent[numBatt] = properties['battery.present']
|
||||
numBatt += 1
|
||||
|
||||
if numBatt > 0:
|
||||
self.hasBattery = True
|
||||
else:
|
||||
self.hasBattery = False
|
||||
print "No battery found."
|
||||
|
||||
def getBatteryState(self,batt):
|
||||
""" Read battery status from HAL and return
|
||||
(battery state, charge percentage, remaining seconds).
|
||||
"""
|
||||
try:
|
||||
properties = self.batteries[batt].GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
|
||||
except dbus.DBusException:
|
||||
print "problem getting battery state from dbus."
|
||||
return "not present", 0, 0, 0, 0, 0
|
||||
|
||||
if not properties['battery.present']:
|
||||
return "not present", 0, 0, 0, 0, 0
|
||||
else:
|
||||
current = full = level = remain = rate = 0
|
||||
if properties.has_key("battery.charge_level.current"):
|
||||
current = properties["battery.charge_level.current"]
|
||||
if properties.has_key("battery.charge_level.last_full"):
|
||||
full = properties["battery.charge_level.last_full"]
|
||||
|
||||
if properties["battery.rechargeable.is_charging"]:
|
||||
state = "charging"
|
||||
elif properties["battery.rechargeable.is_discharging"]:
|
||||
if self.onBattery():
|
||||
state = "discharging"
|
||||
else:
|
||||
state = "charged"
|
||||
elif not properties["battery.rechargeable.is_discharging"] \
|
||||
and not properties["battery.rechargeable.is_charging"]:
|
||||
if current == 0:
|
||||
state = "empty"
|
||||
else:
|
||||
state = "charged"
|
||||
else:
|
||||
print "Unknown battery state ..."
|
||||
|
||||
# Sometimes, HAL doesn't report the percentage, but we can compute that ourselves anyway
|
||||
if properties.has_key("battery.charge_level.percentage"):
|
||||
level = properties["battery.charge_level.percentage"]
|
||||
elif current > 0 and full > 0:
|
||||
level = current / full
|
||||
|
||||
if state in ("charging","discharging"):
|
||||
if properties.has_key("battery.remaining_time"):
|
||||
remain = properties["battery.remaining_time"]
|
||||
if properties.has_key("battery.charge_level.rate"):
|
||||
rate = properties["battery.charge_level.rate"]
|
||||
|
||||
return state, level, remain, rate, current, full
|
||||
|
||||
def showInfo(self):
|
||||
""" Outputs some random information to show that it does not work yet. """
|
||||
print "OnBattery:", self.onBattery()
|
||||
print "CPUs:", len(self.cpus)
|
||||
|
||||
def _initHAL(self):
|
||||
""" Initialise HAL client to be used later. """
|
||||
self.bus = dbus.SystemBus()
|
||||
hal_manager_obj = self.bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/Manager")
|
||||
self.hal_manager = dbus.Interface(hal_manager_obj, "org.freedesktop.Hal.Manager")
|
||||
|
||||
def _initLid(self):
|
||||
""" Find out if there's a Lid device. """
|
||||
lidDevice = self.hal_manager.FindDeviceStringMatch("button.type", "lid")
|
||||
if len(lidDevice) >= 1:
|
||||
self.hasLid = True
|
||||
self.lidObject = self.bus.get_object("org.freedesktop.Hal" ,lidDevice[0])
|
||||
|
||||
def _initAc(self):
|
||||
""" Search HAL for detecting if power is plugged in. """
|
||||
acDevice = self.hal_manager.FindDeviceByCapability("ac_adapter")
|
||||
if len(acDevice) >= 1:
|
||||
self.hasAC = True
|
||||
self.acObject = self.bus.get_object("org.freedesktop.Hal" ,acDevice[0])
|
||||
|
||||
def _checkSuspend(self):
|
||||
""" Ask HAL whether we can suspend / hibernate. """
|
||||
if SUSPEND_USE_HAL:
|
||||
self.computerObject = self.bus.get_object("org.freedesktop.Hal",
|
||||
u'/org/freedesktop/Hal/devices/computer')
|
||||
properties = self.computerObject.GetAllProperties(
|
||||
dbus_interface="org.freedesktop.Hal.Device")
|
||||
self.canSuspend = properties["power_management.can_suspend"]
|
||||
self.canHibernate = properties["power_management.can_hibernate"]
|
||||
else:
|
||||
self.canSuspend = self.canHibernate = True
|
||||
|
||||
def _initBrightness(self):
|
||||
""" Search HAL for a screen with brightness controls."""
|
||||
|
||||
brightnessDevice = self.hal_manager.FindDeviceByCapability("laptop_panel")
|
||||
|
||||
if len(brightnessDevice) >= 1:
|
||||
self.hasBrightness = True
|
||||
self.brightnessObject = self.bus.get_object("org.freedesktop.Hal", brightnessDevice[0])
|
||||
self.brightness_properties = self.brightnessObject.GetAllProperties(
|
||||
dbus_interface="org.freedesktop.Hal.Device")
|
||||
try:
|
||||
self.brightness_levels = self.brightness_properties[u'laptop_panel.num_levels']
|
||||
except KeyError,e:
|
||||
self.hasBrightness = False
|
||||
return 0 # Really don't know what to do here, but don't crash in any case.
|
||||
try:
|
||||
self.old_b = self.brightness_levels[-1] # Setting cached brightness value to brightest
|
||||
except TypeError,e:
|
||||
return 0 # Really don't know what to do here, but don't crash in any case.
|
||||
|
||||
def getBrightness(self):
|
||||
""" Read brightness from HAL. """
|
||||
if not self.hasBrightness:
|
||||
debug("Brightness setting not supported.")
|
||||
return
|
||||
try:
|
||||
b = self.brightnessObject.GetBrightness(
|
||||
dbus_interface="org.freedesktop.Hal.Device.LaptopPanel")
|
||||
except dbus.DBusException, e:
|
||||
# Sometimes, right after resume, the HAL call
|
||||
# fails, in that case, we return the last value
|
||||
# and hope that it goes well next time.
|
||||
print "Warning: in getBrightness(): ", e
|
||||
# try and return the old brightness setting, but don't die in any case:
|
||||
try:
|
||||
return self.old_b
|
||||
except AttributeError, errmsg:
|
||||
return
|
||||
self.old_b = b
|
||||
return b
|
||||
|
||||
def adjustBrightness(self, level):
|
||||
""" Adjust the brightness via HAL. """
|
||||
if not self.hasBrightness:
|
||||
debug("Brightness setting not supported.")
|
||||
return
|
||||
try:
|
||||
self.brightnessObject.SetBrightness(level,
|
||||
dbus_interface="org.freedesktop.Hal.Device.LaptopPanel")
|
||||
except dbus.DBusException, e:
|
||||
print e
|
||||
|
||||
def _checkCpuCapabilities(self):
|
||||
""" Find out the number of CPUs / cores, check which governors are avaible."""
|
||||
cpufreq_dir = "/sys/devices/system/cpu"
|
||||
self.cpus = []
|
||||
for cpu in os.listdir(cpufreq_dir):
|
||||
if cpu.startswith('cpu') and cpu != 'cpuidle':
|
||||
self.cpus.append(cpu)
|
||||
self.cpus.sort()
|
||||
|
||||
# Map our policies to cpufreq governors.
|
||||
self.cpu_policy = {}
|
||||
self.cpu_policy['dynamic/ac'] = []
|
||||
self.cpu_policy['dynamic/battery'] = []
|
||||
self.cpu_policy['powersave'] = []
|
||||
self.cpu_policy['performance'] = []
|
||||
|
||||
try:
|
||||
comp_obj = self.bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/devices/computer')
|
||||
self.cpufreq = dbus.Interface(comp_obj, 'org.freedesktop.Hal.Device.CPUFreq')
|
||||
self.governor_available = self.cpufreq.GetCPUFreqAvailableGovernors()
|
||||
except dbus.DBusException:
|
||||
return
|
||||
self.hasCpuFreqGovernors = True
|
||||
|
||||
if 'ondemand' in self.governor_available:
|
||||
self.cpu_policy['dynamic/ac'].append('ondemand')
|
||||
self.cpu_policy['dynamic/battery'].append('ondemand')
|
||||
if 'conservative' in self.governor_available:
|
||||
self.cpu_policy['dynamic/ac'].append('conservative')
|
||||
self.cpu_policy['dynamic/battery'].insert(0,'conservative')
|
||||
if 'userspace' in self.governor_available:
|
||||
self.cpu_policy['dynamic/ac'].append('userspace')
|
||||
self.cpu_policy['dynamic/battery'].append('userspace')
|
||||
if 'powersave' in self.governor_available:
|
||||
self.cpu_policy['powersave'].append('powersave')
|
||||
if 'performance' in self.governor_available:
|
||||
self.cpu_policy['performance'].append('performance')
|
||||
|
||||
def getSupportedCpuPolicies(self):
|
||||
""" Report a list of supported CPU policies """
|
||||
policies = []
|
||||
if len(self.cpu_policy['dynamic/ac']) > 0:
|
||||
policies.append('dynamic')
|
||||
if len(self.cpu_policy['powersave']) > 0:
|
||||
policies.append('powersave')
|
||||
if len(self.cpu_policy['performance']) > 0:
|
||||
policies.append('performance')
|
||||
return policies
|
||||
|
||||
def getCpuPolicy(self):
|
||||
""" Translate current CPU frequency governor into policy """
|
||||
if not self.USE_CPUFREQ or not self.hasCpuFreqGovernors:
|
||||
return ""
|
||||
gov = self.cpufreq.GetCPUFreqGovernor()
|
||||
for policy in self.cpu_policy.keys():
|
||||
if gov in self.cpu_policy[policy]:
|
||||
return policy.split('/')[0] # strip ac or battery off
|
||||
return gov ## return as-is - no conversion
|
||||
|
||||
def setCpuPolicy(self,policy):
|
||||
""" Using cpufreq governors. Mode is powersave, dynamic or performance. We're assuming that
|
||||
the available governors are the same for all CPUs. This method changes the cpufreq
|
||||
governor on all CPUs to a certain policy."""
|
||||
if not self.USE_CPUFREQ or not self.hasCpuFreqGovernors:
|
||||
return False
|
||||
|
||||
if policy == "dynamic":
|
||||
if self.onBattery():
|
||||
policy = "dynamic/battery"
|
||||
else:
|
||||
policy = "dynamic/ac"
|
||||
|
||||
for gov in self.cpu_policy[policy]:
|
||||
try:
|
||||
self.cpufreq.SetCPUFreqGovernor(gov)
|
||||
return True
|
||||
except dbus.DBusException:
|
||||
pass
|
||||
return False # no of governor worked
|
||||
|
||||
def cpuIsOnline(self,cpu):
|
||||
""" Check if cpu is online. CPU0 is always online, CPU1 might be unplugged. Since
|
||||
/sys/devices/system/cpu/$cpu/cpufreq is not readable for normal users, we just
|
||||
check for the cpufreq subdir (which is where it's really needed anyway).
|
||||
"""
|
||||
if cpu == "cpu0": return True
|
||||
else: return os.path.isdir("/sys/devices/system/cpu/"+cpu+"/cpufreq")
|
||||
|
||||
def getCpuState(self,cpu):
|
||||
""" Reads the status of a CPU from /sys. """
|
||||
state = {}
|
||||
state['online'] = self.cpuIsOnline(cpu)
|
||||
if not state['online']:
|
||||
debug("getCpuState: "+cpu+" is offline")
|
||||
return state
|
||||
try:
|
||||
state['cpu'] = cpu
|
||||
state['cur'] = int(_readValue("/sys/devices/system/cpu/"+cpu+"/cpufreq/scaling_cur_freq"))/1000
|
||||
state['governor'] = _readValue("/sys/devices/system/cpu/"+cpu+"/cpufreq/scaling_governor")
|
||||
state['driver'] = _readValue("/sys/devices/system/cpu/"+cpu+"/cpufreq/scaling_driver")
|
||||
state['steps'] = []
|
||||
freqs = _readValue("/sys/devices/system/cpu/"+cpu+"/cpufreq/scaling_available_frequencies")
|
||||
except IOError:
|
||||
# CPUFREQ has gone away, let's disable it.
|
||||
state['online'] = False
|
||||
return state
|
||||
for v in freqs.split():
|
||||
state['steps'].append(int(v)/1000)
|
||||
state['max'] = max(state['steps'])
|
||||
state['min'] = min(state['steps'])
|
||||
debug(state)
|
||||
return state
|
||||
|
||||
def getLidClosedState(self):
|
||||
""" Returns True if the lid is currently closed, or False if it isn't. """
|
||||
try:
|
||||
properties = self.lidObject.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
|
||||
return properties["button.state.value"]
|
||||
except (KeyError, dbus.DBusException):
|
||||
return False
|
||||
|
||||
def setPowerSave(self, state):
|
||||
# No SetPowerSave in Ubuntu's HAL
|
||||
try:
|
||||
self.computerObject.SetPowerSave(state,
|
||||
dbus_interface="org.freedesktop.Hal.Device.SystemPowerManagement")
|
||||
except dbus.DBusException, e:
|
||||
print "Warning: While setting SystemPowerManagement to ", state, ": ",
|
||||
print e
|
||||
|
||||
def blankScreen(self):
|
||||
""" Call dpms to switch off the screen immediately. """
|
||||
os.system('xset dpms force standby')
|
||||
|
||||
def setScreensaverBlankOnly(self,blankonly):
|
||||
""" Switches a screensaver to blankonly, so cpu hungry screensavers will not drain the poor
|
||||
battery."""
|
||||
# create a new DCOP-Client:
|
||||
client = DCOPClient()
|
||||
# connect the client to the local DCOP-server:
|
||||
client.attach()
|
||||
# create a DCOP-Application-Object to talk to amarok:
|
||||
kdesktop = DCOPApp('kdesktop', client)
|
||||
# call a DCOP-function:
|
||||
ok, foo = kdesktop.KScreensaverIface.setBlankOnly(blankonly)
|
||||
if not ok:
|
||||
debug("Failed to set kdesktop screensaver to blankonly.")
|
||||
return False
|
||||
return True
|
||||
|
||||
def getIdleSeconds(self):
|
||||
""" Get idle seconds from X server. """
|
||||
return self.xscreen.getIdleSeconds()
|
||||
|
||||
def resetIdleSeconds(self):
|
||||
""" Reset idle seconds. """
|
||||
return self.xscreen.resetIdleSeconds()
|
||||
|
||||
def test(self):
|
||||
""" Try all kinds of stuff and see what breaks."""
|
||||
print "Trying to adjust brightness ..."
|
||||
bright = self.getBrightness()
|
||||
self.adjustBrightness(2)
|
||||
time.sleep(1)
|
||||
self.adjustBrightness(bright)
|
||||
print " ... OK."
|
||||
|
||||
if self.USE_CPUFREQ:
|
||||
print "Reading speeds from cpufreq..."
|
||||
for cpu in self.cpus:
|
||||
print self.getCpuState(cpu)
|
||||
print "Report supported cpufreq policies..."
|
||||
for policy in self.cpu_policy.keys():
|
||||
print "Policy:", policy, "=", self.cpu_policy[policy]
|
||||
|
||||
print "Trying all cpufreq policies ..."
|
||||
orig_pol = self.getCpuPolicy()
|
||||
for pol in self.cpu_policy.keys():
|
||||
print ". ", pol
|
||||
self.setCpuPolicy(pol)
|
||||
self.setCpuPolicy(orig_pol)
|
||||
print "... OK."
|
||||
else:
|
||||
print "Skipping CPUFREQ: USE_CPUFREQ = False"
|
||||
|
||||
if self.SCREENSAVER_BLANKONLY:
|
||||
if self.setScreensaverBlankOnly(True):
|
||||
debug("Manipulating screensaver seems to work well.")
|
||||
else:
|
||||
debug("Manipulating screensaver seems broken.")
|
||||
|
||||
if isroot:
|
||||
print "Trying to use Disk powermanagement and laptop_mode"
|
||||
self.setDiskPM(True)
|
||||
time.sleep(1)
|
||||
self.setDiskPM(False)
|
||||
print "...OK"
|
||||
else:
|
||||
print "Skipping DiskPM, not root."
|
||||
|
||||
if self.hasLid:
|
||||
if self.getLidClosedState():
|
||||
print "Lid is closed."
|
||||
else:
|
||||
print "Lid is currently open."
|
||||
|
||||
def setDiskPM(self,on=True):
|
||||
""" Switches on laptop_mode and sets disks to advanced powermanagement."""
|
||||
if self.USE_LAPTOP_MODE:
|
||||
# Check if laptop_mode exists:
|
||||
laptop_mode = "/proc/sys/vm/laptop_mode"
|
||||
if not os.path.isfile(laptop_mode):
|
||||
self.USE_LAPTOP_MODE = False
|
||||
debug("Laptop mode not supported, no "+laptop_mode)
|
||||
else:
|
||||
fhandle = open(laptop_mode,"w")
|
||||
if on: val = 1
|
||||
else: val = 0
|
||||
fhandle.write(str(val))
|
||||
fhandle.close()
|
||||
|
||||
if self.USE_HDPARM:
|
||||
# Set disks to advanced PM
|
||||
for disk in self.disks:
|
||||
if on:
|
||||
# Switch on advanced powermanagement
|
||||
cmd = "hdparm -B1 /dev/"+disk+" > /dev/null"
|
||||
else:
|
||||
# Switch off advanced powermanagement
|
||||
cmd = "hdparm -B255 /dev/"+disk+" > /dev/null"
|
||||
if os.system(cmd) != 0:
|
||||
self.USE_HDPARM = False
|
||||
print "Switching advanced powermanagement failed, not using hdparm anymore"
|
||||
|
||||
def suspend(self):
|
||||
""" Run a suspend command, either via HAL or script. """
|
||||
if SUSPEND_USE_HAL:
|
||||
try:
|
||||
self.computerObject.Suspend(0, dbus_interface="org.freedesktop.Hal.Device.SystemPowerManagement")
|
||||
except dbus.DBusException:
|
||||
pass #we get a DBusException: No reply within specified time
|
||||
else:
|
||||
self._sleepMode(S3_COMMAND)
|
||||
|
||||
def hibernate(self):
|
||||
""" Implements suspend to disk (S4). """
|
||||
if SUSPEND_USE_HAL:
|
||||
try:
|
||||
self.computerObject.Hibernate(dbus_interface="org.freedesktop.Hal.Device.SystemPowerManagement")
|
||||
except dbus.DBusException:
|
||||
pass #we get a DBusException: No reply within specified time
|
||||
else:
|
||||
self._sleepMode(S4_COMMAND)
|
||||
|
||||
def _sleepMode(self, command):
|
||||
""" Send the system into S3 or S4 not using HAL. """
|
||||
debug("Initiating a sleep cycle")
|
||||
if os.system(command) != 0:
|
||||
print "sleepmode failed. ("+command+")"
|
||||
return False
|
||||
debug("Everything is dandy")
|
||||
return True
|
||||
|
||||
def shutdown(self):
|
||||
""" Shutdown the system via HAL. """
|
||||
self.computerObject.Shutdown(dbus_interface="org.freedesktop.Hal.Device.SystemPowerManagement")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
""" Run some tests, used for debugging."""
|
||||
pman = PowerManage()
|
||||
pman.showInfo()
|
||||
pman.test()
|
||||
|
@ -1,924 +0,0 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>Powermanager</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
<cstring>Powermanager</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>568</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Powermanager</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QTabWidget">
|
||||
<property name="name">
|
||||
<cstring>tabWidget</cstring>
|
||||
</property>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>Widget8</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Power Schemes</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>PerformanceGroup</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Performance</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout4</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer3</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>551</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QSlider">
|
||||
<property name="name">
|
||||
<cstring>PerrformanceBrightnessSlider</cstring>
|
||||
</property>
|
||||
<property name="maxValue">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickmarks">
|
||||
<enum>Both</enum>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Control the brightness setting in the active scheme</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line">
|
||||
<property name="name">
|
||||
<cstring>line1</cstring>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout6</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When system is inactive for</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox">
|
||||
<property name="name">
|
||||
<cstring>PerformanceMinutesSpin</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>minutes ...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer4</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>311</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout3</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QRadioButton">
|
||||
<property name="name">
|
||||
<cstring>PerformanceNothing</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do nothing</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton">
|
||||
<property name="name">
|
||||
<cstring>PerformanceFade</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fade display</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton">
|
||||
<property name="name">
|
||||
<cstring>PerformanceSleepmode</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Initiate sleepmode</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hibernate (S4)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standby (S3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>PerformanceSleepmodeCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>AutomaticGroup</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Automatic</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout4_3</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel1_3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer3_3</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>551</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QSlider">
|
||||
<property name="name">
|
||||
<cstring>AutomaticBrightnessSlider</cstring>
|
||||
</property>
|
||||
<property name="maxValue">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickmarks">
|
||||
<enum>Both</enum>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Control the brightness setting in the active scheme</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line">
|
||||
<property name="name">
|
||||
<cstring>line1_3</cstring>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout6_3</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel2_3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When system is inactive for</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox">
|
||||
<property name="name">
|
||||
<cstring>AutomaticMinutesSpin</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel3_3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>minutes ...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer4_3</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>311</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout3_3</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QRadioButton">
|
||||
<property name="name">
|
||||
<cstring>AutomaticNothing</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do nothing</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton">
|
||||
<property name="name">
|
||||
<cstring>AutomaticFade</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fade display</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton">
|
||||
<property name="name">
|
||||
<cstring>AutomaticSleepmode</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Initiate sleepmode</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hibernate (S4)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standby (S3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>AutomaticSleepmodeCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>PowersaveGroup</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Powersave</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout4_2</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel1_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Brightness</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer3_2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>551</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QSlider">
|
||||
<property name="name">
|
||||
<cstring>PowersaveBrightnessSlider</cstring>
|
||||
</property>
|
||||
<property name="maxValue">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickmarks">
|
||||
<enum>Both</enum>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Control the brightness setting in the active scheme</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line">
|
||||
<property name="name">
|
||||
<cstring>line1_2</cstring>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout6_2</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel2_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When system is inactive for</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox">
|
||||
<property name="name">
|
||||
<cstring>PowersaveMinutesSpin</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel3_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>minutes ...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer4_2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>311</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout3_2</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QRadioButton">
|
||||
<property name="name">
|
||||
<cstring>PowersaveNothing</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do nothing</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton">
|
||||
<property name="name">
|
||||
<cstring>PowersaveFade</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fade display</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton">
|
||||
<property name="name">
|
||||
<cstring>PowersaveSleepmode</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Initiate sleepmode</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hibernate (S4)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standby (S3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>PowersaveSleepmodeCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>Widget9</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Events</string>
|
||||
</attribute>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer row="1" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>spacer9</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>520</width>
|
||||
<height>260</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<spacer row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>spacer10</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QLayoutWidget" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>layout17</cstring>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QComboBox" row="1" column="1">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Do nothing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Performance</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Automatic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Powersave</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Suspend (S3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hibernate (S4)</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>ACPluggedinCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>layout16</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel7</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When battery power is below</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox">
|
||||
<property name="name">
|
||||
<cstring>BatteryLowPercentage</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel8</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel4</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When AC adapter is removed</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="2" column="1">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Do nothing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Performance</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Automatic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Powersave</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Suspend (S3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hibernate (S4)</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>BatteryLowCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel6</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When AC adapter is plugged in</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="3" column="1">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Do nothing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Performance</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Automatic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Powersave</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Suspend (S3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hibernate (S4)</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>LidCloseCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel5</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When the lid is closed</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="0" column="1">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Do nothing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Performance</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Automatic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Switch to Powersave</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Suspend (S3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hibernate (S4)</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>ACRemovedCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>Layout1</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonHelp</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string>F1</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>Horizontal Spacing2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonOk</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonCancel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonOk</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>Powermanager</receiver>
|
||||
<slot>accept()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonCancel</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>Powermanager</receiver>
|
||||
<slot>reject()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
pyuic -tr i18n tooltip.ui -o tooltip.py
|
||||
pyuic -tr i18n guidance_power_manager_ui.ui -o guidance_power_manager_ui.py
|
||||
pyuic -tr i18n notify.ui -o notify.py
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>ToolTip</class>
|
||||
<comment>Python:from tdeui import *</comment>
|
||||
<widget class="TQWidget">
|
||||
<property name="name">
|
||||
<cstring>ToolTip</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
<vsizetype>3</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>240</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Form1</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</vbox>
|
||||
</widget>
|
||||
<slots>
|
||||
<slot>ToolTip_destroyed( TQObject * )</slot>
|
||||
</slots>
|
||||
<pixmapfunction>TQPixmap</pixmapfunction>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|