Changed the reload mechanism, moved the shutdown header to templates.py

This commit is contained in:
Remy
2011-07-14 22:34:56 -07:00
parent 8387ed8383
commit fa96194749
2 changed files with 21 additions and 6 deletions

View File

@@ -8,6 +8,18 @@ _header = '''
</head>
<body>
<div class="container">'''
_shutdownheader = '''
<html>
<head>
<title>Headphones</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="icon" type="image/x-icon" href="images/favicon.ico" />
<link rel="apple-touch-icon" href="images/headphoneslogo.png" />
<meta http-equiv="refresh" content="%s;url=home"></head>
</head>
<body>
<div class="container">'''
_logobar = '''
<div class="logo"><a href="home"><img src="images/headphoneslogo.png" border="0">headphones<a></div>

View File

@@ -628,23 +628,26 @@ class WebInterface(object):
def shutdown(self):
logger.info(u"Headphones is shutting down...")
threading.Timer(2, headphones.shutdown).start()
return '''<head></head>
Shutting Down Headphones....'''
page = [templates._shutdownheader % 10]
page.append('Shutting down Headphones...')
return page
shutdown.exposed = True
def restart(self):
logger.info(u"Headphones is restarting...")
threading.Timer(2, headphones.shutdown, [True]).start()
return '''<head><meta http-equiv="refresh" content="20;url=home"></head>
Restarting Headphones....'''
page = [templates._shutdownheader % 20]
page.append('Restarting Headphones...')
return page
restart.exposed = True
def update(self):
logger.info('Headphones is updating...')
threading.Timer(2, headphones.shutdown, [True, True]).start()
return '''<head><meta http-equiv="refresh" content="60;url=home"></head>
Updating Headphones....'''
page = [templates._shutdownheader % 60]
page.append('Updating Headphones...')
return page
update.exposed = True