本文整理汇总了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()
示例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
示例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)
示例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
示例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
示例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)
示例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()
示例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 = ''
示例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")
示例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)
示例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)
示例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
示例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)
示例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
示例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])