Changeset 8cb6cd6 in sasview for src/sas/qtgui/Plotter.py


Ignore:
Timestamp:
Jul 12, 2016 6:44:53 AM (8 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
e3ae090
Parents:
a95260d
Message:

Plot handler prototype + append plot functionality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Plotter.py

    ra95260d r8cb6cd6  
     1import logging 
     2 
    13from PyQt4 import QtGui 
    24 
     
    911import matplotlib.pyplot as plt 
    1012 
     13import PlotHelper 
     14 
    1115class Plotter(QtGui.QDialog): 
    1216    def __init__(self, parent=None): 
    1317        super(Plotter, self).__init__(parent) 
     18 
     19        # Required for the communicator 
     20        self.parent = parent 
    1421 
    1522        # a figure instance to plot on 
     
    3946        self._ax = self.figure.add_subplot(self._current_plot) 
    4047 
     48        # Notify the helper 
     49        PlotHelper.addPlot(self) 
     50        # Notify the listeners 
     51        self.parent.communicator.activeGraphsSignal.emit(PlotHelper.currentPlots()) 
    4152 
    4253    def data(self, data=None): 
    43         """ 
    44         """ 
     54        """ data setter """ 
    4555        self._data = data 
    4656 
    4757    def title(self, title=""): 
    48         """ 
    49         """ 
     58        """ title setter """ 
    5059        self._title = title 
    5160 
    5261    def id(self, id=""): 
    53         """ 
    54         """ 
     62        """ id setter """ 
    5563        self._id = id 
    5664 
    5765    def x_label(self, xlabel=""): 
    58         """ 
    59         """ 
     66        """ x-label setter """ 
    6067        self._xlabel = xlabel 
    6168 
    6269    def y_label(self, ylabel=""): 
    63         """ 
    64         """ 
     70        """ y-label setter """ 
    6571        self._ylabel = ylabel 
    6672 
    6773    def clean(self): 
    6874        """ 
     75        Redraw the graph 
    6976        """ 
    7077        self.figure.delaxes(self._ax) 
     
    7380    def plot(self): 
    7481        """ 
    75         plot self._data 
     82        Plot self._data 
    7683        """ 
    7784        # create an axis 
     
    9299        # refresh canvas 
    93100        self.canvas.draw() 
     101 
     102    def closeEvent(self, event): 
     103        """ 
     104        Overwrite the close event adding helper notification 
     105        """ 
     106        # Please remove me from your database. 
     107        PlotHelper.deletePlot(PlotHelper.idOfPlot(self)) 
     108        # Notify the listeners 
     109        self.parent.communicator.activeGraphsSignal.emit(PlotHelper.currentPlots()) 
     110        event.accept() 
     111 
Note: See TracChangeset for help on using the changeset viewer.