def __init__(self, awesome_title, awesome_blocks):
""" Initialize the screen window
Args
awesome_title: Awesome topic title
awesome_blocks: A list of formatted awesome content.
It has a set of names and web links for crawled awesome content.
Attributes
window: A full curses screen window
result_window: A window for showing the results
search_window: A window for search bar
y: Current y coordinates
width: The width of `window`
height: The height of `window`
awesome_title: Awesome title
awesome_blocks: It holds given `awesome_blocks` argument
matched_blocks: A list of found awesome content
max_lines: Maximum visible line count for `result_window`
top: Available top line position for current page (used on scrolling)
bottom: Available bottom line position for whole pages (as length of found lines)
current: Current highlighted line number
query: Query string for searching the awesome content
Returns
None
"""
self.window = None
self.result_window = None
self.search_window = None
self.y = 0
self.width = 0
self.height = 0
self.awesome_title = awesome_title
self.awesome_blocks = awesome_blocks
self.matched_blocks = awesome_blocks
self.init_curses()
self.init_layout()
self.max_lines = curses.LINES - 4
self.top = 0
self.bottom = self.max_lines
self.current = 0
self.run()
评论列表
文章目录