コード例 #1
0
ファイル: Commands.py プロジェクト: bburns/Abby
 def Do(self):
     # get a random obj matching given adjectives
             
     # get a list of all objects matching adjectives
     cmd = List(self.abby, self.adjectives)
     layout = cmd.Do()
     oball = layout.ob
     if oball:
         ## print 'possibilities:',oball
         ob = Objects.Objs() # start with empty list
         for i in range(self.n):
             # now choose one of them at random
             #. we'll want to weight this according to 'popularity'
             # which will take various things into account, including
             # last accessed time, number of times accessed, duration of access,
             # number of times right (er, tied in through other db?),
             # uh...
             obj = random.choice(oball)
             ob.append(obj) # add to our list of objects
             
         self.abby.it = ob
         
         if self.n==1:
             layout = Layouts.Properties(self.abby, ob)
         else:
             layout = Layouts.Table(self.abby, ob)
             
     return layout
コード例 #2
0
ファイル: Objects.py プロジェクト: bburns/Abby
 def GetLayout(self, abby, showprops='all'):  # ie show all properties
     layout = Layouts.Properties(abby, self, showprops)
     return layout