当前位置: 首页>>代码示例>>Python>>正文


Python Module.update方法代码示例

本文整理汇总了Python中module.Module.update方法的典型用法代码示例。如果您正苦于以下问题:Python Module.update方法的具体用法?Python Module.update怎么用?Python Module.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在module.Module的用法示例。


在下文中一共展示了Module.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_build

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import update [as 别名]
def do_build(module_configs, log_dir, options):
    result = BuildResult()
    nb_modules = len(module_configs)
    for idx, config in enumerate(module_configs):
        name = config.flat_get("name")
        assert name
        flog.h1("%d/%d %s" % (idx + 1, nb_modules, name))
        module = Module(config)
        log_file_name = os.path.join(log_dir, name.replace("/", "_") + ".log")
        log_file = open(log_file_name, "w")
        runner = Runner(log_file, options.verbose)

        # update/checkout
        if options.switch_branch and module.has_checkout():
            module.switch_branch(runner)

        if not options.no_src:
            try:
                if module.has_checkout():
                    module.update(runner)
                else:
                    module.checkout(runner)
            except BatchBuildError, exc:
                flog.error("%s failed to update/checkout: %s", name, exc)
                flog.p("See %s", log_file_name)
                result.vcs_fails.append([name, str(exc), log_file_name])
                nanotify.notify(name, "Failed to update/checkout", icon="dialog-warning")
                if options.fatal:
                    return result

        # Build
        try:
            if not options.src_only:
                if options.refresh_build:
                    module.refresh_build()
                module.configure(runner)
                module.build(runner)
                module.install(runner)
                nanotify.notify(name, "Build successfully", icon="dialog-ok")
        except BatchBuildError, exc:
            flog.error("%s failed to build: %s", name, exc)
            flog.p("See %s", log_file_name)
            result.build_fails.append([name, str(exc), log_file_name])
            nanotify.notify(name, "Failed to build", icon="dialog-error")
            if options.fatal:
                return result
开发者ID:agateau,项目名称:devo-batchbuild,代码行数:48,代码来源:devo-batchbuild.py

示例2: JumpGame

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import update [as 别名]

#.........这里部分代码省略.........
            JumpGame.instructionstwoRedrawAll(self)
        elif (self.mode == "training"):
            JumpGame.trainingRedrawAll(self)
        elif (self.mode == "race"):
            JumpGame.raceRedrawAll(self)

###### main menu ######


    def mainmenuMousePressed(self,event):
        # if click is in range, then change mode.
        if event.x > self.width//2-30 and event.x < self.width//2+30 and\
        event.y > self.height//2-15 and event.y < self.height//2+15:
            self.mode = "spacejump"
        elif event.x > self.width//2-45 and event.x < self.width//2+45 and\
        event.y>self.height//2+30 and event.y<self.height//2+60:
            self.mode = "instructions"
        elif event.x >= self.width//2-40 and event.x <= self.width//2+40 and\
        event.y>=self.height//2+75 and event.y<=self.height//2+105:
            self.mode = "training"
        elif event.x >= self.width//2-30 and event.x <= self.width//2+30 and\
        event.y>=self.height//2+120 and event.y<=self.height//2+150:
            self.mode = "race"


    def mainmenuKeyPressed(self,event):
        pass

    def mainmenuTimerFired(self):
        #for decoration, aesthetics 
        if self.startplatform.collide(self.startmodule.x,self.startmodule.x\
            +self.startmodule.width,self.startmodule.y+self.startmodule.height):
            self.startmodule.jump(self.startmodule.y+self.startmodule.height)
        self.startmodule.update(self.width,self.height)


    def mainmenuRedrawAll(self):
        self.canvas.create_image(0,0,anchor="nw",image=self.background)
        self.canvas.create_text(self.width//2,75,text="Space Jump",font=\
            "Arial 54",fill="white")
        self.canvas.create_rectangle(self.width//2-30,self.height//2-15,\
            self.width//2+30,self.height//2+15,fill="brown")
        self.canvas.create_text(self.width//2,self.height//2,text="Play")
        self.canvas.create_rectangle(self.width//2-45,self.height//2+30,\
            self.width//2+45,self.height//2+60,fill="brown")
        self.canvas.create_text(self.width//2,self.height//2+45,text=\
            "Instructions")
        self.canvas.create_rectangle(self.width//2-40,self.height//2+75,\
            self.width//2+40,self.height//2+105,fill="brown")
        self.canvas.create_text(self.width//2,self.height//2+90,\
            text="Training")
        self.canvas.create_rectangle(self.width//2-30,self.height//2+120,\
            self.width//2+30,self.height//2+150,fill="brown")
        self.canvas.create_text(self.width//2,self.height//2+135,\
            text="Race")
        self.startplatform.draw(self.canvas)
        self.startmodule.draw(self.canvas)
        


####### SPACE JUMP ##########
    def spacejumpMousePressed(self,event):
        #calculate slope
        x1 = event.x
        y1 = event.y
        x2 = self.module.x+self.module.width//4+8
开发者ID:edwardang,项目名称:Space-Jump,代码行数:70,代码来源:jump.py


注:本文中的module.Module.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。