def __init__(self, options=[[]], padding=2, on_select=None ): #~ menu_options = self._make_options(options) GridLayout.__init__(self, options, padding=padding) self.on_select = on_select self.selected = None self.options = {} for row in options: for option in row: self.options[option.id] = option if option is not None: option.palette = self if options[0][0] is not None: self.select(options[0][0].id)
def __init__(self, scene, widget, x=0, y=0): GameObject.__init__(self, scene, -1) self.widget = widget self.widget.id = Globals.WIDGETS Globals.WIDGETS += 1 Dialog.__init__(self, content=GridLayout(content=[ [self.widget] ]), window=Globals.WINDOW, batch=scene.batch, group=scene.layers[-1], offset=(x, y), theme=felyne_dark)
def __init__(self, options=[[]], padding=2, on_select=None, initialSelection=None): # ~ menu_options = self._make_options(options) GridLayout.__init__(self, options, padding=padding) self.on_select = on_select self.selected = None self.options = {} for row in options: for option in row: self.options[option.id] = option if option is not None: option.palette = self if initialSelection: self.selected = self.options[initialSelection] self.selected.select()
def teardown(self): self.on_select = None GridLayout.teardown(self)