當前位置: 首頁>>代碼示例>>Python>>正文


Python box.Box類代碼示例

本文整理匯總了Python中box.Box的典型用法代碼示例。如果您正苦於以下問題:Python Box類的具體用法?Python Box怎麽用?Python Box使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Box類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: reset

 def reset(cls):
   """Reset to default state."""
   Box.reset()
   Note.reset()
   Figure.reset()
   Table.reset()
   Video.reset()
開發者ID:nunb,項目名稱:MaTiSSe,代碼行數:7,代碼來源:theme.py

示例2: checkout

def checkout(url, version=None):
    """Check out latest snapshot of blob or repository"""
    from box import Box
    b = Box(url)

    def _write(item):
        log.debug('writing: %s' % item.name)
        if item.type != 'blob':
            return
        if b.type in ['box', 'local']:
            path = os.path.join(b.name, item.path)
            pdir = os.path.dirname(path)
            if not os.path.isdir(pdir):
                os.makedirs(pdir)
        else:
            path = item.name

        f = open(path, 'w')
        f.write(item.data())
        f.close()

    if b.type == 'blob':
        _write(b)
    else:
        items = b.items()
        count = 1
        total = len(items)
        while count <= total:
            print '[%s/%s] %0.2f%%' %(count, total, (float(count) / total) * 100), '*'*count, '\r',
            _write(items[count-1])
            count += 1
            sys.stdout.flush()
        print
開發者ID:pombredanne,項目名稱:box,代碼行數:33,代碼來源:cli.py

示例3: __init__

    def __init__(self, sound_manager, x, y):
        Box.__init__(self, sound_manager, x, y)

        self.box_time = -1
        self.game_time = 0
        self.init_frames()
        self.refresh_image(self.display_frame)
開發者ID:jkamuda,項目名稱:protomonk,代碼行數:7,代碼來源:brick_box.py

示例4: __init__

 def __init__(self, argon):
     self.hue = 0.0
     self.saturation = 0.0
     self.value = 1.0
     self.gradient = argon.image('hue-saturation-360x256.png')
     Box.__init__(self, 0, 0,  480+20, 256+20)
     self.which = -1
開發者ID:cheery,項目名稱:essence,代碼行數:7,代碼來源:colorpicker.py

示例5: checkin

def checkin(url, files, message=None):
    """Check in files to a repository"""
    from box import Box
    b = Box(url)

    if b.type != 'local':
        raise BoxError('Not a box: %s' % url)

    if not files:
        raise BoxError('No files')

    def _write(path):
        log.debug('writing: %s' % path)
        item = Item.from_path(repo=b, path=path)
        v.addItem(item=item)

    v = b.addVersion()
    count = 1
    total = len(files) 
    while count <= total:
        print '[%s/%s] %0.2f%%' %(count, total, (float(count) / total) * 100), '*'*count, '\r',
        _write(os.path.abspath(files[count-1]))
        count += 1
        sys.stdout.flush()
    v.save(message=message)
    print
開發者ID:pombredanne,項目名稱:box,代碼行數:26,代碼來源:cli.py

示例6: __init__

	def __init__(self, brick, color, tileDir, thickness, density, unglueThreshold=None, shatterLimit=None, shatterThreshold=None, noSetup=False):
		if noSetup: return
		
		depth = thickness / 2
		world = brick.world
		parent = brick.parent
		size = entrywiseMult(vecInvert(tileDir), brick.size) + (vecBasic(tileDir) * depth)
		pos = brick.node.getPos() + entrywiseMult(tileDir, brick.size) + (vecFromList(tileDir) * depth)
		self.tileDir = tileDir
		if unglueThreshold == None: unglueThreshold = 5
		if shatterThreshold == None: shatterThreshold = 10
		dir = getNeutralDir()

		Box.__init__(self, world, parent, color, pos, dir, size, density, unglueThreshold, shatterLimit, shatterThreshold)

		self.thickness = thickness
		self.brick = brick
		self.brick.addTile(self)

		# Glue to brick.
		self.glue = OdeFixedJoint(self.world.world)
		self.glue.attachBodies(self.body, brick.body)
		self.glue.set()

		# Adjust collision bitmasks.
		self.geom.setCategoryBits(GameObject.bitmaskTileGlued)
		self.geom.setCollideBits(GameObject.bitmaskAll & ~GameObject.bitmaskBox & ~GameObject.bitmaskTileGlued & ~GameObject.bitmaskTile)
開發者ID:Panda3D-google-code-repositories,項目名稱:heavy-destruction,代碼行數:27,代碼來源:tile.py

