def change_wallpaper_loop(sleep_secs, wp_dirs, last_change_ts, collection, wpconf): # right now, wpconf here is just a copy of the WPConfig object. # when I implement a reload method, this will need to change. TODO sleep_secs = int(sleep_secs) while 1: now = int(time()) if now - last_change_ts.value >= sleep_secs: change_wallpaper(wp_dirs, collection.value, wpconf) last_change_ts.value = now sleep(1)
def change(self, split_args): dirs = self._get_dirs(split_args) if len(dirs) == 1 and os.path.isfile(dirs[0]): # Check if this is a file instead of collection apply_wallpaper(dirs[0], self._conf) else: winner = change_wallpaper(dirs, self.collection.value, self._conf) print winner self.last_change_ts.value = int(time())