• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python Progress.updateProgress函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中modules.Progress.updateProgress函数的典型用法代码示例。如果您正苦于以下问题:Python updateProgress函数的具体用法?Python updateProgress怎么用?Python updateProgress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: readFromProject

 def readFromProject(self, resourceOpener):
     for logo in self._logos:
         logo.readFromProject(resourceOpener)
         updateProgress(self._pct)
     for map in self._townmaps:
         map.readFromProject(resourceOpener)
         updateProgress(self._pct)
开发者ID:jeffman,项目名称:CoilSnake,代码行数:7,代码来源:CompressedGraphicsModule.py


示例2: writeToRom

 def writeToRom(self, rom):
     self._ptrTbl.clear(32*40)
     destWriteLoc = 0xF0000
     destRangeEnd = 0xF58EE # TODO Is this correct? Can we go more?
     destLocs = dict()
     emptyEntryPtr = EbModule.toSnesAddr(rom.writeToFree([0, 0]))
     pct = 45.0/(40*32)
     i=0
     for entry in self._entries:
         if (entry == None) or (not entry):
             self._ptrTbl[i,0].setVal(emptyEntryPtr)
         else:
             entryLen = len(entry)
             writeLoc = rom.getFreeLoc(2 + entryLen*5)
             self._ptrTbl[i,0].setVal(EbModule.toSnesAddr(writeLoc))
             rom[writeLoc] = entryLen & 0xff
             rom[writeLoc+1] = entryLen >> 8
             writeLoc += 2
             for door in entry:
                 destWriteLoc += door.writeToRom(rom, writeLoc, destWriteLoc,
                         destRangeEnd, destLocs)
                 writeLoc += 5
         i += 1
         updateProgress(pct)
     self._ptrTbl.writeToRom(rom)
     # Mark any remaining space as free
     if destWriteLoc < destRangeEnd:
         rom.addFreeRanges([(destWriteLoc, destRangeEnd)])
     updateProgress(5)
开发者ID:Herringway,项目名称:CoilSnake,代码行数:29,代码来源:DoorModule.py


示例3: readFromRom

    def readFromRom(self, rom):
        for f in self._fonts:
            f.readFromRom(rom)
            updateProgress(self._pct)

        self.readCreditsFontFromRom(rom)
        updateProgress(self._pct)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:7,代码来源:FontModule.py


示例4: writeToRom

    def writeToRom(self, rom):
        if self._data["Enable Skip"]:
            rom[0x1faae] = 0x5c
            loc = rom.getFreeLoc(10 + 4*5*5 + 3*6*5)
            rom.writeMulti(0x1faaf, EbModule.toSnesAddr(loc), 3)
            rom.write(loc, [0x48, 0x08, 0xe2, 0x20])
            loc += 4

            loc = self.writeLoaderAsm(rom, loc, self._data["Name1"], 5, 0xce,
                    0x99)
            loc = self.writeLoaderAsm(rom, loc, self._data["Name2"], 5, 0x2d,
                    0x9a)
            loc = self.writeLoaderAsm(rom, loc, self._data["Name3"], 5, 0x8c,
                    0x9a)
            loc = self.writeLoaderAsm(rom, loc, self._data["Name4"], 5, 0xeb,
                    0x9a)
            loc = self.writeLoaderAsm(rom, loc, self._data["Pet"], 6, 0x19, 0x98)
            loc = self.writeLoaderAsm(rom, loc, self._data["Food"], 6, 0x1f,
                    0x98)
            loc = self.writeLoaderAsm(rom, loc, self._data["Thing"], 6, 0x29,
                    0x98)

            if self._data["Enable Summary"]:
                rom.write(loc, [0x28, 0x68, 0x5c, 0xc0, 0xfa, 0xc1])
            else:
                rom.write(loc, [0x28, 0x68, 0x5c, 0x05, 0xfd, 0xc1])
        updateProgress(50)
开发者ID:Herringway,项目名称:CoilSnake,代码行数:27,代码来源:SkipNamingModule.py


