def __init__(self, context, file_path): self.__file_path = file_path self.__offset_in_file = 0 self.__file_size = os.stat(file_path).st_size file_buffer.init(128) file_buffer.open_file(file_path) self.__context = context self.__init_context(self.__context) self.__max_y, self.__max_x = self.__context.getmaxyx() self.__event_manager = EventManager('eventmanager', self) app_box = MailBox('application@eventmanager') listeners.application.attach_listeners(app_box, self) self.__event_manager.register_listeners(app_box.listeners) system_box = MailBox('system@eventmanager') listeners.system.attach_listeners(system_box, self) self.__event_manager.register_listeners(system_box.listeners) command_box = MailBox('command@eventmanager') listeners.commands.attach_listeners(command_box, self) self.__event_manager.register_listeners(command_box.listeners) self.__event_manager.boxes.extend([app_box, system_box, command_box]) self.__init_GUI() self.__event_manager.deactivate_all_listeners() self.__event_manager.activate_listeners_in_box(app_box.address) self.__event_manager.activate_listeners_in_box(system_box.address) self.go_to(0)
def __init__(self, context, file_path): self.__file_path = file_path self.__offset_in_file = 0 self.__file_size = os.stat(file_path).st_size self.__event_history = [] self.__listeners = [] listeners.link_listeners(self) file_buffer.init(128) file_buffer.open_file(file_path) self.__context = context self.__init_context(self.__context) self.__max_y, self.__max_x = self.__context.getmaxyx() self.__init_GUI() self.go_to(0)