def __init__( self, parent, ): wx.Frame.__init__(self, parent, -1, "Test Frame", size=(640, 480)) books = FindingBook().searchingBook('lua') colnames = ['id', 'bookName', 'bookFormat'] # for b in books: # colnames=b.__dict__.keys() # break data = [] bookId_rowNo_dict = {} noOfBooks = len(books) for i in range(noOfBooks): # colnames=books[i].__dict__.keys() # print colnames d = {} data.append((str(i), books[i].__dict__)) bookId_rowNo_dict[books[i].id] = i grid = MegaGrid(self, data, colnames) grid.bookId_rowNo_dict = bookId_rowNo_dict grid.Reset() grid.SelectRow(row=3)
def startDownload(self): baseUrl = 'http://it-ebooks.info' miss = Missing() # lst = miss.missingNumbers() lst = [1464348534, 7102] for number in lst: print number # for number in range(6998, 0, -1): itebook = DownloadItEbook() url = itebook.getUrl(baseUrl, number) a = urllib2.urlopen(url) strig = a.geturl() if '404' != strig[-4:-1]: book = itebook.findBookDetail(baseUrl, number) # Is this book already availble (downloaded) # check book whethere it is existing in database. bs = FindingBook().findBookByIsbn(isbn_13=book.isbn_13) if bs: print 'this books is already present.', book.isbn_13, book.bookName else: try: self.firefoxDownloadJob(book, baseUrl, number) self.updateDatabase() except: print number, baseUrl traceback.print_exc()
def getABook(self): books = FindingBook().findAllBooks() book = None for b in books: book = b break return book
def CreateGrid(self): try: # books=FindingBook().searchingBook('flex') # self.LoadingBooks() opalStart = OpalStart() jsonFileStr = opalStart.readWorkspace() startObject = opalStart.jsonToObject(jsonFileStr) print startObject.workspace[0]['Preference']['recordPerPage'] recordPerPage = startObject.workspace[0]['Preference']['recordPerPage'] self.books = FindingBook().findAllBooks(pageSize=recordPerPage) # self.books=FindingBook().findAllBooks() colnames = ['id', 'bookName', 'bookFormat', 'authors', 'bookPath', 'isbn_13', 'isbn_10', 'inLanguage', 'series', 'rating', 'subTitle', 'uuid', 'publishedOn', 'editionNo', 'numberOfPages', 'hasCover', 'fileSize', 'publisher', 'hasCode', 'createdOn', 'dimension', 'bookDescription', 'customerReview'] data = [] bookId_rowNo_dict = {} if self.books: noOfBooks = len(self.books) print 'CreateGrid: noOfBooks:', noOfBooks for i in range(noOfBooks): d = {} data.append((str(i), self.dicForGrid(self.books[i]))) bookId_rowNo_dict[self.books[i].id] = i self.grid = MegaGrid(self, data, colnames) self.grid.bookId_rowNo_dict = bookId_rowNo_dict self.grid.Reset() except: print 'error in grid', traceback.print_exc() # self.grid.books=self.books self.grid.SetDropTarget(self.fileDropTarget) return self.grid
def deleteBook(self, event): print self.rowSelected if self.rowSelected != None: book = self._table.data[self.rowSelected][1] bookPath = book['bookPath'] print bookPath FindingBook().deleteBook(book) print("delete Book\n")
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)
def init_ui(self): self.mainWindow = wx.Frame(None) self.mainWindow.SetSize((800, 510)) # self.vbox1 = wx.BoxSizer(wx.VERTICAL) books = FindingBook().findAllBooks() book = None for b in books: book = b break print book panel = RichTextPanel(self.mainWindow, book)
def onPrevious(self, event): print 'onPrevious' bookId = self.currentBook.id self.previousBook = self.currentBook b = FindingBook().findBookByPreviousMaxId(bookId) if b: self.currentBook = b self.setValuesToPropetyGrid() self.photoPanel.currentBook = b self.photoPanel.changeBitmapWorker() if b.bookDescription != None: self.rt.rtc.ChangeValue(b.bookDescription)
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)
#---------------------------------------------------------------------- def __init__(self): wx.Frame.__init__(self, None, title='Richtext Test') win = TestPanel(self) self.Show() # def runTest(frame, nb, log): # win = TestPanel(nb, log) # return win #---------------------------------------------------------------------- overview = """<html><body> <h2><center>wx.richtext.RichTextCtrl</center></h2> </body></html> """ if __name__ == "__main__": books = FindingBook().findAllBooks() book = None for b in books: book = b break print book app = Window(book=book) app.MainLoop()