/usr/share/pyshared/hachoir_wx/dispatcher.py is in python-hachoir-wx 0.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # -*- coding: utf-8 -*-
class dispatcher_t:
def __init__(self):
self.receivers = []
def add(self, who):
self.add_sender(who)
self.add_receiver(who)
def add_sender(self, sender):
sender.dispatcher = self
def add_receiver(self, receiver):
self.receivers.append(receiver)
def trigger(self, event_name, *args):
handler_name = 'on_' + event_name
unhandled_name = 'on_unhandled'
for receiver in self.receivers:
if hasattr(receiver, handler_name):
getattr(receiver, handler_name)(self, *args)
elif hasattr(receiver, unhandled_name):
getattr(receiver, unhandled_name)(self, event_name, *args)
|