コード例 #1
0
 def setUp(self):
     super(TestComicPageHandler, self).setUp()
     self.comic = Comic('comic_test', 'comic_dir')
     self.page_1 = Page(None, 'page_title_1', 1)
     self.page_2 = Page(None, 'page_title_2', 2)
     self.page_3 = Page(None, 'page_title_3', 3)
     self.obj = ComicPageHandler(self.comic)
     self.comic.pages = [self.page_1, self.page_2, self.page_3]
コード例 #2
0
    def load(self, filename, initial_page=0):

        loader = ComicLoaderFactory.create_loader(filename)
        loader.progress.connect(self.load_progressbar_value)

        try:
            loader.load(filename)
        except NoDataFindException as exc:
            from pynocchio.comic import Page
            logger.exception('Error in load comic! %s' % exc)
            q_file = QtCore.QFile(":/icons/notCover.png")
            q_file.open(QtCore.QIODevice.ReadOnly)
            loader.data.append(Page(q_file.readAll(), 'exit_red_1.png', 0))

        # Memorize last page on comic
        if self.comic:
            if not self.is_first_page() and not self.is_last_page():
                self.add_bookmark(table=TemporaryBookmark)
            else:
                self.remove_bookmark(table=TemporaryBookmark)

        self.comic = Comic(get_base_name(filename), get_dir_name(filename))

        self.comic.pages = loader.data
        self.comic_page_handler = ComicPageHandlerFactory.create_handler(
            False, self.comic, index=initial_page)
        self.current_directory = get_dir_name(filename)

        if is_file(filename):
            self.comic_file_filter.parse(self.current_directory)
コード例 #3
0
 def test__init__(self):
     page = Page(None, 'title', 1)
     self.assertEqual(page.data, None)
     self.assertEqual(page.title, 'title')
     self.assertEqual(page.number, 1)