mirror of https://github.com/nicolargo/glances
Add Bottle template
parent
c1c33d45b9
commit
64815bb353
|
@ -0,0 +1 @@
|
|||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
</body>
|
||||
<footer>
|
||||
|
||||
</footer>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Glances</title>
|
||||
<style>
|
||||
body {
|
||||
background: black;
|
||||
color: white;
|
||||
font-family: "Lucida Sans Typewriter", "Lucida Console", Monaco, "Bitstream Vera Sans Mono", monospace;
|
||||
}
|
||||
#system {
|
||||
float: left;
|
||||
}
|
||||
#uptime {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
|
@ -0,0 +1 @@
|
|||
<div>
|
|
@ -52,7 +52,7 @@ class glancesBottle:
|
|||
self._app = Bottle()
|
||||
self._route()
|
||||
|
||||
# Update the template path
|
||||
# Update the template path (glances/outputs/bottle)
|
||||
TEMPLATE_PATH.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'bottle'))
|
||||
|
||||
def _route(self):
|
||||
|
@ -83,16 +83,13 @@ class glancesBottle:
|
|||
Display stats on the screen
|
||||
|
||||
stats: Stats database to display
|
||||
cs_status:
|
||||
"None": standalone or server mode
|
||||
"Connected": Client is connected to the server
|
||||
"Disconnected": Client is disconnected from the server
|
||||
|
||||
"""
|
||||
print TEMPLATE_PATH
|
||||
html = template('header')
|
||||
html += template('newline')
|
||||
html += template(self.stats.get_plugin('system').get_bottle(self.args),
|
||||
**self.stats.get_plugin('system').get_raw())
|
||||
html += template(self.stats.get_plugin('uptime').get_bottle(self.args))
|
||||
html += template('endline')
|
||||
html += template('footer')
|
||||
|
||||
return html
|
||||
|
|
|
@ -75,7 +75,23 @@ class Plugin(GlancesPlugin):
|
|||
ret = []
|
||||
|
||||
# Add the line with decoration
|
||||
ret.append(self.curse_add_line("Uptime: %s" % self.stats))
|
||||
ret.append(self.curse_add_line(_("Uptime: {}").format(self.stats)))
|
||||
|
||||
# Return the message with decoration
|
||||
return ret
|
||||
|
||||
def msg_bottle(self, args=None):
|
||||
"""
|
||||
Return the Bottle template
|
||||
"""
|
||||
|
||||
tpl = """ \
|
||||
%#Template for Bottle
|
||||
<div class="plugin" id="uptime">
|
||||
"""
|
||||
tpl += _("Uptime: {}").format(self.stats)
|
||||
tpl += """ \
|
||||
</div>
|
||||
%#End Template for Bottle
|
||||
"""
|
||||
return tpl
|
||||
|
|
Loading…
Reference in New Issue