diff --git a/glances/outputs/bottle/endline.tpl b/glances/outputs/bottle/endline.tpl new file mode 100644 index 00000000..04f5b844 --- /dev/null +++ b/glances/outputs/bottle/endline.tpl @@ -0,0 +1 @@ + diff --git a/glances/outputs/bottle/footer.tpl b/glances/outputs/bottle/footer.tpl new file mode 100644 index 00000000..7c9199b6 --- /dev/null +++ b/glances/outputs/bottle/footer.tpl @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/glances/outputs/bottle/header.tpl b/glances/outputs/bottle/header.tpl new file mode 100644 index 00000000..0f68ec2a --- /dev/null +++ b/glances/outputs/bottle/header.tpl @@ -0,0 +1,18 @@ + + +Glances + + + diff --git a/glances/outputs/bottle/newline.tpl b/glances/outputs/bottle/newline.tpl new file mode 100644 index 00000000..e54a2732 --- /dev/null +++ b/glances/outputs/bottle/newline.tpl @@ -0,0 +1 @@ +
diff --git a/glances/outputs/glances_bottle.py b/glances/outputs/glances_bottle.py index 3d5bd3b8..89d96989 100644 --- a/glances/outputs/glances_bottle.py +++ b/glances/outputs/glances_bottle.py @@ -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 diff --git a/glances/plugins/glances_uptime.py b/glances/plugins/glances_uptime.py index fc06cffa..c8324358 100644 --- a/glances/plugins/glances_uptime.py +++ b/glances/plugins/glances_uptime.py @@ -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 +
+ """ + tpl += _("Uptime: {}").format(self.stats) + tpl += """ \ +
+ %#End Template for Bottle + """ + return tpl