def __call__(self, frame):
    if (frame.type == core.G3FrameType.Wiring):
        wiring_map = frame['WiringMap']
        squid_ids = []
        for k in wiring_map.keys():
            wm = wiring_map[k]
            squid_ids.append(get_physical_id(wm.board_serial, wm.crate_serial, wm.board_slot, (wm.module + 1)))
        squid_ids = uniquifyList(squid_ids)
        self.init_squids(squid_ids)
        self.serial_mapper = IdSerialMapper(frame['WiringMap'])
    elif (frame.type == core.G3FrameType.Housekeeping):
        if (self.squids_list is None):
            return
        if (not (frame is None)):
            hk_data = frame['DfMuxHousekeeping']
        else:
            hk_data = None
        self.stdscr.clear()
        (y, x) = self.stdscr.getmaxyx()
        if ((y < self.screen_size_y) or (x < self.screen_size_x)):
            screen = self.stdscr.subwin(0, x, 0, 0)
            screen.addstr(0, 0, ('Terminal is too small %d %d' % (y, x)), curses.color_pair(1))
            screen.refresh()
            return
        screen = self.stdscr.subwin(0, self.screen_size_x, 0, 0)
        screen.clear()
        if (not (hk_data is None)):
            add_timestamp_info(screen, 0, 2, hk_data[hk_data.keys()[0]].timestamp, 5)
            for (i, s) in enumerate(self.str_id_lst):
                offset = 4
                screen.addstr((i + 1), offset, s, curses.color_pair(2))
                screen.addstr((i + 1), (offset + self.highlight_index[i]), s[self.highlight_index[i]], curses.color_pair(3))
            screen.hline((len(self.str_id_lst) + 1), 0, '-', self.squid_col_width)
            screen.vline(0, (self.squid_col_width - 1), '|', (len(self.str_id_lst) + 1))
        for (i, s) in enumerate(self.squids_list):
            p = self.pos_map[s]
            load_squid_info_from_hk(screen, p[1], p[0], hk_data, s, s, self.sq_label_size, self.squid_col_width, self.serial_mapper)
        screen.refresh()
    elif (frame.type == core.G3FrameType.EndProcessing):
        if (not (self.squids_list is None)):
            self.stdscr.keypad(0)
            curses.echo()
            curses.nocbreak()
            curses.endwin()
def __call__(self, frame):
    if (frame.type == core.G3FrameType.Wiring):
        wiring_map = frame['WiringMap']
        squid_ids = []
        for k in wiring_map.keys():
            wm = wiring_map[k]
            squid_ids.append(get_physical_id(wm.board_serial, wm.crate_serial, wm.board_slot, (wm.module + 1)))
        squid_ids = uniquifyList(squid_ids)
        self.init_squids(squid_ids)
        self.serial_mapper = IdSerialMapper(frame['WiringMap'])
    elif (frame.type == core.G3FrameType.Housekeeping):
        if (self.squids_list is None):
            return
        if (not (frame is None)):
            hk_data = frame['DfMuxHousekeeping']
        else:
            hk_data = None
        self.stdscr.clear()
        (y, x) = self.stdscr.getmaxyx()
        if ((y < self.screen_size_y) or (x < self.screen_size_x)):
            screen = self.stdscr.subwin(0, x, 0, 0)
            screen.addstr(0, 0, ('Terminal is too small %d %d' % (y, x)), curses.color_pair(1))
            screen.refresh()
            return
        screen = self.stdscr.subwin(0, self.screen_size_x, 0, 0)
        screen.clear()
        if (not (hk_data is None)):
            add_timestamp_info(screen, 0, 2, hk_data[hk_data.keys()[0]].timestamp, 5)
            for (i, s) in enumerate(self.str_id_lst):
                offset = 4
                screen.addstr((i + 1), offset, s, curses.color_pair(2))
                screen.addstr((i + 1), (offset + self.highlight_index[i]), s[self.highlight_index[i]], curses.color_pair(3))
            screen.hline((len(self.str_id_lst) + 1), 0, '-', self.squid_col_width)
            screen.vline(0, (self.squid_col_width - 1), '|', (len(self.str_id_lst) + 1))
        for (i, s) in enumerate(self.squids_list):
            p = self.pos_map[s]
            load_squid_info_from_hk(screen, p[1], p[0], hk_data, s, s, self.sq_label_size, self.squid_col_width, self.serial_mapper)
        screen.refresh()
    elif (frame.type == core.G3FrameType.EndProcessing):
        if (not (self.squids_list is None)):
            self.stdscr.keypad(0)
            curses.echo()
            curses.nocbreak()
            curses.endwin()