fix some bugs
This commit is contained in:
parent
0dedd0974f
commit
58bbae89c2
@ -499,8 +499,7 @@ class WebConfig(plugins.Plugin):
|
|||||||
elif request.method == "POST":
|
elif request.method == "POST":
|
||||||
if path == "save-config":
|
if path == "save-config":
|
||||||
try:
|
try:
|
||||||
parsed_toml = json.loads(request.get_json())
|
save_config(request.get_json(), '/etc/pwnagotchi/config.toml')
|
||||||
save_config(parsed_toml, '/etc/pwnagotchi/config.toml')
|
|
||||||
_thread.start_new_thread(restart, (self.mode,))
|
_thread.start_new_thread(restart, (self.mode,))
|
||||||
return "success"
|
return "success"
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
@ -24,15 +24,15 @@ def init(config):
|
|||||||
|
|
||||||
def status_font(old_font):
|
def status_font(old_font):
|
||||||
global STATUS_FONT_NAME, SIZE_OFFSET
|
global STATUS_FONT_NAME, SIZE_OFFSET
|
||||||
return old_font.font_variant(font=STATUS_FONT_NAME, size=old_font.size + SIZE_OFFSET)
|
return ImageFont.truetype(STATUS_FONT_NAME, size=old_font.size + SIZE_OFFSET)
|
||||||
|
|
||||||
|
|
||||||
def setup(bold, bold_small, medium, huge, bold_big, small):
|
def setup(bold, bold_small, medium, huge, bold_big, small):
|
||||||
global Bold, BoldSmall, Medium, Huge, BoldBig, Small, FONT_NAME
|
global Bold, BoldSmall, Medium, Huge, BoldBig, Small, FONT_NAME
|
||||||
|
|
||||||
Small = ImageFont.truetype("%s.ttf" % FONT_NAME, small)
|
Small = ImageFont.truetype(FONT_NAME, small)
|
||||||
Medium = ImageFont.truetype("%s.ttf" % FONT_NAME, medium)
|
Medium = ImageFont.truetype(FONT_NAME, medium)
|
||||||
BoldSmall = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, bold_small)
|
BoldSmall = ImageFont.truetype("%s-Bold" % FONT_NAME, bold_small)
|
||||||
Bold = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, bold)
|
Bold = ImageFont.truetype("%s-Bold" % FONT_NAME, bold)
|
||||||
BoldBig = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, bold_big)
|
BoldBig = ImageFont.truetype("%s-Bold" % FONT_NAME, bold_big)
|
||||||
Huge = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, huge)
|
Huge = ImageFont.truetype("%s-Bold" % FONT_NAME, huge)
|
||||||
|
@ -27,7 +27,7 @@ class Papirus(DisplayImpl):
|
|||||||
self._layout['mode'] = (175, 86)
|
self._layout['mode'] = (175, 86)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (85, 14),
|
'pos': (85, 14),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 16
|
'max': 16
|
||||||
}
|
}
|
||||||
return self._layout
|
return self._layout
|
||||||
|
@ -27,7 +27,7 @@ class WaveshareV1(DisplayImpl):
|
|||||||
self._layout['mode'] = (225, 109)
|
self._layout['mode'] = (225, 109)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (125, 20),
|
'pos': (125, 20),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
@ -47,7 +47,7 @@ class WaveshareV1(DisplayImpl):
|
|||||||
self._layout['mode'] = (187, 93)
|
self._layout['mode'] = (187, 93)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (91, 15),
|
'pos': (91, 15),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
return self._layout
|
return self._layout
|
||||||
|
@ -26,7 +26,7 @@ class Waveshare154inch(DisplayImpl):
|
|||||||
self._layout['mode'] = (170, 187)
|
self._layout['mode'] = (170, 187)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (5, 90),
|
'pos': (5, 90),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
return self._layout
|
return self._layout
|
||||||
|
@ -27,7 +27,7 @@ class WaveshareV2(DisplayImpl):
|
|||||||
self._layout['mode'] = (225, 109)
|
self._layout['mode'] = (225, 109)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (125, 20),
|
'pos': (125, 20),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
@ -48,7 +48,7 @@ class WaveshareV2(DisplayImpl):
|
|||||||
self._layout['mode'] = (187, 93)
|
self._layout['mode'] = (187, 93)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (125, 20),
|
'pos': (125, 20),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 14
|
'max': 14
|
||||||
}
|
}
|
||||||
return self._layout
|
return self._layout
|
||||||
|
@ -26,7 +26,7 @@ class Waveshare213bc(DisplayImpl):
|
|||||||
self._layout['mode'] = (187, 93)
|
self._layout['mode'] = (187, 93)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (91, 15),
|
'pos': (91, 15),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
return self._layout
|
return self._layout
|
||||||
|
@ -26,7 +26,7 @@ class Waveshare213d(DisplayImpl):
|
|||||||
self._layout['mode'] = (187, 93)
|
self._layout['mode'] = (187, 93)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (91, 15),
|
'pos': (91, 15),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
return self._layout
|
return self._layout
|
||||||
|
@ -26,7 +26,7 @@ class Waveshare27inch(DisplayImpl):
|
|||||||
self._layout['mode'] = (239, 163)
|
self._layout['mode'] = (239, 163)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (38, 93),
|
'pos': (38, 93),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 40
|
'max': 40
|
||||||
}
|
}
|
||||||
return self._layout
|
return self._layout
|
||||||
|
@ -26,7 +26,7 @@ class Waveshare29inch(DisplayImpl):
|
|||||||
self._layout['mode'] = (268, 114)
|
self._layout['mode'] = (268, 114)
|
||||||
self._layout['status'] = {
|
self._layout['status'] = {
|
||||||
'pos': (130, 25),
|
'pos': (130, 25),
|
||||||
'font': fonts.status_font(fonts.Medium)
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 28
|
'max': 28
|
||||||
}
|
}
|
||||||
return self._layout
|
return self._layout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user