Пример #1
0
    def __init__(self, args):
        QApplication.__init__(self, args)

        eb_initialize_library()
        self.book_manager = BookManager()

        self.setupSettings()
        self.setupUi()
Пример #2
0
def test_epwing_integrations():
    search_path = os.path.split(os.path.abspath(__file__))[0]
    print search_path

    manager = BookManager()

    book_paths = manager.find_books_in_path(search_path)
    print book_paths

    manager.add_books(*book_paths)
    ej = manager.books.items()[1][1]
    tai = manager.books.items()[0][1]

    print list(ej.search('cute'))
    list(tai.search(u'horse'))
    list(tai.search(u'horse', search_method='prefix'))[1]

    list(manager.search_all('good'))
    print list(manager.search_all_and_combine_results('good'))
Пример #3
0
class ManabiDictApplication(QApplication):
    def __init__(self, args):
        QApplication.__init__(self, args)

        eb_initialize_library()
        self.book_manager = BookManager()

        self.setupSettings()
        self.setupUi()

    def setupSettings(self):
        QCoreApplication.setOrganizationName(ORGANIZATION_NAME);
        QCoreApplication.setOrganizationDomain(ORGANIZATION_DOMAIN);
        QCoreApplication.setApplicationName(APPLICATION_NAME);
        QCoreApplication.setApplicationVersion(VERSION);

        self.settings = QSettings()

        # get installed dictionaries from stored settings and initialize them
        book_paths = [path.toString() for path in self.settings.value('book_manager/book_paths', []).toList()]
        paths_to_remove = []
        for book_path in book_paths:
            book_path = unicode(book_path)
            new_books = self.book_manager.add_books(book_path)
            if not new_books:
                # it wasn't added successfully, so delete it from the prefs
                paths_to_remove.append(book_path)
        if paths_to_remove:
            book_paths = [_ for _ in book_paths if _ not in paths_to_remove]
            self.settings.setValue('book_manager/book_paths', book_paths)


    def setupUi(self):
        dictionary = Dictionary(self.book_manager)
        dictionary.show()
        dictionary.raise_()

        self.exec_()
Пример #4
0
def test_epwing_integrations():
    search_path = os.path.split(os.path.abspath(__file__))[0]
    print search_path

    manager = BookManager()

    book_paths = manager.find_books_in_path(search_path)
    print book_paths
    
    manager.add_books(*book_paths)
    ej = manager.books.items()[1][1]
    tai = manager.books.items()[0][1]

    print list(ej.search('cute'))
    list(tai.search(u'horse'))
    list(tai.search(u'horse', search_method='prefix'))[1]

    list(manager.search_all('good'))
    print list(manager.search_all_and_combine_results('good'))