示例5: writeToProject

 def writeToProject(self, resourceOpener):
     for logo in self._logos:
         logo.writeToProject(resourceOpener)
         updateProgress(self._pct)
     for map in self._townmaps:
         map.writeToProject(resourceOpener)
         updateProgress(self._pct)
开发者ID:jeffman,项目名称:CoilSnake,代码行数:7,代码来源:CompressedGraphicsModule.py


示例6: writeToRom

 def writeToRom(self, rom):
     map_ptrs_addr = \
         EbModule.toRegAddr(rom.readMulti(self._MAP_PTRS_PTR_ADDR, 3))
     map_addrs = map(lambda x: \
         EbModule.toRegAddr(rom.readMulti(map_ptrs_addr+x*4,4)), \
         range(8))
     for i in range(self._MAP_HEIGHT):
         rom.write(map_addrs[i%8] + ((i>>3)<<8), map(lambda x: x & 0xff,
             self._tiles[i]))
     k = self._LOCAL_TSET_ADDR
     for i in range(self._MAP_HEIGHT>>3):
         for j in range(self._MAP_WIDTH):
             c = ((self._tiles[i<<3][j] >> 8)
                     | ((self._tiles[(i<<3)|1][j] >> 8) << 2)
                     | ((self._tiles[(i<<3)|2][j] >> 8) << 4)
                     | ((self._tiles[(i<<3)|3][j] >> 8) << 6))
             rom.write(k, c)
             c = ((self._tiles[(i<<3)|4][j] >> 8)
                     | ((self._tiles[(i<<3)|5][j] >> 8) << 2)
                     | ((self._tiles[(i<<3)|6][j] >> 8) << 4)
                     | ((self._tiles[(i<<3)|7][j] >> 8) << 6))
             rom.write(k+0x3000, c)
             k += 1
     updateProgress(25)
     # Write sector data
     self._mapSecTsetPalsTbl.writeToRom(rom)
     updateProgress(25.0/4)
     self._mapSecMusicTbl.writeToRom(rom)
     updateProgress(25.0/4)
     self._mapSecMiscTbl.writeToRom(rom)
     updateProgress(25.0/4)
     self._mapSecTownMapTbl.writeToRom(rom)
     updateProgress(25.0/4)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:33,代码来源:MapModule.py


示例7: writeToProject

 def writeToProject(self, resourceOpener):
     out = dict()
     x = y = 0
     rowOut = dict()
     pct = 45.0/(40*32)
     for entry in self._entries:
         if entry != None:
             rowOut[x%32] = map(
                     lambda sp: {
                         "NPC ID": sp.npcID,
                         "X": sp.x,
                         "Y": sp.y },
                     entry)
         else:
             rowOut[x%32] = None
         if (x % 32) == 31:
             # Start next row
             out[y] = rowOut
             x = 0
             y += 1
             rowOut = dict()
         else:
             x += 1
         updateProgress(pct)
     with resourceOpener("map_sprites", "yml") as f:
         yaml.dump(out, f, Dumper=yaml.CSafeDumper)
     updateProgress(5)
开发者ID:Herringway,项目名称:CoilSnake,代码行数:27,代码来源:MapSpriteModule.py


