Ejemplo n.º 1
0
    def test_draw_screen(self):
        lines = [((x[0], None, "%s\n" % x[0]),) for x in TaurusConsole.palette]
        canvas = TestCanvas(lines)

        obj = GUIScreen()
        obj.register_palette(TaurusConsole.palette)

        obj.start()
        for _ in range(1, 10):
            obj.draw_screen((1, 1), canvas)
            time.sleep(0.5)

        old_font_size = obj.font['size']
        obj.root.event_generate("<Control-4>")
        obj.root.event_generate("<Control-MouseWheel>", delta=120)
        if old_font_size > 0:
            self.assertGreater(obj.font['size'], old_font_size)
        else:
            self.assertLess(obj.font['size'], old_font_size)
        obj.root.event_generate("<Control-5>")
        obj.root.event_generate("<Control-MouseWheel>", delta=-120)

        self.assertEqual(obj.font['size'], old_font_size)

        obj.stop()
Ejemplo n.º 2
0
 def _get_screen(self):
     screen_type = self._get_screen_type()
     if screen_type == "console":
         return ConsoleScreen()
     elif screen_type == "gui":
         return GUIScreen()
     else:
         cols = self.settings.get('dummy-cols', self.screen_size[0])
         rows = self.settings.get('dummy-rows', self.screen_size[1])
         return DummyScreen(cols, rows)