Esempio n. 1
0
    def menu(self):

        l = [
            util.main_header("TripleO Dashboard", align="center"),
            util.subtle("v{0}".format(tripleodash.RELEASE_STRING),
                        align="center"),
            self._time,
            self._time_until_update,
            urwid.Divider(),
            util.button("Overview", self.overview_window,
                        self._trigger_update),
            util.button("Glance Images", self.images_window,
                        self._trigger_update),
            util.button("Ironic Nodes", self.nodes_window,
                        self._trigger_update),
            util.button("Heat Stacks", self.stacks_window,
                        self._trigger_update),
            util.button("Nova Servers", self.servers_window,
                        self._trigger_update),
            urwid.Divider(),
            urwid.Divider(),
            util.exit_button("Quit")
        ]
        w = urwid.ListBox(urwid.SimpleListWalker(l))
        w.set_focus(3)
        return w
Esempio n. 2
0
    def test_exit_button(self):

        # Test
        btn = util.exit_button("Exit")
        with self.assertRaises(urwid.ExitMainLoop):
            btn.mouse_event((15, ), 'mouse press', 1, 4, 0, True)

        # Verify
        self.assertEqual(type(btn), urwid.AttrWrap)
        self.assertEqual(type(btn.original_widget), urwid.Button)
        self.assertEqual(btn.original_widget.get_label(), "Exit")