def create_slides(): log.info("in create slide") log.info("json data %s", request.json) data = request.json log.info ("data : %s", data) if not data: return json.dumps({'Status':"Failed!"}) else: data = json.loads(data) core.generate(data['title'], data['author'], data['paragraphs'], data['backend']) log.info("done") return json.dumps({'Status':"Success!"})
def main(): """Parses command line arguments and runs the LTL contract checker tool""" # initialize default command line values version = '1.0' verbose = False spec_file = 'system.spec' smv_file = 'nusmv.smv' # configure command line short-form and long-form options options, _ = getopt.getopt(sys.argv[1:], 'hvi:o:', ['verbose=', 'spec=', 'smv=']) # parse command line arguments for opt, arg in options: if opt == '-h': print 'test.py -i <specfile> -o <smvfile>' sys.exit() elif opt in ('-v', '--verbose'): verbose = True elif opt in ('-i', '--spec'): spec_file = arg elif opt in ('-o', '--smv'): smv_file = arg # print tool configurations if verbose: print 'VERSION :', version print 'VERBOSE :', verbose print 'SPEC_FILE :', spec_file print 'SMV_FILE :', smv_file # parse system specification file contracts, checks = parse(spec_file) # compile NuSMV file generate(contracts, checks, smv_file) print checks # run NuSMV file run(smv_file, checks)
def main(): print("Welcome!\n") with open('lastrun' ,'wb'): pass title = inp("Title:\n") author = inp("Author:\n") paragraphs = [] for i in range(1, 2000): para = inp("Insert text for slide %d(w=wikipedia, q=quit):"%i) if para.strip() in 'qQ': break elif para.strip() in 'wW': para = "WIKI:"+inp("Wiki subject:") else: line = '*' while 1: line = input("") save(line) if not line: break para += '\n' + line paragraphs.append(para) backend = '' #while backend not in BACKENDS: # backend = inp("Backend [%s]:\n"% ", ".join(BACKENDS.keys())) backend = 'impress' core.generate(title, author, paragraphs, backend) time.sleep(0.2) title = title.replace(" ", "_") + "_%s" % int(time.time()) pack.main(title) print("Yay we are done!") fullpath = os.path.abspath(title) for c in "Your slides are at: %s" % fullpath: print(c, end='') time.sleep(0.1) print() print("Opening default web browser") time.sleep(0.05) webbrowser.open(os.path.join(fullpath, "slides.html"))
def generator(x): if 'Wget' in request.user_agent.string: return "" return render_template("content.html",title=x,content=core.generate(x))
def label(plant_id): form = LogForm() if request.method == 'GET': upload_directory = 'uploads' result = Plant.query.filter_by(id=plant_id).first_or_404() name = result.name genus = result.genus species = result.species planted_by = result.planted_by planted_on = result.planted_on lat = result.lat lon = result.lon image_path = posixpath.join(upload_directory, result.image_filename) qrcode_path = url_for('.label', plant_id=plant_id) qrcode_data = request.url_root[:-1] + qrcode_path #this is probably not the best way to join the paths or to remove the trailing slash qrcode = generate(qrcode_data) result_daily = forecast.load_forecast(lat, lon, units="si") if result_daily['success'] is True: rain = rain_forecast(lat, lon) weekly = weekly_summary(lat, lon) frost = frost_forecast(lat, lon) else: rain, weekly, frost = "No forecast data available" log_result = Log.query.filter_by(plant_id=plant_id).all() if log_result: log_result = log_result else: log_result = "No logs yet" return render_template("label.html", name=name, planted_by=planted_by, genus=genus, species=species, planted_on=planted_on, lat=lat, lon=lon, qrcode=qrcode[0], image_path=image_path, rain=rain, weekly=weekly, frost=frost, form=form, log_result=log_result) #Form for adding log entries #If the form is valid & posted, i.e. submitted: if request.method == 'POST': time_of_log = datetime.now() parent_plant = plant_id log_type = "Testing" #Put all of the submitted data into our Log model and assign it the variable log. log = Log(time_of_log, form.log_body.data, log_type, parent_plant) #Add the log to the current database session for submission. #Then commit the session data to the database. db.session.add(log) db.session.commit() #Give the user some feedback flash('Your log was added') return Response(status=204)
def generator(x): return render_template("content.html",title=x,content=core.generate(x))
def generator(x): if 'Wget' in request.user_agent.string: return "" return render_template("content.html", title=x, content=core.generate(x))
import os import sys from core import parse, generate, run from operations import * sys.path.append(os.path.join(os.getcwd(), os.path.pardir)) if __name__ == "__main__": smv_file = 'nusmvfile.smv' contracts, checks = parse('spec/test_2.txt') for contract in contracts.get_contracts(): print(contract) generate(contracts, checks, smv_file) results = run(smv_file, checks) print("Check results:" + str(results))