示例8: writeToRom

    def writeToRom(self, rom):
        for ipsDescFname in [s for s in os.listdir(
            'resources/ips/' + rom.type()) if s.lower().endswith(".yml")]:
            patchName = ipsDescFname[:-4]
            with open('resources/ips/' + rom.type() + '/' + ipsDescFname) as ipsDescFile:
                ipsDesc = yaml.load(ipsDescFile, Loader=yaml.CSafeLoader)
                if ((ipsDesc["Title"] in self._patches) and
                        (self._patches[ipsDesc["Title"]].lower() == "enabled")):
                    ranges = map(lambda y: tuple(map(lambda z: int(z, 0),
                        y[1:-1].split(','))), ipsDesc["Ranges"])

                    # First, check that we can apply this
                    for range in ranges:
                        if not rom.isRangeFree(range):
                            # Range is not free, can't apply
                            raise RuntimeError("Can't apply patch \"" +
                                ipsDesc["Title"] + "\", range (" +
                                hex(range[0]) + "," +  hex(range[1]) +
                                ") is not free")
                    # Now apply the patch
                    patchName = ipsDescFname[:-4]
                    ips = Ips()
                    offset = 0
                    if "Header" in ipsDesc:
                        offset = ipsDesc["Header"]
                    ips.load('resources/ips/' + rom.type() + '/' + patchName + '.ips',
                            offset)
                    ips.apply(rom)
                    # Mark the used ranges as used
                    for range in ranges:
                        rom.markRangeAsNotFree(range)
        updateProgress(50)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:32,代码来源:PatchModule.py


示例9: readFromProject

 def readFromProject(self, resourceOpener):
     # Read map data
     with resourceOpener("map_tiles", "map") as f:
         self._tiles = map(lambda y:
                 map(lambda x: int(x, 16), y.split(" ")),
                 f.readlines())
     updateProgress(25)
     # Read sector data
     self._mapSecTsetPalsTbl.clear(2560)
     self._mapSecMusicTbl.clear(2560)
     self._mapSecMiscTbl.clear(2560)
     self._mapSecTownMapTbl.clear(2560)
     pct = (25.0/2560)
     with resourceOpener("map_sectors", "yml") as f:
         input = yaml.load(f, Loader=yaml.CSafeLoader)
         for i in input:
             entry = input[i]
             self._mapSecTsetPalsTbl[i,0].setVal(
                     (entry["Tileset"] << 3) | entry["Palette"])
             self._mapSecMusicTbl[i,0].load(entry["Music"])
             self._mapSecMiscTbl[i,1].load(entry["Item"])
             self.teleport.load(entry["Teleport"])
             self.townmap.load(entry["Town Map"])
             self.setting.load(entry["Setting"])
             self._mapSecMiscTbl[i,0].setVal((self.teleport.val() << 7)
                     | (self.townmap.val() << 3) | self.setting.val())
             self.townmap_image.load(entry["Town Map Image"])
             self.townmap_arrow.load(entry["Town Map Arrow"])
             self._mapSecTownMapTbl[i,0].setVal(
                     (self.townmap_arrow.val() << 4) |
                     (self.townmap_image.val() & 0xf))
             self._mapSecTownMapTbl[i,1].load(entry["Town Map X"])
             self._mapSecTownMapTbl[i,2].load(entry["Town Map Y"])
             updateProgress(pct)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:34,代码来源:MapModule.py


示例10: readFromProject

    def readFromProject(self, resourceOpener):
        self._grPalTbl.readFromProject(resourceOpener)
        updateProgress(5)
        input = yaml.load(resourceOpener("sprite_groups", "yml"),
                Loader=yaml.CSafeLoader)
        numGroups = len(input)
        self._groups = []
        pct = 45.0/numGroups
        for i in range(numGroups):
            g = SpriteGroup(16)
            g.load(input[i])
            img = Image.open(
                    resourceOpener("SpriteGroups/" + str(i).zfill(3), "png"))
            g.fromImage(img)
            palData = img.getpalette()
            del(img)
            self._groups.append(g)
            pal = [ ]

            # Read the palette from the image
            for i in range(1, 16):
                pal.append((palData[i*3], palData[i*3+1], palData[i*3+2]))
            # Assign the palette number to the sprite
            for i in range(8):
                if pal == self._grPalTbl[i,0].val()[1:]:
                    g.setPalette(i)
                    break
            else:
                # Error, this image uses an invalid palette
                raise RuntimeException("Sprite Group #" + i
                        + "uses an invalid palette.")
            updateProgress(pct)
开发者ID:jeffman,项目名称:CoilSnake,代码行数:32,代码来源:SpriteGroupModule.py