示例7: __init__

 def __init__(self, generator, *args):
     Box.__init__(self, (0,0,0,0), None)
     self.node       = None
     self.controller = None
     self.generator  = generator
     self.args       = args
     self.rebuild()
開發者ID:cheery,項目名稱:essence,代碼行數:7,代碼來源:intron.py

示例8: __init__

 def __init__(self, offset=0, box=None):
     Box.__init__(self, offset, box)
     if isinstance(box, FullBox) and box != None:
         self.large_size = box.large_size
         self.user_type = box.user_type
     else:
         self.version = 0
         self.flags = ''
開發者ID:jason860306,項目名稱:pymp4,代碼行數:8,代碼來源:fullbox.py

示例9: settings

def settings():
    if request.method == "POST":
        app.logger.debug("Received post '{0}', '{1}'".format(request.form["client_id"], request.form["client_secret"]))
        box = Box(app.logger)
        box.set_value("client_id", request.form["client_id"])
        box.set_value("client_secret", request.form["client_secret"])
        return redirect("/", code=302)
    return render_template("settings.html")
開發者ID:box-community,項目名稱:box-hero-report,代碼行數:8,代碼來源:app.py

示例10: __init__

 def __init__(self, world, parent, color, pos, dir, axis, size, density):
     Box.__init__(self, world, parent, color, pos, dir, size, density)
     self.body.setGravityMode(False)
     self.joint = OdeHingeJoint(world.world)
     self.joint.attach(self.body, None)
     self.joint.setAnchor(self.node.getPos())
     self.joint.setAxis(*axis)
     self.joint.setParamBounce(0.0)
開發者ID:joaofrancese,項目名稱:heavy-destruction,代碼行數:8,代碼來源:spinner.py

示例11: __init__

 def __init__(self, nodes, style):
     self.nodes = nodes
     self.offset0 = [0] * (len(nodes) + 1)
     self.offset1 = [0] * (len(nodes) + 1)
     self.flow0 = [0] * len(nodes)
     self.flow1 = [0] * len(nodes)
     self.base0 = 0 
     self.base1 = 0
     Box.__init__(self, (0,0,0,0), style)
開發者ID:cheery,項目名稱:essence,代碼行數:9,代碼來源:container.py

示例12: __init__

 def __init__(self, font, text, tags, head=0, tail=0):
     self.font = font
     self.text = text
     self.tags = tags
     self.head = head + 11
     self.tail = tail + 40
     Box.__init__(self)
     self.width  = 300
     self.line_height = font.height * 1.2
     self.dragging = False
開發者ID:cheery,項目名稱:essence,代碼行數:10,代碼來源:richtext.py

示例13: authorize

def authorize():
    box = Box(app.logger)
    code = request.args.get("code")

    if code is None:
        callback = "https://" + request.headers.get("Host") + "/auth/authorize"
        auth_url = box.authorization_url(callback)
        return redirect(auth_url, code=302)

    box.authorize(code)
    return redirect("/", code=302)
開發者ID:box-community,項目名稱:box-hero-report,代碼行數:11,代碼來源:app.py

示例14: __init__

    def __init__(self):

        icon = loader.loadTexture('storymaps/data/actions/add.svg.png')
        icon.setMagfilter(Texture.FTLinearMipmapLinear)
        icon.setMinfilter(Texture.FTLinearMipmapLinear)
        rollover_icon = loader.loadTexture('storymaps/data/actions/add_rollover.svg.png')
        rollover_icon.setMagfilter(Texture.FTLinearMipmapLinear)
        rollover_icon.setMinfilter(Texture.FTLinearMipmapLinear)
        self.addButton = DirectButton(image= (icon, rollover_icon, rollover_icon, icon), command = self.add, suppressMouse=0)
        b = Box()
        b.fill(self.addButton)              
        self.buttons.append(b)
        self.addButton['state'] = DGG.NORMAL
開發者ID:seanh,項目名稱:PandaZUI,代碼行數:13,代碼來源:storyCard.py

示例15: __init__

    def __init__(self, sound_manager, x, y, num_coins=1):
        Box.__init__(self, sound_manager, x, y)

        self.num_coins = num_coins
        self.empty_frame = None
        self.coin_box_frames = []
        self.frame_idx = 0
        self.coin_box_time = 0
        self.game_time = 0
        self.transition_time = 0

        self.coin_score_group = pygame.sprite.Group()

        self.init_frames()
        self.refresh_image(self.coin_box_frames[0])
開發者ID:jkamuda,項目名稱:protomonk,代碼行數:15,代碼來源:coin_box.py


注:本文中的box.Box類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。