screenlets.sensors.Sensor

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

# Class Sensor

source code

    object --+
             |
    ??.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 `unreachable.GObject`: `__copy__`, `__deepcopy__`, `__delattr__`, `__eq__`, `__gdoc__`, `__ge__`, `__gobject_init__`, `__gt__`, `__hash__`, `__le__`, `__lt__`, `__ne__`, `__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`: `__format__`, `__getattribute__`, `__reduce__`, `__reduce_ex__`, `__sizeof__`, `__str__`, `__subclasshook__`

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

Properties | [hide private]
Inherited from `unreachable.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: object.__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, ()))