Changeset 2796 for trunk/python


Ignore:
Timestamp:
03/15/13 20:47:24 (12 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes (CAS-4859)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

set asap.rcParams[scantable.storage] = 'disk'
run asap.plotter.plot
exit from casapy or asap. A temporary scantable on disk should be deleted.

Put in Release Notes: No

Module(s): asap.plotter, sdplot

Description:

There were cyclic references between plotters and toolbars, i.e., plotter and CustomToolbarCommon,
and flagplotter and CustomFlagToolbarCommon, which prevented deletion of temporary scantables
from disk when exitting sessions.
I changed the reference to plotters in toolbars as a weak reference so that cyclic referencing
should not avoid desctruction of the plotters. It should be ok because there shouldn't be a case
where toolbar exists without plotter, but I'm not 100% sure to be honest.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/customgui_base.py

    r2697 r2796  
    11import os
     2import weakref
    23import matplotlib, numpy
    34from asap.logging import asaplog, asaplog_post_dec
     
    1314class CustomToolbarCommon:
    1415    def __init__(self,parent):
    15         self.plotter = parent
     16        self.plotter = weakref.ref(parent)
    1617        #self.figmgr=self.plotter._plotter.figmgr
    1718
     
    683684class CustomFlagToolbarCommon:
    684685    def __init__(self,parent):
    685         self.plotter=parent
     686        self.plotter=weakref.ref(parent)
    686687        #self.figmgr=self.plotter._plotter.figmgr
    687688        self._selregions = {}
Note: See TracChangeset for help on using the changeset viewer.