Implement the text event output.
Add the following lines to the HandleEvent() function.
# get all attributes
attributes = event.GetAttributes()
# initialize variables
text = ''
isComment = True
# iterate through attributes
for attribute in attributes:
# get text
if attribute.GetName() == 'Text':
text = attribute.GetValue()
# get flag is text is a comment (True) or command (False)
elif attribute.GetName() == 'IsComment':
isComment = attribute.GetValue()
# check if comment
if isComment:
# create string and add it to source string array
self.ProgramContent.append('Comment: %s' % text)
else:
self.ProgramContent.append('Command: %s' % text)
Output
|