Simplify handling of PyneoController._callbacks
git-svn-id: http://www.neo1973-germany.de/svn@118 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
60f1bd4e8f
commit
bff85c8a79
1 changed files with 1 additions and 8 deletions
|
@ -135,7 +135,7 @@ class MainScreen(EdjeGroup):
|
||||||
class PyneoController(object):
|
class PyneoController(object):
|
||||||
_dbus_timer = None
|
_dbus_timer = None
|
||||||
_gsm_timer = None
|
_gsm_timer = None
|
||||||
_callbacks = None
|
_callbacks = {}
|
||||||
|
|
||||||
gsm = None
|
gsm = None
|
||||||
gsm_wireless = None
|
gsm_wireless = None
|
||||||
|
@ -153,10 +153,6 @@ class PyneoController(object):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# _callbacks[callback_name] undefined
|
# _callbacks[callback_name] undefined
|
||||||
class_._callbacks[event_name] = [callback]
|
class_._callbacks[event_name] = [callback]
|
||||||
|
|
||||||
except TypeError:
|
|
||||||
# _callbacks undefined and thus can't be subscripted
|
|
||||||
class_._callbacks = {event_name: [callback]}
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def notify_callbacks(class_, event_name):
|
def notify_callbacks(class_, event_name):
|
||||||
|
@ -164,9 +160,6 @@ class PyneoController(object):
|
||||||
for cb in class_._callbacks[event_name]:
|
for cb in class_._callbacks[event_name]:
|
||||||
cb()
|
cb()
|
||||||
|
|
||||||
except TypeError:
|
|
||||||
# Is raised when _callbacks is none and thus can't be subscripted
|
|
||||||
pass
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue