Example #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
Example #2
0
    def on_gain_focus(self):
        self.unload()
        FocusMixin.on_gain_focus(self)  # changes is_focus()
        self.load()

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

        self.reset_size()
        self.layout()
Example #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()
Example #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()
Example #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()
Example #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
Example #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
Example #9
0
    def on_gain_focus(self):
        FocusMixin.on_gain_focus(self)

        self.reload()
        self.reset_size()
        self.layout()
Example #10
0
 def delete(self):
     FocusMixin.delete(self)
     Viewer.delete(self)
Example #11
0
 def unload_graphics(self):
     super().unload_graphics()
     FocusMixin.unload_graphics(self)
Example #12
0
 def delete(self):
     FocusMixin.delete(self)
     Viewer.delete(self)
Example #13
0
 def delete(self):
     Viewer.delete(self)
     FocusMixin.delete(self)
Example #14
0
 def layout(self):
     super().layout()
     FocusMixin.layout(self)
Example #15
0
 def __init__(self, label="", is_pressed=False, on_press=None):
     Button.__init__(self, label, is_pressed, on_press)
     FocusMixin.__init__(self)
Example #16
0
 def unload_graphics(self):
     super(FocusButton, self).unload_graphics()
     FocusMixin.unload_graphics(self)
Example #17
0
 def layout(self):
     super(FocusButton, self).layout()
     FocusMixin.layout(self)
Example #18
0
 def __init__(self, text, is_pressed=False, on_press=None):
     Button.__init__(self, text, is_pressed, on_press)
     FocusMixin.__init__(self)
Example #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)
Example #20
0
 def __init__(self, label="", is_pressed=False, on_press=None):
     Button.__init__(self, label, is_pressed, on_press)
     FocusMixin.__init__(self)
Example #21
0
 def load_graphics(self):
     super().load_graphics()
     FocusMixin.load_graphics(self)