Beispiel #1
0
    def __init__(self,
                 width,
                 height,
                 width_in_cells,
                 height_in_cells,
                 visible=False,
                 focusable=False,
                 theme=None):
        Div.__init__(self, width, height, focusable, theme)
        self.visible = visible
        self.width_in_cells = width_in_cells
        self.height_in_cells = height_in_cells
        self.cell_width = self.width / self.width_in_cells
        self.cell_height = self.height / self.height_in_cells

        self.cells = Matrix(width_in_cells, height_in_cells)
        for y in xrange(height_in_cells):
            for x in xrange(width_in_cells):
                div = Div(self.cell_width,
                          self.cell_height,
                          focusable=False,
                          theme=self.theme)
                pos = (x * self.cell_width, y * self.cell_height)
                self.cells[x, y] = div
                self.add_widget(div, pos)
Beispiel #2
0
    def __init__(self,
                 width,
                 height,
                 x=0,
                 y=0,
                 theme=None,
                 bg=None,
                 mouse_control=MOUSE_LOOSE,
                 blocking=True):
        Model.__init__(self)
        Div.__init__(self, width, height, False, theme)
        self.x = x
        self.y = y
        self.cursor = None
        self.menu = self
        self.all_widgets = []
        self.init_bg(bg)
        assert mouse_control in (Menu.MOUSE_OFF,
                                 Menu.MOUSE_STRICT,
                                 Menu.MOUSE_LOOSE),\
                                'mouse_control must be 0, 1 or 2'
        self.mouse_control = mouse_control
        self.blocking = blocking

        self.should_close = False
Beispiel #3
0
    def __init__(self, width, height, width_in_cells, height_in_cells,
                 visible=False, focusable=False, theme=None):
        Div.__init__(self, width, height, focusable, theme)
        self.visible = visible
        self.width_in_cells = width_in_cells
        self.height_in_cells = height_in_cells
        self.cell_width = self.width / self.width_in_cells
        self.cell_height = self.height / self.height_in_cells

        self.cells = Matrix(width_in_cells, height_in_cells)
        for y in xrange(height_in_cells):
            for x in xrange(width_in_cells):
                div = Div(self.cell_width, self.cell_height, focusable=False,
                          theme=self.theme)
                pos = (x * self.cell_width, y * self.cell_height)
                self.cells[x, y] = div
                self.add_widget(div, pos)
Beispiel #4
0
    def __init__(self, width, height, x=0, y=0, theme=None, bg=None,
                 mouse_control=MOUSE_LOOSE, blocking=True):
        Model.__init__(self)
        Div.__init__(self, width, height, False, theme)
        self.x = x
        self.y = y
        self.cursor = None
        self.menu = self
        self.all_widgets = []
        self.init_bg(bg)
        assert mouse_control in (Menu.MOUSE_OFF,
                                 Menu.MOUSE_STRICT,
                                 Menu.MOUSE_LOOSE),\
                                'mouse_control must be 0, 1 or 2'
        self.mouse_control = mouse_control
        self.blocking = blocking

        self.should_close = False