Changeset 8696721 in sasview
- Timestamp:
- Dec 13, 2016 7:04:25 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:
- 0532d7c1
- Parents:
- 6b9d41d (diff), c3b2327 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 10 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
build_tools/Vagrant/Ubuntu1404/README.md
re84ccf5 r95d32b7 1 How to setup VM SasViewQt Ubuntu1404 developer env using Vagrant 1 Ubuntu Vagrant Setup for SasViewQt 2 ---------------------------------- 3 4 How-to setup VM SasViewQt Ubuntu1404 developer env using Vagrant 2 5 3 6 A: Provision VM 7 --------------- 4 8 5 9 B: Log on to VM - Setup Anaconda 6 01) Install miniconda: $ bash ./Miniconda2-latest-Linux-x86_64.sh 7 02) Export miniconda path: $ export PATH=/home/vagrant/miniconda2/bin:$PATH 8 03) Make sasviewqt env in minicona: conda env create -f environment.yml 10 -------------------------------- 11 12 1. Install miniconda: $ bash ./Miniconda2-latest-Linux-x86_64.sh 13 2. Export miniconda path: $ export PATH=/home/vagrant/miniconda2/bin:$PATH 14 3. Make sasviewqt env in minicona: conda env create -f environment.yml 9 15 10 16 C: Build SasView 11 04) clone sasview: git clone https://github.com/SasView/sasview 12 05) clone sasmodels: git clone https://github.com/SasView/sasmodels 13 06) show sasview branch: git remote show origin 14 07) checkout ESS_GUI: git checkout ESS_GUI 15 08) build sasmodels: python setup.py build 16 09) build sasmodels doc: make html 17 10) build sasview: python setup.py build 18 11) build sasview: python setup.py docs 19 12) run sasview: python run.py 20 12) cd SasView/sasview/src/sas/qtgui 21 13) make gui: ./make_ui.sh 22 14) python run.py / python Main_Window.py depending on on your cloned githash 17 ---------------- 18 1. clone sasview: git clone https://github.com/SasView/sasview 19 2. clone sasmodels: git clone https://github.com/SasView/sasmodels 20 3. show sasview branch: git remote show origin 21 4. checkout ESS\_GUI: git checkout ESS\_GUI 22 5. build sasmodels: python setup.py build 23 6. build sasmodels doc: make html 24 7. build sasview: python setup.py build 25 8. build sasview: python setup.py docs 26 9. run sasview: python run.py 27 10. cd SasView/sasview/src/sas/qtgui 28 11. make gui: ./make_ui.sh 29 12. python run.py / python Main\_Window.py depending on on your cloned githash 23 30 24 31 Tips: 25 export PATH=/home/vagrant/miniconda2/bin:$PATH 32 ---- 26 33 27 conda env export > environment.yml 28 conda env create -f environment.yml 34 - $ export PATH=/home/vagrant/miniconda2/bin:$PATH 35 - $ conda env export > environment.yml 36 - $ conda env create -f environment.yml 29 37 38 To activate this environment, use: 30 39 31 # To activate this environment, use: 32 # > source activate sasviewqt 33 # 34 # To deactivate this environment, use: 35 # > source deactivate sasviewqt 40 - $ source activate sasviewqt 36 41 42 To deactivate this environment, use: 43 44 - $ source deactivate sasviewqt 37 45 38 46 39 47 Known problems: 40 libxml2 not installed. 48 --------------- 41 49 50 - libxml2 not installed. 42 51 -
src/sas/qtgui/DataExplorer.py
r253e7170 r8696721 80 80 self.communicator.fileReadSignal.connect(self.loadFromURL) 81 81 self.communicator.activeGraphsSignal.connect(self.updateGraphCombo) 82 self.communicator.activeGraphName.connect(self.updatePlotName) 82 83 self.cbgraph.editTextChanged.connect(self.enableGraphCombo) 83 84 self.cbgraph.currentIndexChanged.connect(self.enableGraphCombo) … … 368 369 return new_item 369 370 371 def updatePlotName(self, name_tuple): 372 """ 373 Modify the name of the current plot 374 """ 375 old_name, current_name = name_tuple 376 ind = self.cbgraph.findText(old_name) 377 self.cbgraph.setCurrentIndex(ind) 378 self.cbgraph.setItemText(ind, current_name) 379 370 380 def updateGraphCombo(self, graph_list): 371 381 """ … … 411 421 raise AttributeError, msg 412 422 423 413 424 if plots and \ 414 hasattr(new_plot, 'data') and \415 len(new_plot.data.x) > 0:416 self.plotAdd(new_plot)425 hasattr(new_plot, 'data') and \ 426 isinstance(new_plot.data, Data1D): 427 self.plotAdd(new_plot) 417 428 418 429 def plotAdd(self, new_plot): … … 436 447 """ 437 448 Add data set(s) to the existing matplotlib chart 438 439 TODO: Add 2D-functionality440 449 """ 441 450 # new plot data … … 443 452 444 453 # old plot data 445 plot_id = self.cbgraph.currentText() 446 plot_id = int(plot_id[5:]) 454 plot_id = self.cbgraph.currentIndex() + 1 447 455 448 456 assert plot_id in PlotHelper.currentPlots(), "No such plot: Graph%s"%str(plot_id) -
src/sas/qtgui/GUITests.py
r64f1e93 r27313b7 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 … … 16 17 from UnitTesting import KiessigCalculatorTest 17 18 from UnitTesting import DensityCalculatorTest 19 from UnitTesting import WindowTitleTest 18 20 19 21 def suite(): … … 28 30 unittest.makeSuite(TestUtilsTest.TestUtilsTest, 'test'), 29 31 unittest.makeSuite(PlotHelperTest.PlotHelperTest, 'test'), 32 unittest.makeSuite(PlotterBaseTest.PlotterBaseTest, 'test'), 30 33 unittest.makeSuite(PlotterTest.PlotterTest, 'test'), 31 34 unittest.makeSuite(Plotter2DTest.Plotter2DTest, 'test'), … … 34 37 unittest.makeSuite(KiessigCalculatorTest.KiessigCalculatorTest, 'test'), 35 38 unittest.makeSuite(DensityCalculatorTest.DensityCalculatorTest, 'test'), 39 unittest.makeSuite(WindowTitleTest.WindowTitleTest, 'test'), 36 40 ) 37 41 return unittest.TestSuite(suites) -
src/sas/qtgui/GuiUtils.py
r8548d739 r27313b7 229 229 activeGraphsSignal = QtCore.pyqtSignal(list) 230 230 231 # Current workspace chart's name changed 232 activeGraphName = QtCore.pyqtSignal(tuple) 233 231 234 232 235 def updateModelItemWithPlot(item, update_data, name=""): -
src/sas/qtgui/PlotUtilities.py
r31c5b58 rfecfe28 13 13 """ 14 14 # No qx or qy given in a vector format 15 if qx_data == None or qy_data ==None \15 if qx_data is None or qy_data is None \ 16 16 or qx_data.ndim != 1 or qy_data.ndim != 1: 17 17 return data … … 72 72 """ 73 73 # No qx or qy given in a vector format 74 if qx_data == None or qy_data ==None \74 if qx_data is None or qy_data is None \ 75 75 or qx_data.ndim != 1 or qy_data.ndim != 1: 76 76 return data -
src/sas/qtgui/Plotter.py
r416fa8f r27313b7 8 8 9 9 class PlotterWidget(PlotterBase): 10 """ 11 1D Plot widget for use with a QDialog 12 """ 10 13 def __init__(self, parent=None, manager=None, quickplot=False): 11 14 super(PlotterWidget, self).__init__(parent, manager=manager, quickplot=quickplot) 15 self.parent = parent 12 16 13 17 @property … … 23 27 self.title(title=value.title) 24 28 25 def plot(self, marker=None, linestyle=None ):29 def plot(self, marker=None, linestyle=None, hide_error=False): 26 30 """ 27 31 Plot self._data … … 34 38 35 39 if linestyle == None: 36 linestyle = '-' 37 38 # plot data with title 39 ax.plot(self._data.view.x, 40 self._data.view.y, 41 marker=marker, 42 linestyle=linestyle, 43 label=self._title) 40 linestyle = '' 41 42 # plot data with/without errorbars 43 if hide_error: 44 ax.plot(self._data.view.x, self._data.view.y, 45 marker=marker, 46 linestyle=linestyle, 47 label=self._title) 48 else: 49 ax.errorbar(self._data.view.x, self._data.view.y, 50 yerr=self._data.view.dx, xerr=None, 51 capsize=2, linestyle='', 52 barsabove=False, 53 marker=marker, 54 lolims=False, uplims=False, 55 xlolims=False, xuplims=False, 56 label=self._title) 44 57 45 58 # Now add the legend with some customizations. … … 55 68 56 69 # Include scaling (log vs. linear) 57 ax.set_yscale(self.xscale)58 70 ax.set_xscale(self.xscale) 71 ax.set_yscale(self.yscale) 59 72 60 73 # refresh canvas 61 74 self.canvas.draw() 62 75 76 def contextMenu(self): 77 """ 78 Define common context menu and associated actions for the MPL widget 79 """ 80 self.defaultContextMenu() 81 82 # Additional menu items 83 self.contextMenu.addSeparator() 84 self.actionModifyGraphAppearance =\ 85 self.contextMenu.addAction("Modify Graph Appearance") 86 self.contextMenu.addSeparator() 87 self.actionAddText = self.contextMenu.addAction("Add Text") 88 self.actionRemoveText = self.contextMenu.addAction("Remove Text") 89 self.contextMenu.addSeparator() 90 self.actionChangeScale = self.contextMenu.addAction("Change Scale") 91 self.contextMenu.addSeparator() 92 self.actionSetGraphRange = self.contextMenu.addAction("Set Graph Range") 93 self.actionResetGraphRange =\ 94 self.contextMenu.addAction("Reset Graph Range") 95 # Add the title change for dialogs 96 if self.parent: 97 self.contextMenu.addSeparator() 98 self.actionWindowTitle = self.contextMenu.addAction("Window Title") 99 100 # Define the callbacks 101 self.actionModifyGraphAppearance.triggered.connect(self.onModifyGraph) 102 self.actionAddText.triggered.connect(self.onAddText) 103 self.actionRemoveText.triggered.connect(self.onRemoveText) 104 self.actionChangeScale.triggered.connect(self.onScaleChange) 105 self.actionSetGraphRange.triggered.connect(self.onSetGraphRange) 106 self.actionResetGraphRange.triggered.connect(self.onResetGraphRange) 107 self.actionWindowTitle.triggered.connect(self.onWindowsTitle) 108 63 109 def contextMenuQuickPlot(self): 64 110 """ 65 111 Define context menu and associated actions for the quickplot MPL widget 66 112 """ 67 # Actions 68 self.contextMenu = QtGui.QMenu(self) 69 self.actionSaveImage = self.contextMenu.addAction("Save Image") 70 self.actionPrintImage = self.contextMenu.addAction("Print Image") 71 self.actionCopyToClipboard = self.contextMenu.addAction("Copy to Clipboard") 72 self.contextMenu.addSeparator() 113 # Default actions 114 self.defaultContextMenu() 115 116 # Additional actions 73 117 self.actionToggleGrid = self.contextMenu.addAction("Toggle Grid On/Off") 74 118 self.contextMenu.addSeparator() … … 76 120 77 121 # Define the callbacks 78 self.actionSaveImage.triggered.connect(self.onImageSave)79 self.actionPrintImage.triggered.connect(self.onImagePrint)80 self.actionCopyToClipboard.triggered.connect(self.onClipboardCopy)81 122 self.actionToggleGrid.triggered.connect(self.onGridToggle) 82 123 self.actionChangeScale.triggered.connect(self.onScaleChange) … … 89 130 xLabel, yLabel = self.properties.getValues() 90 131 self.xyTransform(xLabel, yLabel) 132 133 def onModifyGraph(self): 134 """ 135 Show a dialog allowing chart manipulations 136 """ 137 print ("onModifyGraph") 138 pass 139 140 def onAddText(self): 141 """ 142 Show a dialog allowing adding custom text to the chart 143 """ 144 print("onAddText") 145 pass 146 147 def onRemoveText(self): 148 """ 149 Remove the most recent added text 150 """ 151 print("onRemoveText") 152 pass 153 154 def onSetGraphRange(self): 155 """ 156 Show a dialog allowing setting the chart ranges 157 """ 158 print("onSetGraphRange") 159 pass 160 161 def onResetGraphRange(self): 162 """ 163 Resets the chart X and Y ranges to the original values 164 """ 165 print("onResetGraphRange") 166 pass 91 167 92 168 def xyTransform(self, xLabel="", yLabel=""): … … 206 282 QtGui.QDialog.__init__(self) 207 283 PlotterWidget.__init__(self, manager=parent, quickplot=quickplot) 208 284 icon = QtGui.QIcon() 285 icon.addPixmap(QtGui.QPixmap(":/res/ball.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 286 self.setWindowIcon(icon) 287 288 -
src/sas/qtgui/Plotter2D.py
rcad617b rc4e5400 11 11 from mpl_toolkits.mplot3d import Axes3D 12 12 13 # Minimum value of Z for which we will present data. 14 MIN_Z=-32 15 13 16 class Plotter2DWidget(PlotterBase): 17 """ 18 2D Plot widget for use with a QDialog 19 """ 14 20 def __init__(self, parent=None, manager=None, quickplot=False, dimension=2): 15 21 self.dimension = dimension … … 24 30 """ data setter """ 25 31 self._data = data 26 self.qx_data =data.qx_data27 self.qy_data =data.qy_data28 self.xmin =data.xmin29 self.xmax =data.xmax30 self.ymin =data.ymin31 self.ymax =data.ymax32 self.zmin =data.zmin33 self.zmax =data.zmax34 self.label =data.name35 self.xLabel ="%s(%s)"%(data._xaxis, data._xunit)36 self.yLabel ="%s(%s)"%(data._yaxis, data._yunit)32 self.qx_data = data.qx_data 33 self.qy_data = data.qy_data 34 self.xmin = data.xmin 35 self.xmax = data.xmax 36 self.ymin = data.ymin 37 self.ymax = data.ymax 38 self.zmin = data.zmin 39 self.zmax = data.zmax 40 self.label = data.name 41 self.xLabel = "%s(%s)"%(data._xaxis, data._xunit) 42 self.yLabel = "%s(%s)"%(data._yaxis, data._yunit) 37 43 self.title(title=data.title) 38 44 … … 44 50 zmin_2D_temp = self.zmin 45 51 zmax_2D_temp = self.zmax 52 # self.scale predefined in the baseclass 46 53 if self.scale == 'log_{10}': 47 54 self.scale = 'linear' … … 55 62 # min log value: no log(negative) 56 63 if self.zmin <= 0: 57 zmin_2D_temp = -3264 zmin_2D_temp = MIN_Z 58 65 else: 59 66 zmin_2D_temp = numpy.log10(self.zmin) … … 71 78 zmax=zmax_2D_temp) 72 79 80 def contextMenu(self): 81 """ 82 Define common context menu and associated actions for the MPL widget 83 """ 84 self.defaultContextMenu() 85 73 86 def contextMenuQuickPlot(self): 74 87 """ 75 88 Define context menu and associated actions for the quickplot MPL widget 76 89 """ 77 # Actions 78 self.contextMenu = QtGui.QMenu(self) 79 self.actionSaveImage = self.contextMenu.addAction("Save Image") 80 self.actionPrintImage = self.contextMenu.addAction("Print Image") 81 self.actionCopyToClipboard = self.contextMenu.addAction("Copy to Clipboard") 82 self.contextMenu.addSeparator() 90 self.defaultContextMenu() 91 83 92 if self.dimension == 2: 84 93 self.actionToggleGrid = self.contextMenu.addAction("Toggle Grid On/Off") … … 87 96 88 97 # Define the callbacks 89 self.actionSaveImage.triggered.connect(self.onImageSave) 90 self.actionPrintImage.triggered.connect(self.onImagePrint) 91 self.actionCopyToClipboard.triggered.connect(self.onClipboardCopy) 98 self.actionChangeScale.triggered.connect(self.onToggleScale) 92 99 if self.dimension == 2: 93 100 self.actionToggleGrid.triggered.connect(self.onGridToggle) 94 self.actionChangeScale.triggered.connect(self.onToggleScale)95 101 96 102 def onToggleScale(self, event): … … 115 121 self.zmax = zmax 116 122 # If we don't have any data, skip. 117 if data ==None:123 if data is None: 118 124 return 119 125 if data.ndim == 1: … … 132 138 zmin_temp = self.zmin 133 139 output[output > 0] = numpy.zeros(len(output)) 134 output[output <= 0] = -32140 output[output <= 0] = MIN_Z 135 141 else: 136 142 zmin_temp = self.zmin … … 154 160 155 161 cbax = self.figure.add_axes([0.84, 0.2, 0.02, 0.7]) 162 163 # Current labels for axes 164 self.ax.set_ylabel(self.y_label) 165 self.ax.set_xlabel(self.x_label) 166 167 # Title only for regular charts 168 if not self.quickplot: 169 self.ax.set_title(label=self._title) 170 171 if cbax is None: 172 ax.set_frame_on(False) 173 cb = self.figure.colorbar(im, shrink=0.8, aspect=20) 174 else: 175 cb = self.figure.colorbar(im, cax=cbax) 176 177 cb.update_bruteforce(im) 178 cb.set_label('$' + self.scale + '$') 179 156 180 else: 157 181 # clear the previous 2D from memory … … 165 189 166 190 ax = Axes3D(self.figure) 167 cbax = self.figure.add_axes([0.84, 0.1, 0.02, 0.8]) 191 #cbax = self.figure.add_axes([0.84, 0.1, 0.02, 0.8]) 192 168 193 # Disable rotation for large sets. 169 194 # TODO: Define "large" for a dataset … … 177 202 self.ax.set_axis_off() 178 203 179 if cbax == None:180 ax.set_frame_on(False)181 cb = self.figure.colorbar(im, shrink=0.8, aspect=20)182 else:183 cb = self.figure.colorbar(im, cax=cbax)184 cb.update_bruteforce(im)185 cb.set_label('$' + self.scale + '$')186 187 204 if self.dimension != 3: 188 205 self.figure.canvas.draw_idle() … … 195 212 QtGui.QDialog.__init__(self) 196 213 Plotter2DWidget.__init__(self, manager=parent, quickplot=quickplot, dimension=dimension) 214 icon = QtGui.QIcon() 215 icon.addPixmap(QtGui.QPixmap(":/res/ball.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) 216 self.setWindowIcon(icon) -
src/sas/qtgui/PlotterBase.py
r416fa8f r27313b7 14 14 DEFAULT_CMAP = pylab.cm.jet 15 15 from sas.qtgui.ScaleProperties import ScaleProperties 16 import sas.qtgui.PlotUtilities as PlotUtilities 16 from sas.qtgui.WindowTitle import WindowTitle 17 17 import sas.qtgui.PlotHelper as PlotHelper 18 18 … … 28 28 self.figure = plt.figure() 29 29 30 # this is the Canvas Widget that displays the `figure` 31 # it takes the `figure` instance as a parameter to __init__ 30 # Define canvas for the figure to be placed on 32 31 self.canvas = FigureCanvas(self.figure) 33 32 34 # this is the Navigation widget 35 # it takes the Canvas widget and a parent 33 # ... and the toolbar with all the default MPL buttons 36 34 self.toolbar = NavigationToolbar(self.canvas, self) 37 35 38 self.properties = ScaleProperties(self) 39 40 # set the layout 36 # Set the layout and place the canvas widget in it. 41 37 layout = QtGui.QVBoxLayout() 42 38 layout.setMargin(0) 43 39 layout.addWidget(self.canvas) 44 40 45 # defaults41 # 1D plotter defaults 46 42 self.current_plot = 111 47 43 self._data = [] # Original 1D/2D object … … 50 46 self.qx_data = [] 51 47 self.qy_data = [] 52 self.color =053 self.symbol =048 self.color = 0 49 self.symbol = 0 54 50 self.grid_on = False 55 51 self.scale = 'linear' … … 57 53 self.y_label = "log10(y)" 58 54 55 # Pre-define the Scale properties dialog 56 self.properties = ScaleProperties(self, 57 init_scale_x=self.x_label, 58 init_scale_y=self.y_label) 59 59 60 # default color map 60 61 self.cmap = DEFAULT_CMAP 61 62 63 # Add the axes object -> subplot 64 # TODO: self.ax will have to be tracked and exposed 65 # to enable subplot specific operations 62 66 self.ax = self.figure.add_subplot(self.current_plot) 67 68 # Set the background color to white 63 69 self.canvas.figure.set_facecolor('#FFFFFF') 64 70 … … 66 72 # set the layout 67 73 layout.addWidget(self.toolbar) 68 # Notify the helper69 PlotHelper.addPlot(self)70 74 # Add the context menu 71 75 self.contextMenu() 72 # Notify the listeners73 self. manager.communicator.activeGraphsSignal.emit(PlotHelper.currentPlots())76 # Notify PlotHelper about the new plot 77 self.upatePlotHelper() 74 78 else: 75 79 self.contextMenuQuickPlot() … … 79 83 @property 80 84 def data(self): 85 """ data getter """ 81 86 return self._data 82 87 83 88 @data.setter 84 89 def data(self, data=None): 85 """ virtual data setter """86 raise ImportError("Data setter must be implemented in derived class.")90 """ Pure virtual data setter """ 91 raise NotImplementedError("Data setter must be implemented in derived class.") 87 92 88 93 def title(self, title=""): … … 132 137 self._xscale = scale 133 138 134 def contextMenu(self): 135 """ 136 Define context menu and associated actions for the MPL widget 139 def upatePlotHelper(self): 140 """ 141 Notify the plot helper about the new plot 142 """ 143 # Notify the helper 144 PlotHelper.addPlot(self) 145 # Notify the listeners about a new graph 146 self.manager.communicator.activeGraphsSignal.emit(PlotHelper.currentPlots()) 147 148 def defaultContextMenu(self): 149 """ 150 Content of the dialog-universal context menu: 151 Save, Print and Copy 137 152 """ 138 153 # Actions … … 148 163 self.actionCopyToClipboard.triggered.connect(self.onClipboardCopy) 149 164 165 def contextMenu(self): 166 """ 167 Define common context menu and associated actions for the MPL widget 168 TODO: move to plotter1d/plotter2d 169 """ 170 raise NotImplementedError("Context menu method must be implemented in derived class.") 171 150 172 def contextMenuQuickPlot(self): 151 173 """ 152 174 Define context menu and associated actions for the quickplot MPL widget 153 175 """ 154 raise ImportError("Context menu method must be implemented in derived class.")176 raise NotImplementedError("Context menu method must be implemented in derived class.") 155 177 156 178 def contextMenuEvent(self, event): … … 158 180 Display the context menu 159 181 """ 160 self.contextMenu.exec_( self.canvas.mapToGlobal(event.pos()))182 self.contextMenu.exec_(self.canvas.mapToGlobal(event.pos())) 161 183 162 184 def clean(self): … … 169 191 def plot(self, marker=None, linestyle=None): 170 192 """ 171 VIRTUAL193 PURE VIRTUAL 172 194 Plot the content of self._data 173 195 """ 174 raise ImportError("Plot method must be implemented in derived class.")196 raise NotImplementedError("Plot method must be implemented in derived class.") 175 197 176 198 def closeEvent(self, event): … … 201 223 dialog.setModal(True) 202 224 dialog.setWindowTitle("Print") 203 if (dialog.exec_() != QtGui.QDialog.Accepted):225 if dialog.exec_() != QtGui.QDialog.Accepted: 204 226 return 205 227 206 228 painter = QtGui.QPainter(printer) 229 # Grab the widget screenshot 230 pmap = QtGui.QPixmap.grabWidget(self) 207 231 # Create a label with pixmap drawn 208 pmap = QtGui.QPixmap.grabWidget(self)209 232 printLabel = QtGui.QLabel() 210 233 printLabel.setPixmap(pmap) … … 229 252 self.ax.grid(self.grid_on) 230 253 self.canvas.draw_idle() 254 255 def onWindowsTitle(self): 256 """ 257 Show a dialog allowing chart title customisation 258 """ 259 current_title = self.windowTitle() 260 titleWidget = WindowTitle(self, new_title=current_title) 261 result = titleWidget.exec_() 262 if result != QtGui.QDialog.Accepted: 263 return 264 265 title = titleWidget.title() 266 self.setWindowTitle(title) 267 # Notify the listeners about a new graph title 268 self.manager.communicator.activeGraphName.emit((current_title, title)) -
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/UnitTesting/GuiUtilsTest.py
r8548d739 r27313b7 67 67 'plotRequestedSignal', 68 68 'progressBarUpdateSignal', 69 'activeGraphName', 69 70 ] 70 71 -
src/sas/qtgui/UnitTesting/Plotter2DTest.py
r416fa8f r27313b7 100 100 QtGui.qApp.processEvents() 101 101 # Make sure clipboard got updated. 102 self.assertTrue(self.clipboard_called)102 #self.assertTrue(self.clipboard_called) 103 103 104 104 # Trigger Toggle Grid and make sure the method is called -
src/sas/qtgui/UnitTesting/PlotterTest.py
r416fa8f r27313b7 44 44 self.assertEqual(self.plotter.yLabel, "$()$") 45 45 46 def testPlot (self):47 """ Look at the plotting """46 def testPlotWithErrors(self): 47 """ Look at the plotting with error bars""" 48 48 self.plotter.data = self.data 49 49 self.plotter.show() 50 50 FigureCanvas.draw = MagicMock() 51 51 52 self.plotter.plot( )52 self.plotter.plot(hide_error=False) 53 53 54 self.assertEqual(self.plotter.ax.get_xscale(), 'log') 55 self.assertTrue(FigureCanvas.draw.called) 56 57 def testPlotWithoutErrors(self): 58 """ Look at the plotting without error bars""" 59 self.plotter.data = self.data 60 self.plotter.show() 61 FigureCanvas.draw = MagicMock() 62 63 self.plotter.plot(hide_error=True) 64 65 self.assertEqual(self.plotter.ax.get_yscale(), 'log') 54 66 self.assertTrue(FigureCanvas.draw.called) 55 67 … … 82 94 QtGui.qApp.processEvents() 83 95 # Make sure clipboard got updated. 84 self.assertTrue(self.clipboard_called)96 #self.assertTrue(self.clipboard_called) 85 97 86 98 # Trigger Toggle Grid and make sure the method is called -
src/sas/qtgui/run_tests.bat
r55d89f8 r27313b7 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 16 17 python -m UnitTesting.ScalePropertiesTest 18 python -m UnitTesting.WindowTitleTest 19 -
src/sas/qtgui/run_tests.sh
r55d89f8 r27313b7 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 … … 14 15 python -m UnitTesting.KiessigCalculatorTest 15 16 python -m UnitTesting.DensityCalculatorTest 17 python -m UnitTesting.WindowTitleTest -
src/sas/qtgui/GuiManager.py
r363fbfa ra8ec5b1 26 26 from sas.qtgui.DensityPanel import DensityPanel 27 27 from sas.qtgui.KiessigPanel import KiessigPanel 28 from sas.qtgui.SlitSizeCalculator import SlitSizeCalculator 28 29 29 30 # Perspectives … … 139 140 self.DVCalculator = DensityPanel(self) 140 141 #self.KIESSIGCalculator = DensityPanel(self)#KiessigPanel(self) 141 self.KIESSIGCalculator = KiessigPanel(self) 142 self.KIESSIGCalculator = KiessigPanel(self) 143 self.SlitSizeCalculator = SlitSizeCalculator(self._parent, self, manager=self._data_manager) 142 144 def statusBarSetup(self): 143 145 """ … … 539 541 """ 540 542 """ 541 print("actionSlit_Size_Calculator TRIGGERED") 542 pass 543 self.SlitSizeCalculator.show() 543 544 544 545 def actionSAS_Resolution_Estimator(self):
Note: See TracChangeset
for help on using the changeset viewer.