def name(self, name=Arg(choices=source_names + ['all'], default=None, opt=False)): '''name: name of the source "all" for changing all sources''' self._arg_name = name
def change(self, service=Arg(choices=SourceFactory().source_names, default='random', opt=True), query=None, color=None): '''Change the wallpaper. service: source name to get the wallpaper from query: search term, specify multiple words by enclosing them in quotes color: preferred color''' targets = [ Target('google', query=True, color=True), Target('imgur', query=True, color=False, subcmd='search'), Target('color', query=False, color=True, src='bitmap'), Target('bing', query=False, color=False), Target('reddit', query=True, color=False), Target('deviantart', query=True, color=False), Target('favorites', query=False, color=False), Target('random', query=False, color=False) ] target = next( iter(asq_query(targets).where(lambda t: t.match(service))), None) return target.args(query, color)
def no_cache(self, no_cache=Arg(opt=True, default=False, short='noc', hidden=True)): const.cache_enabled = not no_cache
def color(self, color=Arg(choices=colorlist.keys(), default=None, opt=True)): '''Solid color run "wallp list colors" to see a list of all supported colors''' bp = BitmapParams(color=color) self.change_wallpaper(bp)
def ignore_image_filter(self, ignore_image_filter=Arg(opt=True, default=False, short='iif', hidden=True)): 'ignore_image_filter: ignore image filters such as size, dimensions, etc.' const.ignore_image_filter = ignore_image_filter
def log(self, filename, level=Arg(choices=list(log.levels.keys()), default='error', opt=True)): '''Set log file and log level. filename: file for storing the log use "stdout" to print it to screen level: log level''' self.exc_call(self._config.eset, 'client.logfile', filename) self.exc_call(self._config.eset, 'client.loglevel', log.levels[level])
def google(self, query=None, color=Arg(choices=Google.colors, default=None, opt=True), safesearch=True): '''Google Images query: search query color: preferred color safesearch: turn safe search off''' gp = GoogleParams(query=query, color=color, safesearch=safesearch) self.change_wallpaper(gp)
def search(self, image_size=Arg(choices=enum_names(ImageSize), default=ImageSize.medium.name, opt=True)): '''Search and set wallpaper from results. image_size: preferred image size''' ip = ImgurParams(method=ImgurMethod.search, query=self._query, image_size=enum_attr(ImageSize, image_size), pages=self._pages) self.change_wallpaper(ip)
def set(self, style=Arg(choices=WPStyle.strings)): '''Change wallpaper style. style: wallpaper style name''' self.exc_desktop_call('set_wallpaper_style', WPStyle(style))
def select(self, select=Arg(opt=True, default=False, short='noc', hidden=True)): pass