示例11: writeToProject

 def writeToProject(self, resourceOpener):
     out = dict()
     x = y = 0
     rowOut = dict()
     pct = 45.0/(40*32)
     for entry in self._entries:
         if not entry:
             rowOut[x%32] = None
         else:
             rowOut[x%32] = map(lambda z: z.dump(), entry)
         if (x % 32) == 31:
             # Start new row
             out[y] = rowOut
             x = 0
             y += 1
             rowOut = dict()
         else:
             x += 1
         updateProgress(pct)
     with resourceOpener("map_doors", "yml") as f:
         s = yaml.dump(out, default_flow_style=False, Dumper=yaml.CSafeDumper)
         s = sub("Event Flag: (\d+)",
                 lambda i: "Event Flag: " + hex(int(i.group(0)[12:])), s)
         f.write(s)
     updateProgress(5)
开发者ID:Herringway,项目名称:CoilSnake,代码行数:25,代码来源:DoorModule.py


示例12: writeToRom

 def writeToRom(self, rom):
     self._ptrTbl.clear(20)
     blockSize = 0
     for entry in self._entries:
         for (flag, set) in entry:
             blockSize += 4 + 4*len(set)
         blockSize += 2
     if blockSize > 0xffff:
         raise RuntimeError("Too many map changes")
     loc = rom.getFreeLoc(blockSize)
     rom[self._PTR_BANK_LOC] = (loc >> 16) + 0xc0
     i = 0
     for entry in self._entries:
         self._ptrTbl[i,0].setVal(loc & 0xffff)
         for (flag, set) in entry:
             rom.writeMulti(loc, flag, 2)
             rom.writeMulti(loc+2, len(set), 2)
             loc += 4
             for (before, after) in set:
                 rom.writeMulti(loc, before, 2)
                 rom.writeMulti(loc+2, after, 2)
                 loc += 4
         rom[loc] = 0
         rom[loc+1] = 0
         loc += 2
         i += 1
         updateProgress(45.0/20)
     ptrTblLoc = self._ptrTbl.writeToFree(rom)
     rom.writeMulti(self._PTR_LOC, EbModule.toSnesAddr(ptrTblLoc), 3)
     updateProgress(5)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:30,代码来源:MapEventModule.py


示例13: writeToRom

 def writeToRom(self, rom):
     for logo in self._logos:
         logo.writeToRom(rom)
         updateProgress(self._pct)
     for map in self._townmaps:
         map.writeToRom(rom)
         updateProgress(self._pct)
开发者ID:jeffman,项目名称:CoilSnake,代码行数:7,代码来源:CompressedGraphicsModule.py


示例14: readFromRom

 def readFromRom(self, rom):
     for (cat, items) in self.ENTRY_LOCS:
         catDict = {}
         for (desc, loc, size) in items:
             catDict[desc] = SmbModule.readText(rom, loc, size)
         self._data[cat] = catDict
         updateProgress(self._pct)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:7,代码来源:TextModule.py


示例15: readFromProject

 def readFromProject(self, resourceOpener):
     i=0
     pct = 45.0/len(self._tsets)
     for tset in self._tsets:
         with resourceOpener('Tilesets/' + str(i).zfill(2), 'fts') as f:
             tset.readFromFTS(f)
         i += 1
         updateProgress(pct)
     with resourceOpener('map_palette_settings', 'yml') as f:
         input = yaml.load(f, Loader=yaml.CSafeLoader)
         for mtset in input: # For each map tileset
             # Get the draw (normal) tileset
             tset = None
             for ts in self._tsets:
                 if ts.hasMapTileset(mtset):
                     tset = ts
                     break
             # For each map palette
             mtset_pals = [(mp,p) for (mt,mp,p) in tset.pals if mt == mtset]
             for (pN,mtset_pal) in mtset_pals:
                 entry = input[mtset][pN]
                 mtset_pal.flag = entry["Event Flag"]
                 mtset_pal.flashEffect = entry["Flash Effect"]
                 mtset_pal.spritePalNum = entry["Sprite Palette"]
                 if mtset_pal.flag != 0:
                     mtset_pal.flagPal = MapPalette()
                     mtset_pal.flagPal.setFromString(entry["Event Palette"])
                     mtset_pal.flagPal.spritePalNum = entry["Sprite Palette"]
             updateProgress(5.0/32)
