Beispiel #1
0
def create_printer():
    global _printer, config
    _printer = beaglebone_helpers.create_printer()
    _printer.prepared_file = None

    config = json_config_file.read()
    _printer.connect()
    _printer.configure(config)
Beispiel #2
0
def create_printer():
    global _printer, config
    _printer = beaglebone_helpers.create_printer()
    _printer.prepared_file = None

    config = json_config_file.read()
    _printer.connect()
    _printer.configure(config)
Beispiel #3
0
def config():
    error = None
    #first of all let's check if we have to save a changed config
    if request.method == 'POST':
        if 'config_content' in request.form:
            try:
                data = json.loads(request.form['config_content'])
                json_config_file.write(data)
            except Exception as e:
                error = e.message
    template_dictionary = templating_defaults()
    if error:
        template_dictionary['config_write_error'] = error
    config = json_config_file.read()
    #add pretty printe config to dict ...
    template_dictionary['config_content'] = json.dumps(config, indent=4, separators=(',', ': '))

    return render_template("config.html", **template_dictionary)
Beispiel #4
0
def config():
    error = None
    #first of all let's check if we have to save a changed config
    if request.method == 'POST':
        if 'config_content' in request.form:
            try:
                data = json.loads(request.form['config_content'])
                json_config_file.write(data)
            except Exception as e:
                error = e.message
    template_dictionary = templating_defaults()
    if error:
        template_dictionary['config_write_error'] = error
    config = json_config_file.read()
    #add pretty printe config to dict ...
    template_dictionary['config_content'] = json.dumps(config, indent=4, separators=(',', ': '))

    return render_template("config.html", **template_dictionary)