Skip to content

Commit

Permalink
Fix the stylesheet problem
Browse files Browse the repository at this point in the history
  • Loading branch information
remibert committed Jan 10, 2021
1 parent 953ddc6 commit 7b27c06
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 55 deletions.
1 change: 0 additions & 1 deletion modules/lib/webpage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from webpage.passwordpage import *
from webpage.mainpage import *
from webpage.changepasswordpage import *
from webpage.commandpage import *
from webpage.infopage import *
from webpage.pushoverpage import *
from webpage.serverpage import *
Expand Down
33 changes: 0 additions & 33 deletions modules/lib/webpage/commandpage.py

This file was deleted.

11 changes: 7 additions & 4 deletions modules/lib/webpage/infopage.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ async def index(request, response, args):

@HttpServer.addRoute(b'/reboot')
async def reboot(request, response, args):
print("Reboot")
await response.sendOk()
try:
await response.sendOk()
except Exception as err:
print(useful.exception(err))
try:
import machine
print("Reboot")
machine.reset()
except:
pass
except Exception as err:
print(useful.exception(err))
16 changes: 3 additions & 13 deletions modules/lib/webpage/mainpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
""" Function define the main web page with menu, it check also the login password """
from htmltemplate import *
from webpage.passwordpage import PasswordPage
from tools.useful import log
from server.httpserver import HttpServer
from wifi.accesspoint import AccessPoint
from wifi.station import Station

def mainPage(title="", active=0, content=None, request=None, response=None):
Expand All @@ -18,22 +16,14 @@ def mainPage(title="", active=0, content=None, request=None, response=None):

# Create main page if logged
page = PasswordPage.login(request, response, 15*60)

if page == None:
menus = HttpServer.getMenus()
tabs = []
for menu in menus:
index, href, title_ = menu
tabs.append(TabItem(text=title_, href=href, active=(active==index)))

page = Page(\
[
stylesheet,
Title2(text=title),
Tab(tabs),
content,
],
title=title, stylesheet=stylesheet)
page = Page([stylesheet, Title2(text=title), Tab(tabs), content], title=title)
else:
page = Page(page, title=b"Login", stylesheet=stylesheet)
page = Page(page + [stylesheet], title=b"Login")
return page
4 changes: 2 additions & 2 deletions patchCFirmware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
export ROOT=`pwd`/firmware

python3 backupGitModif.py
cp -f -r -v patch/c/micropython/* $ROOT/micropython/
cp -f -r -v patch/c/esp-idf/* $ROOT/esp-idf/
cp -f -r -v -p patch/c/micropython/* $ROOT/micropython/
cp -f -r -v -p patch/c/esp-idf/* $ROOT/esp-idf/
4 changes: 2 additions & 2 deletions patchPythonFirmware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
export ROOT=`pwd`/firmware

python3 backupGitModif.py
cp -f -r -v patch/python/micropython/* $ROOT/micropython/
cp -f -r -v modules/lib/* $ROOT/micropython/ports/esp32/modules/
cp -f -r -v -p patch/python/micropython/* $ROOT/micropython/
cp -f -r -v -p modules/lib/* $ROOT/micropython/ports/esp32/modules/

0 comments on commit 7b27c06

Please sign in to comment.