Beispiel #1
0
    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))
Beispiel #2
0
    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
Beispiel #3
0
    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
Beispiel #4
0
 def threadlist_height(self, value):
     if isinstance(value, int):
         self.ui['threadlist_height'] = value
     else:
         logging.error('Refusing to set non-int threadlist height.')
Beispiel #5
0
 def sidebar_width(self, value):
     if isinstance(value, int):
         self.ui['sidebar_width'] = value
     else:
         logging.error('Refusing to set non-int sidebar width')
Beispiel #6
0
 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')
Beispiel #7
0
 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"')
Beispiel #8
0
 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)
Beispiel #9
0
 def threadlist_height(self, value):
     if isinstance(value, int):
         self.ui['threadlist_height'] = value
     else:
         logging.error('Refusing to set non-int threadlist height.')
Beispiel #10
0
 def sidebar_width(self, value):
     if isinstance(value, int):
         self.ui['sidebar_width'] = value
     else:
         logging.error('Refusing to set non-int sidebar width')
Beispiel #11
0
 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')
Beispiel #12
0
 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"')
Beispiel #13
0
 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)