开发者ID:Herringway,项目名称:CoilSnake,代码行数:29,代码来源:TilesetModule.py


示例16: readFromRom

 def readFromRom(self, rom):
     for logo in self._logos:
         logo.readFromRom(rom)
         updateProgress(self._pct)
     for map in self._townmaps:
         map.readFromRom(rom)
         updateProgress(self._pct)
开发者ID:jeffman,项目名称:CoilSnake,代码行数:7,代码来源:CompressedGraphicsModule.py


示例17: writeToProject

    def writeToProject(self, resourceOpener):
        # Dump an additional YML with color0 data
        out = dict()
        for i in range(0,32): # For each map tset
            entry = dict()
            tset = None
            for ts in self._tsets:
                if ts.hasMapTileset(i):
                    tset = ts
                    break
            for (pN,p) in [(mp,p) for (mt,mp,p) in tset.pals if mt == i]:
                entry[pN] = p.dump()
            out[i] = entry
        with resourceOpener('map_palette_settings', 'yml') as f:
            s = yaml.dump(out, default_flow_style=False,
                    Dumper=yaml.CSafeDumper)
            s = sub("Event Flag: (\d+)",
                    lambda i: "Event Flag: " + hex(int(i.group(0)[12:])), s)
            f.write(s)
        updateProgress(5)

        # Dump the FTS files
        pct=45.0/len(self._tsets)
        i=0
        for tset in self._tsets:
            with resourceOpener('Tilesets/' + str(i).zfill(2), 'fts') as f:
                tset.writeToFTS(f)
            i += 1
            updateProgress(pct)
开发者ID:Herringway,项目名称:CoilSnake,代码行数:29,代码来源:TilesetModule.py


示例18: readFromProject

    def readFromProject(self, resourceOpener):
        # Clear the labels dict
        EbModule.labelsDict.clear()
        # Read the summary file
        sumFile = resourceOpener('ccscript/summary', 'txt')
        summary = sumFile.readlines()
        sumFile.close()
        # Only do anything if the summary file is not empty
        if len(summary) > 0:
            self._usedRange = (EbModule.toRegAddr(int(summary[7][30:36], 16)),
                    EbModule.toRegAddr(int(summary[8][30:36], 16)))

            modName = None
            inModuleSection = False # False = before section, True = in section
            for line in summary:
                line = line.rstrip()
                if inModuleSection:
                    if line.startswith('-'):
                        inModuleSection = False
                    else:
                        labelKey = modName + "." + line.split(' ',1)[0]
                        labelVal = int(line[-6:],16)
                        EbModule.labelsDict[labelKey] = labelVal
                elif line.startswith("-") and modName != None:
                    inModuleSection = True
                elif line.startswith("Labels in module "):
                    modName = line[17:]
        updateProgress(50)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:28,代码来源:CccInterfaceModule.py


