Bug #1576
closedThe way to overwrite a function in the subclass called by its parent class in a different python module
0%
Description
Ran into this problem often in leginon/gui/wx
The example here is RasterFCFinder.py and RasterFinder.py Both contains Panel,FinalSettingsDialog, and FinalScrolledSettings classes and those in RasterFCFinder.py are subclass of the corresponding classes in RasterFinder.py.
Since FinalSettingsDialog and FinalScrolledSettings are only called from Panel Class method, when RasterRCFinder node is open in Leginon, its Panel class is directed to the parent Panel class in RasterFinder.py and when FinalSettingsDialog class is constructed, it ended up construct from RasterFInder.py not RasterFCFinder.py
Most of our code ended up reproduce the parent class code in the subclass module, which is not the best solution.
Updated by Anchi Cheng almost 13 years ago
- Tracker changed from Support to Bug
- Assignee changed from Anchi Cheng to Jim Pulokas
- Show in known bugs set to No
Found a way to solve this problem. by defining a short function to indirectly construct the required subclass that is redefined in both parent and child module. This way, this function (_FinalSettingsDialog in Panel class) will call the real thing in its own module. see r16372
There may be a lot of these in leginon/gui/wx
Updated by Anchi Cheng about 11 years ago
- Status changed from New to Assigned
- Assignee changed from Jim Pulokas to Anchi Cheng
- Priority changed from Normal to Low
Updated by Anchi Cheng about 11 years ago
- Status changed from Assigned to Closed
close this now until I've notice more.