Exemple #1
0
    def get_book_list(self, selection):
        ''' Get the book lists from the databases.

    Params:
    selection -- BORRORWED or ALL Which set to get.

    '''
        db_query = sql()
        result = {}
        num_ebooks = 0
        if selection == ALL:
            result, numrows = db_query.get_all_books()
            self.fill_booklist(result)
            try:
                import calibre
                e_books = calibre.calibre()
                self.booklist, num_ebooks = e_books.insert_data2(self.booklist)
            except:
                print("Cannot find any e-books.\n")
                pass  # Do nothing if it's not available.
            self.status1.set_text("Book count = " + str(numrows) +
                                  ". E-book count = " + str(num_ebooks))
        elif selection == BORROWED:
            result = db_query.get_borrowed_books()
            self.fill_booklist(result)
Exemple #2
0
  def get_book_list(self, selection):
    ''' Get the book lists from the databases.

    Params:
    selection -- BORRORWED or ALL Which set to get.

    '''
    db_query = sql()
    result = {}
    #self.booklist.clear()
    num_ebooks = 0
    if selection == ALL:
      result, numrows = db_query.get_all_books()
      #logging.info(numrows)
      
      self.fill_booklist(result)
      try:
        import calibre
        e_books = calibre.calibre()
        self.booklist, num_ebooks = e_books.insert_data2(self.booklist)
      except:
        print ("Cannot find any e-books.\n")
        pass # Do nothing if it's not available.
      self.status1.set_text("Book count = " + str(numrows) + ". E-book count = " +  str(num_ebooks))
    elif selection == BORROWED:
      result = db_query.get_borrowed_books()
      self.fill_booklist(result)
Exemple #3
0
 def on_button_search_clicked(self, widget):
   ''' Get the search string from entry_search, query the DB and display 
   the result.
   
   '''
   db_query = sql()
   search_string = self.search_string.get_text()
   if search_string == "": return
   result = db_query.search_books(search_string)
   self.fill_booklist(result,False)
   # Now search the calibre database.
   try:
     import calibre
     search = calibre.calibre()
     result = search.search_calibre(search_string, self.booklist) # search and add to booklist
   except: pass # Do nothing
   return
Exemple #4
0
    def on_button_search_clicked(self, widget):
        ''' Get the search string from entry_search, query the DB and display
        the result.

        '''
        db_query = sql()
        search_string = self.search_string.get_text()
        if search_string == "": return
        result = db_query.search_books(search_string)
        self.fill_booklist(result,False)
        # Now search the calibre database.
        try:
            import calibre
            search = calibre.calibre()
            result = search.search_calibre(search_string, self.booklist) # search and add to booklist
        except: pass # Do nothing
        return