L = _orderTopClothingByGlobalSlotList(self.garments) if L is None: return language.Sentence([heshe, u' is naked.']).vt102(observer) return language.Sentence([ heshe, u' is wearing ', language.ItemizedList([language.Noun(g.thing).nounPhrase() for g in L]), u'.']).vt102(observer) createShirt = createCreator( (Garment, dict(garmentDescription=u'an undescribed shirt', bulk=2, garmentSlots=[GarmentSlot.CHEST, GarmentSlot.BACK, GarmentSlot.RIGHT_ARM, GarmentSlot.LEFT_ARM]))) createUnderwear = createCreator( (Garment, dict(garmentDescription=u'an undescribed pair of underwear', bulk=1, garmentSlots=[GarmentSlot.WAIST]))) createPants = createCreator( (Garment, dict(garmentDescription=u'an undescribed pair of pants', bulk=2, garmentSlots=[GarmentSlot.RIGHT_LEG, GarmentSlot.LEFT_LEG,
# -*- test-case-name: imaginary.test.test_create -*- """ Imaginary-supplied plugins for simple built-in functionality. """ from imaginary.creation import CreationPluginHelper, createCreator thingPlugin = CreationPluginHelper("thing", createCreator())
from imaginary.objects import LightSource from imaginary.creation import CreationPluginHelper, createCreator theTorchPlugin = CreationPluginHelper( u"torch", createCreator((LightSource, { "candelas": 80 })))
from imaginary.objects import LightSource from imaginary.creation import CreationPluginHelper, createCreator theTorchPlugin = CreationPluginHelper( u"torch", createCreator((LightSource, {"candelas": 80})))
def getType(cls): return createCreator((Fruit, {'fresh': True}))
def vt102(self, observer): heshe = language.Noun(self.thing).heShe() L = _orderTopClothingByGlobalSlotList(self.garments) if L is None: return language.Sentence([heshe, u' is naked.']).vt102(observer) return language.Sentence([ heshe, u' is wearing ', language.ItemizedList( [language.Noun(g.thing).nounPhrase() for g in L]), u'.' ]).vt102(observer) createShirt = createCreator( (Garment, dict(garmentDescription=u'an undescribed shirt', bulk=2, garmentSlots=[ GarmentSlot.CHEST, GarmentSlot.BACK, GarmentSlot.RIGHT_ARM, GarmentSlot.LEFT_ARM ]))) createUnderwear = createCreator( (Garment, dict(garmentDescription=u'an undescribed pair of underwear', bulk=1, garmentSlots=[GarmentSlot.WAIST]))) createPants = createCreator( (Garment, dict(garmentDescription=u'an undescribed pair of pants', bulk=2, garmentSlots=[
" onto the ground."])) state = self.closed self.closed = False try: obj.moveTo(self.thing.location) finally: self.closed = state evt.broadcast() def add(self, obj): coin = ICoin(obj, None) if coin is not None: self.coinAdded(coin) else: return super(VendingMachine, self).add(obj) def createVendingMachine(store, name, description=u""): o = objects.Thing(store=store, name=name, description=description) VendingMachine.createFor(o) return o createCoin = createCreator((Quarter, {})) createVendingMachine = createCreator((VendingMachine, {})) createQuiche = createCreator()