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_button(self):

        # Setup
        fn = mock.MagicMock()

        # Test
        btn = util.button("Test", fn)
        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(), "Test")

        fn.assert_called_with(btn.original_widget)