def write(self, inplace=False): """ Writes the current state to the (eventually given) filename """ # determine filename if not inplace: filename = self.filename + '.edit' else: filename = self.filename # write Out.ok('Writing schematic to ' + filename) with open(filename,'w') as out_file: out_file.write(self.serialize())
def print_matches(self): """ Print all matching components """ Out.ok('Matching components:') for component in self.matching_components: Out.log(component)
def verify_matches(self): """ Show matches and ask to continue """ self.print_matches() if not self.confirm('Proceed?'): Out.ok('Bye!') sys.exit()