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


Python Program.load方法代码示例

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


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

示例1: initgl

# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import load [as 别名]
 def initgl(self):
     glEnable(GL_TEXTURE_2D)
     glEnable(GL_BLEND)
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
     self.program = Program.load(in_module('glsl/flat.glsl'))
     self.program_ms = Program.load(in_module('glsl/flat_ms.glsl'))
     self.use_program(self.resolution)
     self.stream = BufferStream(Vertex, GL_TRIANGLES)
开发者ID:cheery,项目名称:essence,代码行数:10,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import load [as 别名]
 def __init__(self, output, default_font, program=None):
     self.output = output
     self.default_font = default_font
     self.stream = VertexStream(fmt)
     self.textures = TextureCache()
     if program is None:
         self.program = Program.load(in_module('shaders/flat.glsl'))
     else:
         self.program = program
开发者ID:cheery,项目名称:essence,代码行数:11,代码来源:renderer.py

示例3: getList

# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import load [as 别名]
class Board:
    """
    Board definition and handling
    """
    
    
    @staticmethod
    def getList():
        """
        Return the list of boards described into the configuration file
        """
        boardDir = Config.getBoardDir()
        boardFile = os.path.join(boardDir, "board_description.cfg")
        Board.config = Config(boardFile)
        boardList = Board.config.getItems("Boards")
        return boardList
        
    def __init__(self, boardName, display):
        """
        initialize a board by loading its definition
        
        @param boardName: name of board in board description file
        @type  boardName: string
        @param display:   where to display board
        @type  display:   Windows
        """
        self.display = display
        self.deviceModuleList = []
        self.program    = None
        self.boardHelp  = None
        self.archHelp   = None
        
        self.loadDefinition(boardName)

   
    def loadDefinition(self, boardName):
        """
        load the board definition from the definition file
        
        @param boardName: name of board to look for in the description file
        @type  boardName: string
        """
        items = Board.config.getItems(boardName)
        self.deviceList = []
        for item in items:
            name = item[0]
            value = item[1]
            if name == "arch":
                self.archName = value
            elif name == "memory":
                if (value == "max"):
                    self.memorySize = -1
                else:
                    self.memorySize = int(value)
            elif name[0:6] == "device":
                device = shlex.split(value, "#")
                self.deviceList.append(device)
            elif name == "help":
                fileName = os.path.join(Config.getBoardDir(), value)
                if os.path.isfile(fileName):
                    self.boardHelp = fileName
    
    def build(self):
        """
        Build the board:
        . load its architecture: chip with registers, opcodes and so on
        . load its controller definition and initialize them
        . initialize its memory
        . attach controllers to their I/O addresses
        """
        archDir = Config.getArchDir()
        archPath = os.path.join(archDir, "arch_" + self.archName + ".py")
        self.archModule = imp.load_source(self.archName, archPath)
        self.archHelp = os.path.join(archDir, "arch_" + self.archName + ".html")
        if not os.path.isfile(self.archHelp):
            self.archHelp = None
        self.chip = self.archModule.Chip()
        if (self.memorySize == -1):
            self.memorySize = 2 ** (self.chip.getAddressSize() * 8)
        self.controller = Controller(self.display)
        self.controller.loadDeviceList()
        self.memory = Memory(self, self.memorySize)
        self.memory.addController(self.controller)
         
        for device in self.deviceList:
            self.deviceModuleList.append(self.controller.createDevice(device))
            
    def clear(self):
        """
        Clear the board: reset memory and chip (PC, SP, other registers and so on)
        """
        self.memory.clear()
        self.chip.clear()
            
    def delete(self):
        """
        Delete the board: remove attached controllers
        """
        self.controller.delete()
 
#.........这里部分代码省略.........
开发者ID:lfaipot,项目名称:board-simu,代码行数:103,代码来源:board.py


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