Changeset 3b7b218 in sasview
- Timestamp:
- Dec 9, 2016 9:46:23 AM (8 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
- Location:
- src/sas/qtgui
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/GUITests.py
r64f1e93 r3b7b218 10 10 from UnitTesting import TestUtilsTest 11 11 from UnitTesting import PlotHelperTest 12 from UnitTesting import PlotterBaseTest 12 13 from UnitTesting import PlotterTest 13 14 from UnitTesting import Plotter2DTest … … 28 29 unittest.makeSuite(TestUtilsTest.TestUtilsTest, 'test'), 29 30 unittest.makeSuite(PlotHelperTest.PlotHelperTest, 'test'), 31 unittest.makeSuite(PlotterBaseTest.PlotterBaseTest, 'test'), 30 32 unittest.makeSuite(PlotterTest.PlotterTest, 'test'), 31 33 unittest.makeSuite(Plotter2DTest.Plotter2DTest, 'test'), -
src/sas/qtgui/Plotter.py
rfecfe28 r3b7b218 67 67 68 68 # Include scaling (log vs. linear) 69 ax.set_yscale(self.xscale)70 69 ax.set_xscale(self.xscale) 70 ax.set_yscale(self.yscale) 71 71 72 72 # refresh canvas -
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): -
src/sas/qtgui/ScaleProperties.py
- Property mode changed from 100755 to 100644
r6d05e1d r3b7b218 19 19 } 20 20 class ScaleProperties(QtGui.QDialog, Ui_scalePropertiesUI): 21 def __init__(self, parent=None ):21 def __init__(self, parent=None, init_scale_x='x', init_scale_y='y'): 22 22 super(ScaleProperties, self).__init__(parent) 23 23 self.setupUi(self) … … 29 29 # Resize the dialog only AFTER the boxes are populated 30 30 self.setFixedSize(self.minimumSizeHint()) 31 32 # Set up the initial values for x and y. 33 # This avoids keeping a QModel instance here. 34 if init_scale_x in x_values and init_scale_y in y_values: 35 self.cbX.setCurrentIndex(x_values.index(init_scale_x)) 36 self.cbY.setCurrentIndex(y_values.index(init_scale_y)) 31 37 32 38 # Connect combobox index change to a custom method -
src/sas/qtgui/run_tests.bat
r55d89f8 r3b7b218 12 12 python -m UnitTesting.PlotHelperTest 13 13 python -m UnitTesting.KiessigCalculatorTest 14 python -m UnitTesting.PlotterBaseTest 14 15 python -m UnitTesting.PlotterTest 15 16 python -m UnitTesting.Plotter2DTest -
src/sas/qtgui/run_tests.sh
r55d89f8 r3b7b218 9 9 python -m UnitTesting.PlotHelperTest 10 10 python -m UnitTesting.SasviewLoggerTest 11 python -m UnitTesting.PlotterBaseTest 11 12 python -m UnitTesting.PlotterTest 12 13 python -m UnitTesting.Plotter2DTest
Note: See TracChangeset
for help on using the changeset viewer.