Project

General

Profile

Actions

Bug #1576

closed

The way to overwrite a function in the subclass called by its parent class in a different python module

Added by Anchi Cheng almost 13 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
ImagePanel
Start date:
03/05/2012
Due date:
% Done:

0%

Estimated time:
Affected Version:
Appion/Leginon 2.1.0
Show in known bugs:
No
Workaround:

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.

Actions #1

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

Actions #2

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
Actions #3

Updated by Anchi Cheng about 11 years ago

  • Status changed from Assigned to Closed

close this now until I've notice more.

Actions

Also available in: Atom PDF