Python core 模块,Model() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用core.Model()

项目:stigma    作者:Kzulfazriawan    | 项目源码 | 文件源码
def __init__(self):
        super(Model, self).__init__()
项目:stigma    作者:Kzulfazriawan    | 项目源码 | 文件源码
def welcome(self):
        '''
        Model function to showing welcome message when application running.
        '''
        self.widget.Welcome_Label.bound(event='on_touch_down', bind=self.behavior.change_label_text)
        self.layout.Welcome_Box.gathering(self.widget.Welcome_Label)
        self.layout.Welcome_Box.adding

        return self.layout.Welcome_Box
项目:stigma-game-demo    作者:Kzulfazriawan    | 项目源码 | 文件源码
def __init__(self):
        '''
        A model class, in here I gonna structurized my layout and widget for game functionality.
        there's home, game, option, ending and serialize model layout.
        '''
        super(Model, self).__init__()
        self.option_bind_store    = []
        self.option_widget_store  = None
        self.serialize_bind_store = None
项目:stigma-game-demo    作者:Kzulfazriawan    | 项目源码 | 文件源码
def game(self, assemble=True, parameter = None):
        '''
        Model game play
        '''
        self.layout.GameContainer.gathering([self.widget.GameImagebackground,
                                             self.widget.GameImagepersoneone,
                                             self.widget.GameImagepersonetwo])
        self.layout.GameButtonwrapper.gathering([self.widget.GameButtonsave,
                                                 self.widget.GameButtonload,
                                                 self.widget.GameButtontitle])
        self.layout.GameTextwrapper.gathering([self.widget.GameTextname,
                                               self.widget.GameTextdialogue])
        self.layout.GameFooter.gathering([self.layout.GameTextwrapper,
                                          self.layout.GameButtonwrapper])
        self.layout.GameLayout.gathering([self.layout.GameContainer,
                                          self.layout.GameFooter])

        if assemble == True:
            # -- if state from text dialog is empty, it means game is not
            # -- instance yet, it means the application is just running.
            if self.widget.GameTextdialogue.state is None:
                if parameter is not None and (isinstance(parameter, list) or isinstance(parameter, tuple)):
                    background, part, character, line, state = parameter
                else:
                    part       = 'intro'
                    line       = -1
                    background = None
                    character  = None

                self.widget.GameImagepersoneone.reset()
                self.widget.GameImagepersonetwo.reset()

                self.widget.GameTextdialogue.part = [part, line]
                self.behavior.event_dialogue(background, character)

            self.widget.GameButtonsave.bound(event='on_press', bind=self.behavior.open_serialization)
            self.widget.GameButtonload.bound(event='on_press', bind=self.behavior.open_serialization)
            self.widget.GameButtontitle.bound(event='on_press', bind=self.behavior.open_home)
            self.widget.GameTextdialogue.bound(event='on_touch_down', bind=self.behavior.touched_event_dialogue)

            self.behavior.animation_game_up()

            self.layout.GameContainer.adding
            self.layout.GameButtonwrapper.adding
            self.layout.GameTextwrapper.adding
            self.layout.GameFooter.adding
            self.layout.GameLayout.adding
        else:
            self.layout.GameContainer.removing
            self.layout.GameButtonwrapper.removing
            self.layout.GameTextwrapper.removing
            self.layout.GameFooter.removing
            self.layout.GameLayout.removing

        return self.layout.GameLayout