comparison flax/Submaster.py @ 165:1fe54442db38

get_all_subs sorts, and puts some elements at the end
author drewp
date Tue, 08 Jul 2003 09:18:47 +0000
parents 304152488ed7
children 79bc84310e80
comparison
equal deleted inserted replaced
164:bd2bcc9d38bb 165:1fe54442db38
90 filename.startswith('CVS'): 90 filename.startswith('CVS'):
91 continue 91 continue
92 self.submasters[filename] = Submaster(filename) 92 self.submasters[filename] = Submaster(filename)
93 def get_all_subs(self): 93 def get_all_subs(self):
94 "All Submaster objects" 94 "All Submaster objects"
95 return self.submasters.values() 95 l = self.submasters.items()
96 l.sort()
97 l = [x[1] for x in l]
98 songs = []
99 notsongs = []
100 for s in l:
101 if s.name.startswith('song'):
102 songs.append(s)
103 else:
104 notsongs.append(s)
105 combined = notsongs + songs
106 return combined
96 def get_sub_by_name(self, name): 107 def get_sub_by_name(self, name):
97 "Makes a new sub if there isn't one." 108 "Makes a new sub if there isn't one."
98 return self.submasters.get(name, Submaster(name)) 109 return self.submasters.get(name, Submaster(name))
99 __getitem__ = get_sub_by_name 110 __getitem__ = get_sub_by_name
100 111