示例19: readFromRom

 def readFromRom(self, rom):
     # Read map tiles
     map_ptrs_addr = \
         EbModule.toRegAddr(rom.readMulti(self._MAP_PTRS_PTR_ADDR, 3))
     map_addrs = map(lambda x: \
         EbModule.toRegAddr(rom.readMulti(map_ptrs_addr+x*4,4)), \
         range(8))
     self._tiles = map(
             lambda y: rom.readList(map_addrs[y%8] + ((y>>3)<<8),
                 self._MAP_WIDTH).tolist(),
             range(self._MAP_HEIGHT))
     k = self._LOCAL_TSET_ADDR
     for i in range(self._MAP_HEIGHT>>3):
         for j in range(self._MAP_WIDTH):
             self._tiles[i<<3][j] |= (rom[k] & 3) << 8
             self._tiles[(i<<3)|1][j] |= ((rom[k] >> 2) & 3) << 8
             self._tiles[(i<<3)|2][j] |= ((rom[k] >> 4) & 3) << 8
             self._tiles[(i<<3)|3][j] |= ((rom[k] >> 6) & 3) << 8
             self._tiles[(i<<3)|4][j] |= (rom[k+0x3000] & 3) << 8
             self._tiles[(i<<3)|5][j] |= ((rom[k+0x3000] >> 2) & 3) << 8
             self._tiles[(i<<3)|6][j] |= ((rom[k+0x3000] >> 4) & 3) << 8
             self._tiles[(i<<3)|7][j] |= ((rom[k+0x3000] >> 6) & 3) << 8
             k += 1
     updateProgress(25)
     # Read sector data
     self._mapSecTsetPalsTbl.readFromRom(rom)
     updateProgress(25.0/4)
     self._mapSecMusicTbl.readFromRom(rom)
     updateProgress(25.0/4)
     self._mapSecMiscTbl.readFromRom(rom)
     updateProgress(25.0/4)
     self._mapSecTownMapTbl.readFromRom(rom)
     updateProgress(25.0/4)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:33,代码来源:MapModule.py


示例20: readFromProject

    def readFromProject(self, resourceOpener):
        # First, read the Enemy Configuration Table
        self._enemyCfgTable.readFromProject(resourceOpener)
        pct = 40.0/(self._enemyCfgTable.height())

        # Second, read the Battle Sprites
        bsHashes = dict()
        bsNextNum = 1
        palNextNum = 0
        for i in range(self._enemyCfgTable.height()):
            bs = EbBattleSprite()
            pal = EbPalettes(1,16)
            try:
                bs.readFromProject(resourceOpener, i, pal)
                # Add the battle sprite
                try:
                    #self._enemyCfgTable[i,4].set(self._bsprites.index(bs))
                    bsNum = bsHashes[bs._sprite._spriteHash]
                    self._enemyCfgTable[i,4].setVal(bsNum)
                except KeyError:
                    self._bsprites.append(bs)
                    self._enemyCfgTable[i,4].setVal(bsNextNum)
                    bsHashes[bs._sprite._spriteHash] = bsNextNum
                    bsNextNum += 1
                # Add the palette
                # TODO should probably use hash table here too?
                #      then again, I don't think it's actually a bottleneck
                try:
                    self._enemyCfgTable[i,14].setVal(self._bsPals.index(pal))
                except ValueError:
                    self._bsPals.append(pal)
                    self._enemyCfgTable[i,14].setVal(palNextNum)
                    palNextNum += 1
            except IOError:
                # No battle sprite PNG
                self._enemyCfgTable[i,4].setVal(0)
                self._enemyCfgTable[i,14].setVal(0)
            updateProgress(pct)

        # Third, read the groups
        self._enemyGroupTbl.readFromProject(resourceOpener, "enemy_groups")
        updateProgress(2)
        self._enemyGroupBgTbl.readFromProject(resourceOpener, "enemy_groups")
        updateProgress(2)
        self._enemyGroups = [ ]
        pct = 4.0/484
        with resourceOpener("enemy_groups", "yml") as f:
            input = yaml.load(f, Loader=yaml.CSafeLoader)
            updateProgress(2)
            for group in input:
                tmp1 = input[group]["Enemies"]
                enemyList = [ ]
                i = 0
                for enemy in tmp1:
                    tmp2 = tmp1[i]
                    enemyList.append((tmp2["Enemy"], tmp2["Amount"]))
                    i += 1
                self._enemyGroups.append(enemyList)
                updateProgress(pct)
开发者ID:jeffman,项目名称:CoilSnake,代码行数:59,代码来源:EnemyModule.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base_module.RanaModule类代码示例发布时间:2022-05-27
下一篇:
Python error.traceback函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap