def next_photo(self, *_args): """Changes to the next photo.""" reload_config() croot = config.get('collection.dir') if not self.wallpaper_list: self.wallpaper_list = glob.glob( os.path.join(croot, '*', '*.jpg')) png_images = glob.glob( os.path.join(croot, '*', '*.png')) self.wallpaper_list.extend(png_images) random.shuffle(self.wallpaper_list) if self.wallpaper_list: self.last_rotate = time.time()-15 # to ensure next time... wallpaper = self.wallpaper_list.pop() image_file = os.path.join(croot, wallpaper) dirname, base = os.path.split(image_file) basename, _unused_ext = os.path.splitext(base) self.info_file = os.path.join(dirname, basename)+'.inf' self.image_info = infofile.parse_info_file(self.info_file) self.image_file = image_file title = self.image_info.get('title', basename) set_wallpaper(image_file, title) album = self.image_info.get('albumTitle', dirname) self.set_tooltip_for_photo('%s - %s' % (title, album))
def next_photo(self, *_args): """Changes to the next photo.""" reload_config() croot = config.get('collection.dir') if not self.wallpaper_list: self.wallpaper_list = glob.glob(os.path.join(croot, '*', '*.jpg')) png_images = glob.glob(os.path.join(croot, '*', '*.png')) self.wallpaper_list.extend(png_images) random.shuffle(self.wallpaper_list) if self.wallpaper_list: self.last_rotate = time.time() - 15 # to ensure next time... wallpaper = self.wallpaper_list.pop() image_file = os.path.join(croot, wallpaper) set_wallpaper(image_file) dirname, base = os.path.split(image_file) basename, _unused_ext = os.path.splitext(base) info_file = os.path.join(dirname, basename) + '.inf' try: fileobj = open(info_file, 'r') inf = parse_metadata(fileobj.read()) fileobj.close() except IOError: inf = {} self.image_file = image_file self.info_file = info_file title = inf.get('title', basename) album = inf.get('albumTitle', dirname) self.set_tooltip_for_photo('%s - %s' % (title, album))
def on_iconview_handle_item_activated(self, icon_view, path): """Implements an item activations: sets as wallpaper.""" iterator = icon_view.get_model().get_iter(path) data = icon_view.get_model().get_value(iterator, IV_DATA_COLUMN) set_wallpaper(data['filename']) gc.collect()