def update_board_tree(self, board_iden): """Updates a board tree in the board tree based on new results in the cache. This method takes a diff of the "last read" state and the "last retrieved" state and updates the label in the board tree according to this. """ board_diff = self.config.boards_cache.gen_diff(board_iden) #num_new = board_diff.num_new_posts num_new = board_diff.num_new_threads if num_new == 0: self.sidebar.board_tree.board_items[board_iden].setText(0, board_iden.title) elif num_new > 0: new_text = '%s (%d)' % (board_iden.title, num_new) self.sidebar.board_tree.board_items[board_iden].setText(0, new_text) else: logging.error('Board diff indicated a negative number of new posts for ' '(site, board) = (%s, %s). That number was %d.' % (board_iden.site_iden.name, board_iden.name, num_new))
def main_window_size(self, value): if not isinstance(value, tuple): logging.error('Refusing to set non-tuple main window size') return if len(value) != 2: logging.error('Refusing to set main window size where ' 'len(size) != 2') return if not (isinstance(value[0], int) and isinstance(value[1], int)): logging.error('Refusing to set main window size where ' 'width and height are not ints') return self.ui['main_window_size'] = value
def threadlist_height(self, value): if isinstance(value, int): self.ui['threadlist_height'] = value else: logging.error('Refusing to set non-int threadlist height.')
def sidebar_width(self, value): if isinstance(value, int): self.ui['sidebar_width'] = value else: logging.error('Refusing to set non-int sidebar width')
def board_crawl_rate(self, value): if isinstance(board_crawl_rate, int): self.general['board_crawl_rate'] = value else: logging.error('Refusing to set non-int board_crawl_rate')
def num_threads_to_list(self, value): if isinstance(value, int): self.general['num_threads_to_list'] = value else: logging.error('Refusing to set non-int num_threads_to_list"')
def debug_level(self, value): if level in logging.ALL_LEVELS: self.general['debug_level'] = level else: logging.error('Refusing to set invalid log level: %s' % value)