def open(self): wildcard = FileDialog.create_wildcard('JSON files', '*.json') dialog = FileDialog(action = 'open', default_directory = self.default_directory, parent = self.window.control, wildcard = wildcard) if dialog.open() == OK: runner = load(dialog.path) runner.outfile = dialog.path self.editor_area.edit(runner)
def main(argv): parser = argparse.ArgumentParser() parser.add_argument('infile', metavar='IN', help='Input file (format: JSON)') parser.add_argument('outfile', metavar='OUT', nargs='?', help='Output file (formt: Matlab)') args = parser.parse_args() if not args.outfile: root, ext = os.path.splitext(args.infile) args.outfile = root + '.mat' obj = serialize.load(args.infile) machine = obj.machine if isinstance(obj, Runner) else obj export_machine(args.outfile, machine)