Package screenlets :: Module sensors :: Class Sensor
[hide private]
[frames] | no frames]

Class Sensor

source code

     object --+    
              |    
gobject.GObject --+
                  |
                 Sensor
Known Subclasses:
CPUSensor, MemorySensor, NetSensor

A base class for deriving new Sensor-types from.

Instance Methods [hide private]
 
__init__(self, interval=1000)
Create a new sensor which updates after the given interval.
source code
 
get_interval(self)
Get the update-interval time for this Sensor.
source code
 
set_interval(self, ms)
Set the update-interval time for this Sensor and start it.
source code
 
stop(self)
Immediately stop this sensor and emit the "sensor_stopped"-signal.
source code
 
on_update(self)
Override this handler in subclasses to implement your calculations and update the Sensor's attributes.
source code
 
__timeout(self)
The timeout function.
source code

Inherited from gobject.GObject: __cmp__, __delattr__, __gdoc__, __gobject_init__, __hash__, __new__, __repr__, __setattr__, chain, connect, connect_after, connect_object, connect_object_after, disconnect, disconnect_by_func, emit, emit_stop_by_name, freeze_notify, get_data, get_properties, get_property, handler_block, handler_block_by_func, handler_disconnect, handler_is_connected, handler_unblock, handler_unblock_by_func, notify, props, set_data, set_properties, set_property, stop_emission, thaw_notify, weak_ref

Inherited from object: __getattribute__, __reduce__, __reduce_ex__, __str__

Class Variables [hide private]
  __gsignals__ = dict(sensor_updated= (gobject.SIGNAL_RUN_FIRST,...
  __gtype__ = <GType screenlets+sensors+Sensor (143815240)>
Properties [hide private]

Inherited from gobject.GObject: __grefcount__

Inherited from object: __class__

Method Details [hide private]

__init__(self, interval=1000)
(Constructor)

source code 
Create a new sensor which updates after the given interval.
Overrides: gobject.GObject.__init__

on_update(self)

source code 
Override this handler in subclasses to implement your calculations and update the Sensor's attributes. Must return True to emit a signal which can then be handled within the screenlets, returning False causes the Sensor to be stopped..

__timeout(self)

source code 
The timeout function. Does nothing but calling the on_update handler and emitting a signal if the handler returned True.

Class Variable Details [hide private]

__gsignals__

Value:
dict(sensor_updated= (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())\
, sensor_stopped= (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()))