I do not feel comfortable making changes that alter behavior at this time, since I do not have an environment to test at this time.
At first inspection, it looks like the variable "controller" would be undefined on lines 149 and 198. At second glance, it looks like it's reading from the module level controller variable, defined on line 212.
So to me it looks like the controller should be self.controller in the above two cases.
In addition, it looks like the name 'controller' is getting redefined from the module scope on lines 132, 143, and 156. In order to avoid confusion, perhaps the block of code inside of "if name == 'main'": could be put into a main function?
I do not feel comfortable making changes that alter behavior at this time, since I do not have an environment to test at this time.
At first inspection, it looks like the variable "controller" would be undefined on lines 149 and 198. At second glance, it looks like it's reading from the module level controller variable, defined on line 212.
So to me it looks like the controller should be self.controller in the above two cases.
In addition, it looks like the name 'controller' is getting redefined from the module scope on lines 132, 143, and 156. In order to avoid confusion, perhaps the block of code inside of "if name == 'main'": could be put into a main function?