thought json was not built in oops, also fixed intensity permanence

This commit is contained in:
Ignacio Rivero 2025-06-24 21:45:38 -03:00
parent 338f489582
commit 4392e811e6
3 changed files with 17 additions and 5 deletions

19
app.py
View File

@ -416,7 +416,7 @@ def index():
if intensity < 0 or intensity > 100:
raise ValueError("Intensity must be between 0 and 100")
except ValueError:
error = "Intensidad debe ser un número entre 0 y 100"
error = "Intensity must be a number between 0 and 100"
intensity = 85
session['intensity'] = intensity
# If print button pressed, send to driver
@ -438,8 +438,21 @@ def index():
printed = True
except Exception as e:
error = f"Failed to print: {e}"
return render_template("index.html", dithering_modes=dithering_modes, img=img_data, default_md=md,
printed=printed, error=error, current_dithering=session.get('dithering', 'floyd'), current_rotation=session.get('rotation', 0), current_printmode=session.get('printmode', '1bpp'), current_bannermode=session.get('bannermode', False), t=t, lang=lang)
return render_template(
"index.html",
dithering_modes=dithering_modes,
img=img_data,
default_md=md,
printed=printed,
error=error,
current_intensity=session.get('intensity', 85),
current_dithering=session.get('dithering', 'floyd'),
current_rotation=session.get('rotation', 0),
current_printmode=session.get('printmode', '1bpp'),
current_bannermode=session.get('bannermode', False),
t=t,
lang=lang
)
@app.route('/manifest.json')
def manifest():

View File

@ -2,4 +2,3 @@ Flask
markdown
Pillow
requests
json

View File

@ -560,7 +560,7 @@
</div>
<div class="options-intensity">
<label for="intensity">{{ t['intensity'] }}</label>
<input type="number" name="intensity" value="85" min="0" max="100" step="1">
<input type="number" name="intensity" value="{{ current_intensity }}" min="0" max="100" step="1">
</div>
<div class="options-rotation">
<label for="rotation">{{ t['rotate_image'] }}</label>