def __init__(self, db_query):
     SignalContainer.__init__(self)
     self.__db_query = db_query
     self.artist_missions_threadpool = MissionThreadPool(
         5, 1000, self.feedback)
     self.album_missions_threadpool = MissionThreadPool(
         5, 1000, self.feedback)
Beispiel #2
0
        self.pixbuf = None
        return True


if __name__ == '__main__':
    gtk.gdk.threads_init()
    module_frame = ModuleFrame(
        os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    scrolled_window = ScrolledWindow()
    scrolled_window.set_size_request(788, 467)
    wallpaper_view = WallpaperView()
    scrolled_window.add_child(wallpaper_view)
    module_frame.add(scrolled_window)

    scrolled_window.connect("vscrollbar-state-changed",
                            wallpaper_view.load_more_background)

    download_pool = MissionThreadPool(5)
    download_pool.start()

    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            module_frame.send_module_info()
        elif message_type == "exit":
            module_frame.exit()

    module_frame.module_message_handler = message_handler
    module_frame.run()
Beispiel #3
0
            return True


def composite_images(files, width, height, write_file):
    try:
        surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
        context = cairo.Context(surface)
        cr = gtk.gdk.CairoContext(context)
        cut_width = cut_height = width / 2
        for index, f in enumerate(files):
            pixbuf = get_optimum_pixbuf_from_file(f, cut_width, cut_height)
            if index % 2 == 0:
                start_x = 0
            else:
                start_x = cut_width
            if index <= 1:
                start_y = 0
            else:
                start_y = cut_height
            cr.set_source_pixbuf(pixbuf, start_x, start_y)
            cr.paint()
        surface.write_to_png(write_file)
        return write_file
    except:
        return None


DoubanCover = DoubanCoverManager()
cover_thread_pool = MissionThreadPool(5)
cover_thread_pool.start()
            try:
                if os.path.exists(old_path): os.unlink(old_path)
            except:
                pass

            try:
                if os.path.exists(new_path): os.unlink(new_path)
            except:
                pass

            return False
        else:
            try:
                if os.path.exists(new_path): os.unlink(new_path)
            except:
                pass

            try:
                if os.path.exists(old_path): os.unlink(old_path)
            except:
                pass

            pixbuf.save(new_path, "jpeg", {"quality": "100"})
            del pixbuf
            return True


cache_manager = CacheManager()
cache_thread_pool = MissionThreadPool(5)
cache_thread_pool.start()