def __init__(self,text):

        # Set up a Manager
        PopupMessage.__init__(self,
                             text=text,
                             textcolor=[255,255,255,200],
                             window=g.screen,
                             width=g.SCREEN_WIDTH/2,
                             batch=g.guiBatch,
                             theme=g.theme)
    def setUp(self):
        TestPygletGUI.setUp(self)

        def callback(button):
            #set the flag on the test class so that it wont be deleted with the popup
            self.callback_done = True

        self.popup = PopupMessage(text="Test",
                                  window=self.window,
                                  batch=self.batch,
                                  theme=self.theme,
                                  on_escape=callback)
Exemple #3
0
    def setUp(self):
        TestPygletGUI.setUp(self)
        
        def callback(button):
            #set the flag on the test class so that it wont be deleted with the popup
            self.callback_done = True

        self.popup = PopupMessage(text="Test", window=self.window,
                                  batch=self.batch, theme=self.theme, on_escape=callback)
Exemple #4
0
def create_popup(window, batch, text, on_escape=None):
    """
        window - window
        batch - batch
        text - text message in popup
        on_escape - callback when popup is closed
    """
    def on_escape_cb(dialog):
            if on_escape is not None:
                on_escape()
    PopupMessage(text=text, window=window, batch=batch,
                 group=RenderingOrder.gui, theme=theme, on_escape=on_escape_cb)
Exemple #5
0
class TestPopupConfirm(TestPygletGUI):
    def setUp(self):
        TestPygletGUI.setUp(self)
        
        def callback(button):
            #set the flag on the test class so that it wont be deleted with the popup
            self.callback_done = True

        self.popup = PopupMessage(text="Test", window=self.window,
                                  batch=self.batch, theme=self.theme, on_escape=callback)

    def test_delete(self):
        self.popup.delete()
        self.assertEqual(self.popup.is_loaded, False)

    def test_on_click(self):
        button = self.popup.content.content.content[1]
        self.assertEqual(button.is_pressed, False)
        button.on_key_press(pyglet.window.key.ENTER, None)
        self.assertEqual(button.is_pressed, True)
        self.assertEqual(self.callback_done, True)
class TestPopupConfirm(TestPygletGUI):
    def setUp(self):
        TestPygletGUI.setUp(self)

        def callback(button):
            #set the flag on the test class so that it wont be deleted with the popup
            self.callback_done = True

        self.popup = PopupMessage(text="Test",
                                  window=self.window,
                                  batch=self.batch,
                                  theme=self.theme,
                                  on_escape=callback)

    def test_delete(self):
        self.popup.delete()
        self.assertEqual(self.popup.is_loaded, False)

    def test_on_click(self):
        button = self.popup.content.content.content[1]
        self.assertEqual(button.is_pressed, False)
        button.on_key_press(pyglet.window.key.ENTER, None)
        self.assertEqual(button.is_pressed, True)
        self.assertEqual(self.callback_done, True)
Exemple #7
0
            "focus": {
                "image": {
                    "source": "button-highlight.png",
                    "frame": [8, 6, 2, 2],
                    "padding": [18, 18, 8, 6]
                }
            },
            "image": {
                "source": "button.png",
                "frame": [6, 6, 3, 3],
                "padding": [12, 12, 4, 2]
            }
        },
    },
    "frame": {
        "image": {
            "source": "panel.png",
            "frame": [8, 8, 16, 16],
            "padding": [16, 16, 8, 8]
            }
        }
}, resources_path='../theme/')

# Set up a Manager
PopupMessage(text="Test",
             window=window,
             batch=batch,
             theme=theme)

pyglet.app.run()
 def popupMessage(self, text):
     PopupMessage(text=text,
                  window=self,
                  batch=self.batch,
                  theme=getPopUpMenssageTheme())