def chapter_activate(self, *args): # print args chapter_seq = args[1][0] chapter_downloaded = True if self.CHAPTER_LIST[chapter_seq][4] == 1 else False self.BUILDER.get_object("MangaDetails").hide() chapter_window = self.BUILDER.get_object("ChapterImages") chapter_window.show() gtk.Widget.do_grab_focus(chapter_window) self.CHAPTER_IMAGES.clear() self.CHAPTER_IMAGES = self.BUILDER.get_object("ChapterImageStore") # tree_view = self.BUILDER.get_object("ChapterImagesTree") # pb = gtk.gdk.pixbuf_new_from_file("C:\Users\s3752324\Pictures\loading_spinner.gif") for i in xrange(int(chapter_page_cnt)): pbloader = gtk.gdk.PixbufLoader() self.IMAGE_LOADERS.append(pbloader) self.CHAPTER_IMAGES.append([pbloader.get_pixbuf()]) qdto = QueryDTO() rs1 = qdto.get_chapter_image_urls(self.CURRENT_MANGA_ID, chapter_seq) for row in rs1: img_path = row[3] img_seq = str(row[2]) img_name, img_ext = os.path.splitext(img_path) img_loc = self.MANGA_DIR + '/' + str(self.CURRENT_MANGA_ID) + '/' + str(chapter_seq)\ + '/' + img_seq + img_ext t = threading.Thread(name=img_seq, target=self.download_image_url, args=(chapter_downloaded, img_path, img_seq, img_loc)) t.start()
def load_chapters_for_site(domain): source = SOURCES[domain] if source is not None: qdto = QueryDTO() for name, url in set(qdto.get_manga_present('%' + domain + '%')): manga = { "name": name, "url": url } dom = htmldom.HtmlDom(url) try: dom.createDom() except Exception as e: print(e.with_traceback("Could not open url " + url)) source.get_chapter_list(manga, dom) load_manga(manga, True, False) qdto.destroy(commit=False)
def populate_manga_details(self, tree): manga_id = tree.get_selection().get_selected_rows()[1][0][0] + 1 self.CHAPTER_LIST.clear() self.CURRENT_MANGA_ID = manga_id print "populating details for manga id: ", manga_id qdto = QueryDTO() details, chapter_list = qdto.populate_manga_details(manga_id) tags = str(details[8]) if details[8] is not None else '' authors = str(details[10].encode('ascii', 'replace')) if details[10] is not None else '' artists = str(details[12]) if details[12] is not None else '' manga_details = "<a href='" + details[2] + "'>" + details[1] + "</a>\n<b>Status</b>: " + details[3] \ + "\n<b>Tags</b>: " + tags + "\n<b>Authors</b>: " + authors + "\n<b>Artists</b>: " \ + artists + "\n<b>Last Updated on</b>: " + details[5] self.BUILDER.get_object("MangaTitleAndDetails").set_markup(manga_details) self.BUILDER.get_object("MangaPlotSummary").set_text(details[6]) for row in chapter_list: self.CHAPTER_LIST.append([row[1], row[7], row[4], str(row[3]), row[6], row[0], row[2]])
def load_manga(manga, with_chapters, force): qdto = QueryDTO() qdto.insert_manga(manga, with_chapters, force) qdto.destroy(commit=False)