Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asaplotgui_qt4.py

    r2170 r2451  
    2929
    3030        asaplotbase.__init__(self, **v)
     31        matplotlib.rcParams["interactive"] = True
    3132
     33        _pylab_helpers.Gcf.destroy(0)
    3234        self.canvas = FigureCanvasQTAgg(self.figure)
    3335        # Simply instantiating this is enough to get a working toolbar.
    34         self.figmgr = FigureManagerQTAgg(self.canvas, 1)
     36        self.figmgr = FigureManagerQTAgg(self.canvas, 0)
    3537        self.window = self.figmgr.window
    3638        self._set_window_title('ASAP Plotter - Qt4')
    37         # register this plot to matplotlib
    38         _pylab_helpers.Gcf.set_active(self.figmgr)
     39        # Register this plot to matplotlib without activating it
     40        #_pylab_helpers.Gcf.set_active(self.figmgr)
     41        _pylab_helpers.Gcf.figs[self.figmgr.num] = self.figmgr
    3942
    4043        #############
     
    4952        qt.QtCore.QObject.connect(self.window, qt.QtCore.SIGNAL('destroyed()'),dest_callback)
    5053
    51         self.events = {'button_press':None,
    52                        'button_release':None,
    53                        'motion_notify':None}
    54 
    55         matplotlib.rcParams["interactive"] = True
    56         self.buffering = buffering
    57 
    5854        self.unmap()
    5955        #self.canvas.show()
     
    6460        window stack.
    6561        """
     62        if self.is_dead:
     63            raise RuntimeError( "No plotter to show. Not yet plotted or plotter is closed." )
    6664        self.window.activateWindow()
    6765        #To raise this window to the top of the stacking order
     
    7472        """
    7573        self.is_dead = True
    76         try: self.window.close()
     74        if not self.figmgr:
     75            return
     76        try:
     77            #self.window.close()
     78            # TODO destroy casabar
     79            _pylab_helpers.Gcf.destroy(self.figmgr.num)
     80            del self.window, self.canvas, self.figmgr
     81            self.window = None
     82            self.canvas = None
     83            self.figmgr = None
    7784        except RuntimeError: pass # the window may already be closed by user
    7885
     
    8188        Show graphics dependent on the current buffering state.
    8289        """
     90        if self.is_dead:
     91            raise RuntimeError( "No plotter to show (not yet plotted or closed)." )
    8392        if not self.buffering:
    8493            if hardrefresh:
     
    93102        Clear the figure.
    94103        """
     104        if not self.window:
     105            asaplog.push( "No plotter window to terminate." )
     106            asaplog.post( "WARN" )
     107            return
    95108        self.window.close()
    96109
     
    99112        Hide the ASAPlot graphics window.
    100113        """
     114        if not self.window:
     115            asaplog.push( "No plotter window to unmap." )
     116            asaplog.post( "WARN" )
     117            return
    101118        self.window.hide()
    102119
Note: See TracChangeset for help on using the changeset viewer.