Пример #1
0
    def __init__(self, feed_list, stdscr):
        self.feed_list = feed_list
        self.stdscr = stdscr
        stdscr.refresh()
        curses.start_color()
        assert curses.has_colors()
        max_y, max_x = stdscr.getmaxyx()
        self.max_y, self.max_x = max_y, max_x

        # Determine the height of our panes.
        # Vertical values are reduced by 1 to account for the status bar
        feed_list_x = max_x // 5  # width of the feed list pane
        feed_list_y = max_y - 1  # height of the feed list pane
        rest_x = max_x - feed_list_x  # width of the rest of the screen
        feed_view_y = (max_y // 4) - 1  # height of the feed view pane
        entry_y = max_y - feed_view_y - 1  # height of the rest of the screen

        self.entry_pane = EntryViewPane(feed_view_y, feed_list_x, entry_y,
                                        rest_x, max_y, max_x, self)
        self.feed_pane = FeedViewPane(0, feed_list_x, feed_view_y, rest_x,
                                      max_y, max_x, self)
        self.list_pane = FeedListPane(0, 0, feed_list_y, feed_list_x, max_y,
                                      max_x, self)
        self.next_clock = {
            self.list_pane: self.feed_pane,
            self.feed_pane: self.entry_pane,
            self.entry_pane: self.list_pane
        }
        self.next_counter = {
            self.list_pane: self.entry_pane,
            self.entry_pane: self.feed_pane,
            self.feed_pane: self.list_pane
        }
        self.mode = 'normal'
        self.focused = None
        self.focus(self.list_pane)
        self.resize_funcs = {
            'up': self.resize_up,
            'down': self.resize_down,
            'left': self.resize_left,
            'right': self.resize_right
        }
        self.list_pane.display(feed_list)
        #self.list_pane.print_sel()
        #self.list_pane.print_all()
        self.list_pane.print_changed()
        self.write_status()