Changeset 3b7b218 in sasview for src/sas/qtgui/PlotterBase.py
- Timestamp:
- Dec 9, 2016 9:46:23 AM (7 years ago)
- 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:
- c4e5400
- Parents:
- fecfe28
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/PlotterBase.py
rb4b8589 r3b7b218 27 27 self.figure = plt.figure() 28 28 29 # this is the Canvas Widget that displays the `figure` 30 # it takes the `figure` instance as a parameter to __init__ 29 # Define canvas for the figure to be placed on 31 30 self.canvas = FigureCanvas(self.figure) 32 31 33 # this is the Navigation widget 34 # it takes the Canvas widget and a parent 32 # ... and the toolbar with all the default MPL buttons 35 33 self.toolbar = NavigationToolbar(self.canvas, self) 36 34 37 self.properties = ScaleProperties(self) 38 39 # set the layout 35 # Set the layout and place the canvas widget in it. 40 36 layout = QtGui.QVBoxLayout() 41 37 layout.setMargin(0) 42 38 layout.addWidget(self.canvas) 43 39 44 # defaults40 # 1D plotter defaults 45 41 self.current_plot = 111 46 42 self._data = [] # Original 1D/2D object … … 56 52 self.y_label = "log10(y)" 57 53 54 # Pre-define the Scale properties dialog 55 self.properties = ScaleProperties(self, 56 init_scale_x=self.x_label, 57 init_scale_y=self.y_label) 58 58 59 # default color map 59 60 self.cmap = DEFAULT_CMAP 60 61 62 # Add the axes object -> subplot 63 # TODO: self.ax will have to be tracked and exposed 64 # to enable subplot specific operations 61 65 self.ax = self.figure.add_subplot(self.current_plot) 66 67 # Set the background color to white 62 68 self.canvas.figure.set_facecolor('#FFFFFF') 63 69 … … 65 71 # set the layout 66 72 layout.addWidget(self.toolbar) 67 # Notify the helper68 PlotHelper.addPlot(self)69 73 # Add the context menu 70 74 self.contextMenu() 71 # Notify the listeners72 self. manager.communicator.activeGraphsSignal.emit(PlotHelper.currentPlots())75 # Notify PlotHelper about the new plot 76 self.upatePlotHelper() 73 77 else: 74 78 self.contextMenuQuickPlot() … … 83 87 @data.setter 84 88 def data(self, data=None): 85 """ virtual data setter """86 raise ImportError("Data setter must be implemented in derived class.")89 """ Pure virtual data setter """ 90 raise NotImplementedError("Data setter must be implemented in derived class.") 87 91 88 92 def title(self, title=""): … … 132 136 self._xscale = scale 133 137 138 def upatePlotHelper(self): 139 """ 140 Notify the plot helper about the new plot 141 """ 142 # Notify the helper 143 PlotHelper.addPlot(self) 144 # Notify the listeners about a new graph 145 self.manager.communicator.activeGraphsSignal.emit(PlotHelper.currentPlots()) 146 134 147 def contextMenu(self): 135 148 """ 136 Define context menu and associated actions for the MPL widget 149 Define common context menu and associated actions for the MPL widget 150 TODO: move to plotter1d/plotter2d 137 151 """ 138 152 # Actions … … 152 166 Define context menu and associated actions for the quickplot MPL widget 153 167 """ 154 raise ImportError("Context menu method must be implemented in derived class.")168 raise NotImplementedError("Context menu method must be implemented in derived class.") 155 169 156 170 def contextMenuEvent(self, event): … … 169 183 def plot(self, marker=None, linestyle=None): 170 184 """ 171 VIRTUAL185 PURE VIRTUAL 172 186 Plot the content of self._data 173 187 """ 174 raise ImportError("Plot method must be implemented in derived class.")188 raise NotImplementedError("Plot method must be implemented in derived class.") 175 189 176 190 def closeEvent(self, event):
Note: See TracChangeset
for help on using the changeset viewer.