Beispiel #1
0
    def __init__(self, val=0, min_val=0, max_val=99, **kwargs):
        Table.__init__(self,
                       cols=2,
                       rows=2,
                       horizontal_spacing=2,
                       vertical_spacing=2,
                       **kwargs)

        self.input = Entry("", draw_border=False)
        self.input.test_value = self._input_test_value
        self.input.connect("on-change", self.on_input_change)
        self.input.fill = True

        self.input.width = 30

        self.up = SpinButtonButton(up=True)
        self.down = SpinButtonButton(up=False)

        #: current value
        self.val = val

        #: minimum allowed value
        self.min_val = min_val

        #: maximum valid value
        self.max_val = max_val

        self.attach(self.input, 0, 1, 0, 2)
        self.attach(self.up, 1, 2, 0, 1)
        self.attach(self.down, 1, 2, 1, 2)

        self.connect_child(self.up, "on-mouse-down", self.on_up_pressed)
        self.connect_child(self.down, "on-mouse-down", self.on_down_pressed)
        self._direction = 0
Beispiel #2
0
    def __init__(self, val = 0, min_val = 0, max_val = 99, **kwargs):
        Table.__init__(self, cols = 2, rows = 2, horizontal_spacing = 2, vertical_spacing = 2, **kwargs)

        self.input = Entry("", draw_border=False)
        self.input.test_value = self._input_test_value
        self.input.connect("on-change", self.on_input_change)
        self.input.fill = True

        self.input.width = 30

        self.up = SpinButtonButton(up=True)
        self.down = SpinButtonButton(up=False)

        #: current value
        self.val = val

        #: minimum allowed value
        self.min_val = min_val

        #: maximum valid value
        self.max_val = max_val

        self.attach(self.input, 0, 1, 0, 2)
        self.attach(self.up, 1, 2, 0, 1)
        self.attach(self.down, 1, 2, 1, 2)

        self.connect_child(self.up, "on-mouse-down", self.on_up_pressed)
        self.connect_child(self.down, "on-mouse-down", self.on_down_pressed)
        self._direction = 0
Beispiel #3
0
    def __init__(self,
                 contents=None,
                 border=1,
                 step_size=None,
                 scroll_horizontal="auto",
                 scroll_vertical="auto",
                 **kwargs):
        Table.__init__(self,
                       rows=2,
                       cols=2,
                       padding=[border, 0, 0, border],
                       **kwargs)

        self.viewport = Viewport(x_align=0, y_align=0)
        self.interactive, self.can_focus = True, True

        if step_size:
            self.step_size = step_siz

        #: with of the surrounding border in pixels
        self.border = border

        #: visibility of the horizontal scroll bar. True for always, False for never and "auto" for auto
        self.scroll_horizontal = scroll_horizontal

        #: visibility of the vertical scroll bar. True for always, False for never and "auto" for auto
        self.scroll_vertical = scroll_vertical

        #even if we are don't need the scrollbar, do we reserve space for it?
        self.reserve_space_vertical = False
        self.reserve_space_horizontal = False

        #: vertical scroll bar widget
        self.vscroll = ScrollBar()

        #: horizontal scroll bar widget
        self.hscroll = ScrollBar(horizontal=True)

        self.attach(self.viewport, 0, 1, 0, 1)
        self.attach(self.vscroll, 1, 2, 0, 1)
        self.attach(self.hscroll, 0, 1, 1, 2)

        if contents:
            if isinstance(contents, graphics.Sprite):
                contents = [contents]

            for sprite in contents:
                self.add_child(sprite)

        self.connect("on-mouse-scroll", self.__on_mouse_scroll)
        for bar in (self.vscroll, self.hscroll):
            self.connect_child(bar, "on-scroll", self.on_scroll)
            self.connect_child(bar, "on-scroll-step", self.on_scroll_step)
            self.connect_child(bar, "on-scroll-page", self.on_scroll_page)
Beispiel #4
0
    def __init__(self, contents=None, border=1, step_size=None,
                 scroll_horizontal="auto", scroll_vertical="auto",
                 **kwargs):
        Table.__init__(self, rows=2, cols=2, padding=[border, 0, 0, border], **kwargs)

        self.viewport = Viewport(x_align=0, y_align=0)
        self.interactive, self.can_focus = True, True

        if step_size:
            self.step_size = step_siz

        #: with of the surrounding border in pixels
        self.border = border

        #: visibility of the horizontal scroll bar. True for always, False for never and "auto" for auto
        self.scroll_horizontal = scroll_horizontal

        #: visibility of the vertical scroll bar. True for always, False for never and "auto" for auto
        self.scroll_vertical = scroll_vertical

        #even if we are don't need the scrollbar, do we reserve space for it?
        self.reserve_space_vertical = False
        self.reserve_space_horizontal = False


        #: vertical scroll bar widget
        self.vscroll = ScrollBar()

        #: horizontal scroll bar widget
        self.hscroll = ScrollBar(horizontal = True)

        self.attach(self.viewport, 0, 1, 0, 1)
        self.attach(self.vscroll, 1, 2, 0, 1)
        self.attach(self.hscroll, 0, 1, 1, 2)


        if contents:
            if isinstance(contents, graphics.Sprite):
                contents = [contents]

            for sprite in contents:
                self.add_child(sprite)

        self.connect("on-mouse-scroll", self.__on_mouse_scroll)
        for bar in (self.vscroll, self.hscroll):
            self.connect_child(bar, "on-scroll", self.on_scroll)
            self.connect_child(bar, "on-scroll-step", self.on_scroll_step)
            self.connect_child(bar, "on-scroll-page", self.on_scroll_page)