Changeset 174
- Timestamp:
- 07/09/2005 07:12:19 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
examples/petliwm.py (modified) (4 diffs)
-
plwm/__init__.py (modified) (2 diffs)
-
plwm/mw_acpi.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/petliwm.py
r173 r174 38 38 modewindow, modestatus, \ 39 39 mw_clock, mw_acpi, \ 40 mw_watchfiles, \ 40 41 inspect, misc, input 41 42 … … 185 186 mw_clock.ModeWindowClock, 186 187 mw_acpi.ModeWindowACPI, 188 mw_watchfiles.ModeWindowWatchFiles, 187 189 inspect.InspectServer, 188 190 ModeWindowTraceIM, … … 191 193 mw_acpi_position = 0 192 194 mw_acpi_justification = modewindow.LEFT 195 196 mw_watchfiles_position = 0.85 197 mw_watchfiles_justification = modewindow.RIGHT 198 199 mw_watchfiles = (mw_watchfiles.WatchedFile('/var/run/laptop-mode-enabled', 200 present_msg = '', 201 missing_msg = 'LTM OFF'), 202 mw_watchfiles.WatchedFile('/var/run/network-error', 203 present_msg = 'NET: %s', 204 format_content = 1) 205 ) 206 207 mw_watchfiles_interval = 5 193 208 194 209 client_class = MyClient … … 297 312 298 313 def F3(self, evt): 299 self.wm.current_screen.view_find_with_client(Or(name(' Gecko'),314 self.wm.current_screen.view_find_with_client(Or(name('Firefox-bin'), 300 315 name('Mozilla'), 301 316 name('Netscape'), -
trunk/plwm/__init__.py
r170 r174 1 # $Id: __init__.py,v 1. 9 2004-11-12 23:09:14petli Exp $1 # $Id: __init__.py,v 1.10 2005-07-10 00:12:19 petli Exp $ 2 2 # 3 3 # __init__.py for package plwm … … 41 41 'mw_clock', 42 42 'mw_load', 43 'mw_watchfiles', 43 44 'outline', 44 45 'panes', -
trunk/plwm/mw_acpi.py
r170 r174 1 # $Id: mw_acpi.py,v 1. 1 2004-11-12 23:09:14petli Exp $1 # $Id: mw_acpi.py,v 1.2 2005-07-10 00:12:19 petli Exp $ 2 2 # -*- coding: iso-8859-1 -*- 3 3 # … … 207 207 208 208 info = linux_proc_read_info(path) 209 self.has_performance = info [self.PERFORMANCE_MANAGEMENT]== 'yes'210 self.has_throttling = info [self.THROTTLING_CONTROL]== 'yes'209 self.has_performance = info.get(self.PERFORMANCE_MANAGEMENT) == 'yes' 210 self.has_throttling = info.get(self.THROTTLING_CONTROL) == 'yes' 211 211 212 212 if not self.has_performance and not self.has_throttling: … … 312 312 return 0 313 313 314 315 # Not really ACPI, this one. But on Linux 2.6 kernels, the CPU frequency isn't 316 # displayed in the ACPI interface, but from the cpu-freq module. 317 318 class CpuFreqScaling: 319 EVENT = None 320 PROC_DIR = '/sys/devices/system/cpu' 321 322 SCALING_CPU_FREQ = '%s/cpufreq/scaling_cur_freq' 323 324 def __init__(self, id, path): 325 self.id = id 326 self.path = path 327 328 self.scaling_cpu_freq = self.SCALING_CPU_FREQ % (path, ) 329 330 self.messsage = '' 331 332 # frequency in kHz 333 self.freq = None 334 335 self.update() 336 337 def update(self): 338 try: 339 new_freq = int(open(self.scaling_cpu_freq).read(50)) 340 except (IOError, ValueError), e: 341 raise BadInfo('bad cpufreq: %s: %s' % (self.scaling_cpu_freq, e)) 342 343 if self.freq != new_freq: 344 self.freq = new_freq 345 self.message = '%d MHz' % (self.freq / 1000) 346 return 1 347 else: 348 return 0 349 314 350 315 351 def __init__(self): … … 381 417 self.add_units(self.Battery) 382 418 self.add_units(self.Processor) 419 self.add_units(self.CpuFreqScaling) 383 420 self.add_units(self.ThermalZone) 384 421 … … 515 552 self.mw_acpi_update(newstatus) 516 553 else: 517 wmanager.debug('acpi', 'event socket closed : %s', e)554 wmanager.debug('acpi', 'event socket closed') 518 555 self.mw_acpi_socket.close() 519 556 self.mw_acpi_socket = None
