Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asaplotgui_qt4.py

    r2451 r2170  
    2929
    3030        asaplotbase.__init__(self, **v)
    31         matplotlib.rcParams["interactive"] = True
    3231
    33         _pylab_helpers.Gcf.destroy(0)
    3432        self.canvas = FigureCanvasQTAgg(self.figure)
    3533        # Simply instantiating this is enough to get a working toolbar.
    36         self.figmgr = FigureManagerQTAgg(self.canvas, 0)
     34        self.figmgr = FigureManagerQTAgg(self.canvas, 1)
    3735        self.window = self.figmgr.window
    3836        self._set_window_title('ASAP Plotter - Qt4')
    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
     37        # register this plot to matplotlib
     38        _pylab_helpers.Gcf.set_active(self.figmgr)
    4239
    4340        #############
     
    5249        qt.QtCore.QObject.connect(self.window, qt.QtCore.SIGNAL('destroyed()'),dest_callback)
    5350
     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
    5458        self.unmap()
    5559        #self.canvas.show()
     
    6064        window stack.
    6165        """
    62         if self.is_dead:
    63             raise RuntimeError( "No plotter to show. Not yet plotted or plotter is closed." )
    6466        self.window.activateWindow()
    6567        #To raise this window to the top of the stacking order
     
    7274        """
    7375        self.is_dead = True
    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
     76        try: self.window.close()
    8477        except RuntimeError: pass # the window may already be closed by user
    8578
     
    8881        Show graphics dependent on the current buffering state.
    8982        """
    90         if self.is_dead:
    91             raise RuntimeError( "No plotter to show (not yet plotted or closed)." )
    9283        if not self.buffering:
    9384            if hardrefresh:
     
    10293        Clear the figure.
    10394        """
    104         if not self.window:
    105             asaplog.push( "No plotter window to terminate." )
    106             asaplog.post( "WARN" )
    107             return
    10895        self.window.close()
    10996
     
    11299        Hide the ASAPlot graphics window.
    113100        """
    114         if not self.window:
    115             asaplog.push( "No plotter window to unmap." )
    116             asaplog.post( "WARN" )
    117             return
    118101        self.window.hide()
    119102
Note: See TracChangeset for help on using the changeset viewer.