def save_screenshot(name): if name.count(',') > 0: names = name.split(',') for name in names: save_screenshot(name) else: path = os.path.split(name) if len(path) > 1: capture_screenshot(path[-1], os.path.join(*path[:-1])) else: capture_screenshot(name)
def capture_screenshots(self): self.create_image_folder() # FIXME: check if has name before doing this? (ie, virtual widgets disallowed) response = raw_input("Capture screenshot(s) of '%s'? " % str(self)) if not response.startswith('y'): return print "Required states: %s" % (', '.join(self.required_states)) print "Optional states: %s" % (', '.join(self.optional_states)) print "Existing states: %s" % (', '.join(self.states.keys())) states = raw_input("List the states, separated by commas, " + "you would like to capture:\n").replace(' ', '').split(',') for state in states: capture_screenshot(state, self.image_folder(), widget=self)