def __init__(self, dictdir, outfile):
        super(Wadai5Dumper, self).__init__()
        self.dictdir = dictdir
        self.outfile = outfile
        self.first_pos = (108260, 1606) # first entry pos
        self.last_pos = (159979, 1882)  # last pos with useful info
        # (159979, 1944) is first position with useless info
        # (107887, 872) is the foreword

        eb.eb_initialize_library()
        self.book     = eb.EB_Book()
        self.appendix = eb.EB_Appendix() 
        self.hookset  = eb.EB_Hookset()
        self.gaiji    = WADAI5_GAIJI

        eb.eb_set_hooks(self.hookset, (
            (eb.EB_HOOK_NARROW_FONT, self.hook_font),
            (eb.EB_HOOK_WIDE_FONT,   self.hook_font),
            (eb.EB_HOOK_BEGIN_REFERENCE, self.hook_begin_reference),
            (eb.EB_HOOK_END_REFERENCE, self.hook_end_reference)))

        try:
            eb.eb_bind(self.book, self.dictdir)
        except eb.EBError, (error, message):
            code = eb.eb_error_string(error)
            sys.stderr.write("Error: %s: %s\n" % (code, message))
            sys.exit(1)
Esempio n. 2
0
    def __init__(self, args):
        QApplication.__init__(self, args)

        eb_initialize_library()
        self.book_manager = BookManager()

        self.setupSettings()
        self.setupUi()
Esempio n. 3
0
def get_epwing_title(dictdir):
    eb.eb_initialize_library()
    book     = eb.EB_Book()
    appendix = eb.EB_Appendix() 
    hookset  = eb.EB_Hookset()

    eb.eb_bind(book, dictdir)
    eb.eb_set_subbook(book, 0)

    title = eb.eb_subbook_title(book).decode('euc-jp')

    eb.eb_finalize_library()
    return title
    def __init__(self, dictdir, outfile):
        super(AbstractEpwingDumper, self).__init__()
        self._stop = False
        self.dictdir = dictdir
        self.outfile = outfile

        eb.eb_initialize_library()
        self.book     = eb.EB_Book()
        self.appendix = eb.EB_Appendix() 
        self.hookset  = eb.EB_Hookset()

        eb.eb_set_hooks(self.hookset, (
            (eb.EB_HOOK_NARROW_FONT, self._hook_font),
            (eb.EB_HOOK_WIDE_FONT, self._hook_font),
            (eb.EB_HOOK_BEGIN_REFERENCE, self._hook_begin_reference),
            (eb.EB_HOOK_END_REFERENCE, self._hook_end_reference),
            (eb.EB_HOOK_SET_INDENT, self._hook_set_indent),
            (eb.EB_HOOK_BEGIN_KEYWORD, self._hook_begin_keyword),
            (eb.EB_HOOK_END_KEYWORD, self._hook_end_keyword),
            (eb.EB_HOOK_BEGIN_SUPERSCRIPT, self._hook_begin_superscript),
            (eb.EB_HOOK_END_SUPERSCRIPT, self._hook_end_superscript),
            (eb.EB_HOOK_BEGIN_SUBSCRIPT, self._hook_begin_subscript),
            (eb.EB_HOOK_END_SUBSCRIPT, self._hook_end_subscript),
            (eb.EB_HOOK_BEGIN_DECORATION, self._hook_begin_emphasis),
            (eb.EB_HOOK_END_DECORATION, self._hook_end_emphasis),
            (eb.EB_HOOK_BEGIN_MONO_GRAPHIC, self._hook_begin_mono_graphic),
            (eb.EB_HOOK_END_MONO_GRAPHIC, self._hook_end_mono_graphic),
            (eb.EB_HOOK_BEGIN_COLOR_BMP, self._hook_begin_color_bmp),
            (eb.EB_HOOK_BEGIN_COLOR_JPEG, self._hook_begin_color_jpeg),
            (eb.EB_HOOK_END_COLOR_GRAPHIC, self._hook_end_color_graphic),
            (eb.EB_HOOK_BEGIN_WAVE, self._hook_begin_wave),
            (eb.EB_HOOK_END_WAVE, self._hook_end_wave),
        ))

        try:
            eb.eb_bind(self.book, self.dictdir)
        except eb.EBError, (error, message):
            code = eb.eb_error_string(error)
            sys.stderr.write("Error: %s: %s\n" % (code, message))
            sys.exit(1)