def fixture_from_template(self, parsed_input): '''Create a new fixture from a template file.''' template_file = data.get_data('fixture/'+parsed_input[0]+'.xml') if not template_file: self.log(30, 'No fixture template with this name exists') else: xfixture = ET.parse(template_file).getroot() fixture = xpx.Fixture(element=xfixture) self.plot_file.fixtures.append(fixture)
def main(): """Initialise the argument and config parsers.""" print('This is Pylux, version '+__version__) # Initiate the argument parser and get launch arguments parser = argparse.ArgumentParser(prog='pylux', description='Entertainment documentation management suite') parser.add_argument('-v', '--version', action='version', version='%(prog`)s '+__version__) parser.add_argument('-f', '--file', dest='file', help='load this project file on launch') parser.add_argument('-V', '--verbose', dest='verbose', action='count', help='set the verbosity of output') launch_args = parser.parse_args() # Load configuration config = configparser.ConfigParser() config.read(['/etc/pylux.conf']) config.read([data.get_data('settings.conf', location='home')]) # Handle verbosity verbosity_dict = { None: 30, 1: 20, 2: 10, 3: 1} print('Logging level is '+config['advanced']['log-'+str(verbosity_dict[launch_args.verbose])]) # Load XPX file xpx_file = xpx.Document() if launch_args.file != None: xpx_file.load(launch_args.file) print('Using XPX file '+launch_args.file) else: print('No XPX file loaded') # Prepare globals for launch init_globals = { 'PLOT_FILE': xpx_file, 'CONFIG': config, 'LOG_LEVEL': verbosity_dict[launch_args.verbose]} print('Running in CLI mode\n') pylux.cli.main(init_globals)