1: #line 8 "weavers.ipk" 2: import time 3: 4: class weaver_base: 5: __class_protocols = ['weaver'] 6: def __init__(self, pass_frame,language=''): 7: self.enabled = 1 8: self.translating = 1 9: self.tags = [] 10: if language: self.tags = [language] 11: self.pass_frame = pass_frame 12: self.master = pass_frame.master 13: self.process = self.master.process 14: if 'weavers' in self.process.trace: 15: self.process.acquire_object(self,'WEAVER') 16: self.language = language 17: self.sequence = self.pass_frame.get_new_sequence_number() 18: self.persistent_frame = self.master.get_persistent_frame(self.sequence) 19: 20: def __del__(self): 21: self.persistent_frame['last write time']=time.time() 22: if 'weavers' in self.process.trace: 23: self.process.release_object(self) 24: 25: def enable(self): self.enabled = 1 26: def disable(self): self.enabled = 0 27: def translate(self): self.translating = 1 28: def raw(self): self.translating = 0 29: def add_tag(self,tag): self.tags.append(tag) 30: def enable_if(self,tag): 31: if 'weavers' in self.process.trace: 32: print 'Checking for tag',tag,'in',self.tags 33: if tag in self.tags: self.enable() 34: else: self.disable() 35: def raw_if(self,tag): 36: if tag in self.tags: self.raw() 37: else: self.disable() 38: 39: def writeline(self,line=''): 40: self.write(line + '\n') 41: 42: def write(self,line): 43: self.sink.write(line) 44: