本文整理汇总了Python中object.Object类的典型用法代码示例。如果您正苦于以下问题:Python Object类的具体用法?Python Object怎么用?Python Object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Object类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw
def draw(self, context):
dash = list()
context.set_dash(dash)
context.set_line_width(self.thickness)
context.save()
context.new_path()
context.translate(self.x, self.y)
if (self.width > 0) and (self.height > 0):
context.scale(self.width, self.height)
context.rectangle(0, 0, 1, 1)
if self.fill_style == GRADIENT:
context.set_source(self.gradient.gradient)
elif self.fill_style == COLOR:
context.set_source_rgba(
self.fill_color.red, self.fill_color.green, self.fill_color.blue, self.fill_color.alpha
)
context.fill_preserve()
context.restore()
context.set_source_rgba(
self.stroke_color.red, self.stroke_color.green, self.stroke_color.blue, self.stroke_color.alpha
)
context.stroke()
for i, separator in enumerate(self.separators):
separator.synchronize(self)
separator.draw(context)
self.handler.control[ANONIMOUS + i] = separator.control
Object.draw(self, context)
示例2: __init__
def __init__(self, imgLocation, xPos, yPos, width, height):
Object.__init__(self, imgLocation, xPos, yPos, width, height)
#Modify the rect to include only one of three states
self.rect.height = self.rect.height / 3
self.rect.center = (xPos, yPos)
self.subrect = pygame.Rect(0, 0, self.rect.width, self.rect.height)
self.state = ClickableButton.NORMAL
示例3: draw
def draw(self, context):
###context.save()
context.set_dash(self.dash)
context.set_line_width(self.thickness)
context.new_path()
context.move_to(self.x, self.y)
context.curve_to(
self.x,
self.y,
self.handler.control[8].x,
self.handler.control[8].y,
self.x + self.width / 2,
self.y + self.height / 2,
)
context.curve_to(
self.x + self.width / 2,
self.y + self.height / 2,
self.handler.control[9].x,
self.handler.control[9].y,
self.x + self.width,
self.y + self.height,
)
context.set_source_rgba(
self.stroke_color.red, self.stroke_color.green, self.stroke_color.blue, self.stroke_color.alpha
)
context.stroke()
Object.draw(self, context)
示例4: __init__
def __init__(self):
threading.Thread.__init__(self)
Object.__init__(self)
# OBJECTS
self.scheduler = Schedule() # The schedule object
self.series = [] # List of series
示例5: add_object
def add_object(self, pk, name, value):
''' Create object on server (do not use this function to add
object from a client sync '''
obj = Object(pk=pk, name=name, value=value)
self.counter += 1
obj.lastupdate_counter = self.counter
self.objects.append(obj)
示例6: _pre_delete
def _pre_delete(self):
Object._pre_delete(self)
root = self.find_root()
# Remove group name from User.groups
root['users']._remove_group_name(self.__name__)
# Remove group name from Content._local_roles
root._remove_local_roles_for_principal('group:'+self.__name__)
示例7: __init__
def __init__(self):
Object.__init__(self)
self.set_property("radius", 10)
control = Control()
self.handler.control.append(control)
示例8: __init__
def __init__(self):
Object.__init__(self)
# VARS
self.episode = 0 # The last episode played.
self.since = 0 # How many times it's been since this series was last played.
self.num = 0 # The amount of items in this series.
示例9: __init__
def __init__(self, name="unnamed game object", components=[]):
Object.__init__(self)
self.components = {}
self.transform = Transform(self, name)
self.components["Transform"] = self.transform
for component in components:
self.addComponent(component)
示例10: sync_from_client
def sync_from_client(self, objects):
result = {}
for sob in objects:
exists = False
conflict = False
for o in self.objects:
if o.guid == sob.guid:
exists = True
o.value = sob.value
o.deleted = sob.deleted
self.counter += 1
o.lastupdate_counter = self.counter
elif o.pk == sob.pk:
# pk conflict: do nothing because this should not occur on server
# client will always sync from server to client first and handle
# any pk conflicts before syncing from client to server
exists = True
conflict = True
result['statuscode'] = NOK
if not exists:
no = Object(pk=sob.pk, name=sob.name, value=sob.value, guid=sob.guid)
no.deleted = sob.deleted
self.counter += 1
no.lastupdate_counter = self.counter
self.objects.append(no)
if 'statuscode' not in result:
result['statuscode'] = OK
result['servercounter'] = self.counter
return result
示例11: __init__
def __init__(self):
Object.__init__(self)
self._name = "unknown"
# body
self._gender = 0
self._skin_color = 0
self._hair_style = 0
self._hair_color = 0
self._underwear_color = 0
# dress
self._mantle = None
self._shoes = None
self._legging = None
self._hauberk = None
self._armor = None
self._cap = None
# weapon
self._weapon = None
self._shield = None
# an action is a tuple representing the action, its direction
# and its duration in milliseconds. eg: (SUFFER, NE, 1000)
self.pending_actions = []
self.loop_action = (STAND, N, 1000)
self.current_action = self.loop_action
# this is the current animation
self._animation = self.create_animation(self.loop_action)
# internal elapsed_time needed to remember the remaining time
self.elapsed_time = sf.Time()
示例12: __init__
def __init__(self, player):
Object.__init__(self)
self.player = player
self.animation = animation.Animation('bandage')
self.rect = pygame.Rect(player.x, player.y, 0, 0)
self.step = 0
self.set_state('starting')
示例13: __init__
def __init__(self, game, name, sprites, x, y, player):
Object.__init__(self, game.stage)
self.game = game
self.name = name
self.init_animations()
self.image = self.animation.get_image()
self.x = x
self.y = y
self.rect = pygame.Rect(self.x, self.y, 10, 10)
self.flip = True
self.change_state(Stand(self))
self.dy = 0
self.sprites = sprites
self.last_attack = (0, 0)
self.player = player
self.shadow = shadow.Shadow(self)
# Collision when is trowed
self.collision_fly = None
self.update_animation()
if player:
self.update()
self.energy = energy.EnergyModel(name, 100, game.on_enemy_energy_model_change)
else:
Object.update(self)
self.z = -self.y
示例14: __init__
def __init__(self):
Object.__init__(self)
# VARS
self.series = [] # List of series to play.
self.exclude_series = [] # List of series to exclude. If none, then none will be excluded.
self.new_episodes = False # Only play new episodes.
self.old_episodes = False # Only play old episodes.
self.groups = [] # Only play from these groups
self.exclude_groups = [] # Don't play any from these groups.
self.use_ads = False # Play ads
self.ads = [] # List of ads
self.exclude_ads = [] #
self.ad_groups = [] # Play only ads from these groups
self.ad_exclude_groups = [] # Don't play any ads from these groups.
self.picker = settings.PICKER # The picker to use in this block.
self.ad_picker = settings.AD_PICKER # Thi picker to use to pick adverts
# REALTIME VARS
self.current = False # If this block is currently being played.
示例15: draw
def draw(self, context):
type = self.get_property('type')
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(self.width), int(self.height))
lines = (
('AMD Athlon II X3 425', 34.5),
('Intel Celeron E3300 @ 2.50GHz', 31),
('AMD Athlon II X2 240', 30.7),
('AMD Phenom 9750 Quad-Core', 29.9),
('AMD Athlon 64 X2 Dual Core 6000+', 29.2),
('Dual-Core AMD Opteron 1216', 27.1),
('AMD Sempron 140', 26.3),
('Pentium Dual-Core E5400 @ 2.70GHz', 24.7),
('Intel Core i7 920 @ 2.67GHz', 19.3),
('Intel Core2 Quad Q8200 @ 2.33GHz', 17.7),
('Intel Core2 Duo E7500 @ 2.93GHz', 17.2),
)
options = {
'axis': {
'x': {
'ticks': [dict(v=i, label=l[0]) for i, l in enumerate(lines)],
'label': 'Microprocesador',
'rotate': 25,
},
'y': {
'tickCount': 4,
'rotate': 25,
'label': 'Relación precio rendimiento'
}
},
'legend': {
'hide': True,
},
}
chart = get_chart_from_type(surface, type, options)
dataSet = (
('AMD Athlon II X3 425', ((0, 34.5), )),
('Intel Celeron E3300 @ 2.50GHz', ((0, 31), )),
('AMD Athlon II X2 240', ((0, 30.7), )),
('AMD Phenom 9750 Quad-Core', ((0, 29.9), )),
('AMD Athlon 64 X2 Dual Core 6000+', ((0, 29.2), )),
('Dual-Core AMD Opteron 1216', ((0, 27.1), )),
('AMD Sempron 140', ((0, 26.3), )),
('Pentium Dual-Core E5400 @ 2.70GHz', ((0, 24.7), )),
('Intel Core i7 920 @ 2.67GHz', ((0, 19.3), )),
('Intel Core2 Quad Q8200 @ 2.33GHz', ((0, 17.7), )),
('Intel Core2 Duo E7500 @ 2.93GHz', ((0, 17.2), )),
)
chart.addDataset(dataSet)
chart.render()
context.set_source_surface(surface, self.x, self.y)
context.paint()
Object.draw(self, context)