Beispiel #1
0
    def __init__(self,
                 text="",
                 length=20,
                 max_length=None,
                 padding=0,
                 on_input=None):
        Viewer.__init__(self)
        FocusMixin.__init__(self)

        self._document = pyglet.text.document.UnformattedDocument(text)
        self._document_style_set = False  # check if style of document was set.

        self._length = length  # the length of the box in characters
        self._max_length = max_length  # the max length allowed for writing.
        self._on_input = on_input

        self._padding = 4 + padding

        # graphics loaded in both states
        self._field = None

        # graphics loaded in state "writing"
        self._text_layout = None
        self._caret = None

        # graphics loaded in state "label"
        self._label = None
Beispiel #2
0
    def on_gain_focus(self):
        self.unload()
        FocusMixin.on_gain_focus(self)  # changes is_focus()
        self.load()

        self.reset_size()
        self.layout()
Beispiel #3
0
    def on_gain_focus(self):
        self.unload()
        FocusMixin.on_gain_focus(self)  # changes is_focus()
        self.load()

        self.reset_size()
        self.layout()
Beispiel #4
0
    def on_lose_focus(self):
        FocusMixin.on_lose_focus(self)
        if self._on_input is not None:
            self._on_input(self.get_text())

        self.reload()
        self.reset_size()
        self.layout()
Beispiel #5
0
    def on_lose_focus(self):
        # send text to callback _on_input
        if self._on_input is not None:
            self._on_input(self.get_text())

        self.unload()
        FocusMixin.on_lose_focus(self)  # changes is_focus()
        self.load()

        self.reset_size()
        self.layout()
Beispiel #6
0
    def on_lose_focus(self):
        # send text to callback _on_input
        if self._on_input is not None:
            self._on_input(self.get_text())

        self.unload()
        FocusMixin.on_lose_focus(self)  # changes is_focus()
        self.load()

        self.reset_size()
        self.layout()
Beispiel #7
0
    def __init__(self, text="", length=20, max_length=None, padding=0, on_input=None):
        Viewer.__init__(self)
        FocusMixin.__init__(self)

        self._document = pyglet.text.document.UnformattedDocument(text)
        self._document_style_set = False  # check if style of document was set.

        self._length = length  # the length of the box in characters
        self._max_length = max_length  # the max length allowed for writing.
        self._on_input = on_input

        self._padding = 4 + padding

        # graphics loaded in both states
        self._field = None

        # graphics loaded in state "writing"
        self._text_layout = None
        self._caret = None

        # graphics loaded in state "label"
        self._label = None
Beispiel #8
0
    def __init__(self,
                 text="",
                 length=20,
                 max_length=None,
                 font=None,
                 padding=0,
                 on_input=None,
                 width=None,
                 height=None,
                 font_size=None,
                 font_color=None,
                 multiline=False):
        Viewer.__init__(self)
        FocusMixin.__init__(self)

        self._document = pyglet.text.document.UnformattedDocument(text)
        self._document_style_set = False  # check if style of document was set.

        self._length = length  # the length of the box in characters
        self._max_length = max_length  # the max length allowed for writing.
        self._on_input = on_input
        self.focused = False
        self._padding = 4 + padding
        # graphics loaded in both states
        self._field = None
        self.w1 = width
        self.h1 = height
        self._fs = font_size
        # graphics loaded in state "writing"
        self._text_layout = None
        self._caret = None
        self._font = font
        self._font_color = font_color
        # graphics loaded in state "label"
        self._label = None
        self.ml = multiline
        self._caret_height = 0
Beispiel #9
0
    def on_gain_focus(self):
        FocusMixin.on_gain_focus(self)

        self.reload()
        self.reset_size()
        self.layout()
Beispiel #10
0
 def delete(self):
     FocusMixin.delete(self)
     Viewer.delete(self)
Beispiel #11
0
 def unload_graphics(self):
     super().unload_graphics()
     FocusMixin.unload_graphics(self)
Beispiel #12
0
 def delete(self):
     FocusMixin.delete(self)
     Viewer.delete(self)
Beispiel #13
0
 def delete(self):
     Viewer.delete(self)
     FocusMixin.delete(self)
Beispiel #14
0
 def layout(self):
     super().layout()
     FocusMixin.layout(self)
Beispiel #15
0
 def __init__(self, label="", is_pressed=False, on_press=None):
     Button.__init__(self, label, is_pressed, on_press)
     FocusMixin.__init__(self)
Beispiel #16
0
 def unload_graphics(self):
     super(FocusButton, self).unload_graphics()
     FocusMixin.unload_graphics(self)
Beispiel #17
0
 def layout(self):
     super(FocusButton, self).layout()
     FocusMixin.layout(self)
Beispiel #18
0
 def __init__(self, text, is_pressed=False, on_press=None):
     Button.__init__(self, text, is_pressed, on_press)
     FocusMixin.__init__(self)
Beispiel #19
0
 def __init__(self, label="", is_pressed=False, on_press=None,width=0,height=0,path=None):
     Button.__init__(self, label, is_pressed, on_press,width,height,path=path)
     FocusMixin.__init__(self)
Beispiel #20
0
 def __init__(self, label="", is_pressed=False, on_press=None):
     Button.__init__(self, label, is_pressed, on_press)
     FocusMixin.__init__(self)
Beispiel #21
0
 def load_graphics(self):
     super().load_graphics()
     FocusMixin.load_graphics(self)