예제 #1
0
    def buildStatusBar(self):

        self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
        self.statusbar.SetStatusWidths([-2, -3])
        self.statusbar.SetStatusText("Opal version 0.1", 0)
        findingBook = FindingBook()
        totalBookCount = findingBook.countAllBooks()
        self.statusbar.SetStatusText(
            "selected : " + str(len(self.books)) + " of " +
            str(totalBookCount), 1)
예제 #2
0
    def doSearch(self, text):
        global searchedBooks
        name = text
#         print 'doSearch', text
        findingBook=FindingBook()
        totalBookCount=findingBook.countAllBooks()
        books=findingBook.searchingBook(text, self.cb.GetValue())
        searchedBooks=books
        print 'doSearch', text,len(searchedBooks)
        self.GetParent().books=books
        self.GetParent().CreateThumbCtrl()
        grid=self.GetParent().grid

        data = []
        noOfBooks=len(searchedBooks)
        bookId_rowNo_dict={}
        for i in range(noOfBooks):
            d = {}
            data.append((str(i), self.GetParent().books[i].__dict__))
            bookId_rowNo_dict[self.GetParent().books[i].id]=i

        grid._table.data=data
        self.GetParent().grid.bookId_rowNo_dict=bookId_rowNo_dict
        try:
            self.GetParent().picture.root.clear_widgets()
        except Exception as e:
            print e
#         for child in self.GetParent().picture.root..clear_widgets()vchildren:
#             if type(child) == type(Picture):
#                 self.GetParent().picture.root.children.remove(child)
#         self.GetParent().picture.books=books
#         try:
#             self.GetParent().picture.root.clear_widgets(children=None)
#             for book in self.books:
#                 filename=os.path.join(book.bookPath, book.bookImgName)
#     #         for filename in glob(join(curdir, 'images', '*')):
#                 try:
#                     # load the image
#                     picture = PicturesApp(source=filename, rotation=randint(-30, 30))
#                     # add to the main field
#                     self.GetParent().picture.root.add_widget(picture)
#                 except Exception as e:
#                     Logger.exception('Pictures: Unable to load <%s>' % filename)
#         except Exception as e:
#             print e
            
        grid.Reset()
#         grid.books=searchedBooks
#         grid.loadBooks()
        self.GetParent().statusbar.SetStatusText("selected : "+str(len(books))+ " of "+ str(totalBookCount), 1)