Convert tabs to spaces
This commit is contained in:
parent
c574a8f09b
commit
7936aaf147
@ -28,17 +28,17 @@ from threading import Timer
|
|||||||
# Instantiate it, then call run(interval_in_seconds, callback_function)
|
# Instantiate it, then call run(interval_in_seconds, callback_function)
|
||||||
# To stop it, call cancel()
|
# To stop it, call cancel()
|
||||||
class SensorsPollingTimer(Timer):
|
class SensorsPollingTimer(Timer):
|
||||||
def run(self):
|
def run(self):
|
||||||
# Setup
|
# Setup
|
||||||
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
|
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
|
||||||
self.proxy = Gio.DBusProxy.new_sync(bus,Gio.DBusProxyFlags.NONE,None,'net.hadess.SensorProxy','/net/hadess/SensorProxy','org.freedesktop.DBus.Properties', None)
|
self.proxy = Gio.DBusProxy.new_sync(bus,Gio.DBusProxyFlags.NONE,None,'net.hadess.SensorProxy','/net/hadess/SensorProxy','org.freedesktop.DBus.Properties', None)
|
||||||
self.oldValue = None
|
self.oldValue = None
|
||||||
|
|
||||||
# Loop
|
# Loop
|
||||||
while not self.finished.wait(self.interval):
|
while not self.finished.wait(self.interval):
|
||||||
value = self.proxy.Get('(ss)', 'net.hadess.SensorProxy', 'LightLevel')
|
value = self.proxy.Get('(ss)', 'net.hadess.SensorProxy', 'LightLevel')
|
||||||
if (self.oldValue != value):
|
if (self.oldValue != value):
|
||||||
self.oldValue = value
|
self.oldValue = value
|
||||||
unit = self.proxy.Get('(ss)', 'net.hadess.SensorProxy', 'LightLevelUnit')
|
unit = self.proxy.Get('(ss)', 'net.hadess.SensorProxy', 'LightLevelUnit')
|
||||||
self.function(value, unit) # Invoke callback
|
self.function(value, unit) # Invoke callback
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user