- Timestamp:
- Oct 20, 2017 2:45:46 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:
- 7d9c83c
- Parents:
- 44880ac (diff), 1420066 (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. - Location:
- src/sas/qtgui
- Files:
-
- 3 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/GUITests.py
r01cda57 rd5c5d3d 38 38 from Calculators.UnitTesting import SlitSizeCalculatorTest 39 39 from Calculators.UnitTesting import ResolutionCalculatorPanelTest 40 from Calculators.UnitTesting import DataOperationUtilityTest 40 41 41 42 # Utilities … … 94 95 unittest.makeSuite(SlitSizeCalculatorTest.SlitSizeCalculatorTest, 'test'), 95 96 unittest.makeSuite(ResolutionCalculatorPanelTest.ResolutionCalculatorPanelTest, 'test'), 97 unittest.makeSuite(DataOperationUtilityTest.DataOperationUtilityTest, 'test'), 96 98 97 99 # Perspectives -
src/sas/qtgui/MainWindow/DataExplorer.py
r7d8bebf r1420066 93 93 self.communicator.activeGraphName.connect(self.updatePlotName) 94 94 self.communicator.plotUpdateSignal.connect(self.updatePlot) 95 95 96 self.cbgraph.editTextChanged.connect(self.enableGraphCombo) 96 97 self.cbgraph.currentIndexChanged.connect(self.enableGraphCombo) … … 280 281 # Use 'while' so the row count is forced at every iteration 281 282 deleted_indices = [] 283 deleted_names = [] 282 284 while ind < self.model.rowCount(): 283 285 ind += 1 284 286 item = self.model.item(ind) 287 285 288 if item and item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 286 289 # Delete these rows from the model 290 deleted_names.append(str(self.model.item(ind).text())) 287 291 deleted_indices.append(item) 292 288 293 self.model.removeRow(ind) 289 294 # Decrement index since we just deleted it … … 292 297 # Let others know we deleted data 293 298 self.communicator.dataDeletedSignal.emit(deleted_indices) 299 300 # update stored_data 301 self.manager.update_stored_data(deleted_names) 294 302 295 303 def deleteTheory(self, event): … … 869 877 self.txt_widget.setWindowIcon(QtGui.QIcon(":/res/ball.ico")) 870 878 self.txt_widget.setWindowTitle("Data Info: %s" % data.filename) 879 self.txt_widget.clear() 871 880 self.txt_widget.insertPlainText(text_to_show) 872 881 … … 1012 1021 self.model.appendRow(checkbox_item) 1013 1022 1014 1015 1023 def updateModelFromPerspective(self, model_item): 1016 1024 """ -
src/sas/qtgui/MainWindow/DataManager.py
rdc5ef15 r1420066 275 275 del self.stored_data[id] 276 276 277 278 277 def get_by_name(self, name_list=None): 279 278 """ … … 295 294 if data_state.data.name == selected_name: 296 295 del self.stored_data[id] 296 297 def update_stored_data(self, name_list=None): 298 """ update stored data after deleting files in Data Explorer """ 299 for selected_name in name_list: 300 for idx in self.stored_data.keys(): 301 if str(selected_name) in str(idx): 302 print selected_name, idx 303 del self.stored_data[idx] 297 304 298 305 def get_data_state(self, data_id): -
src/sas/qtgui/MainWindow/GuiManager.py
r01cda57 rf0bb711 31 31 from sas.qtgui.Calculators.GenericScatteringCalculator import GenericScatteringCalculator 32 32 from sas.qtgui.Calculators.ResolutionCalculatorPanel import ResolutionCalculatorPanel 33 33 from sas.qtgui.Calculators.DataOperationUtilityPanel import DataOperationUtilityPanel 34 34 35 35 # Perspectives … … 47 47 Main SasView window functionality 48 48 """ 49 49 50 def __init__(self, parent=None): 50 51 """ … … 142 143 self.GENSASCalculator = GenericScatteringCalculator(self) 143 144 self.ResolutionCalculator = ResolutionCalculatorPanel(self) 145 self.DataOperation = DataOperationUtilityPanel(self) 144 146 145 147 def statusBarSetup(self): … … 337 339 self.communicate.updateTheoryFromPerspectiveSignal.connect(self.updateTheoryFromPerspective) 338 340 self.communicate.plotRequestedSignal.connect(self.showPlot) 341 self.communicate.updateModelFromDataOperationPanelSignal.connect(self.updateModelFromDataOperationPanel) 339 342 340 343 def addTriggers(self): … … 531 534 """ 532 535 """ 533 print("actionData_Operation TRIGGERED") 534 pass 536 self.communicate.sendDataToPanelSignal.emit(self._data_manager.get_all_data()) 537 538 self.DataOperation.show() 535 539 536 540 def actionSLD_Calculator(self): … … 731 735 self.filesWidget.updateTheoryFromPerspective(index) 732 736 737 def updateModelFromDataOperationPanel(self, new_item, new_datalist_item): 738 """ 739 :param new_item: item to be added to list of loaded files 740 :param new_datalist_item: 741 """ 742 if not isinstance(new_item, QtGui.QStandardItem) or \ 743 not isinstance(new_datalist_item, dict): 744 msg = "Wrong data type returned from calculations." 745 raise AttributeError, msg 746 747 self.filesWidget.model.appendRow(new_item) 748 self._data_manager.add_data(new_datalist_item) 749 733 750 def showPlot(self, plot): 734 751 """ … … 737 754 if hasattr(self, "filesWidget"): 738 755 self.filesWidget.displayData(plot) 739 -
src/sas/qtgui/Plotting/Plotter.py
rfef38e8 rf0bb711 145 145 146 146 # Now add the legend with some customizations. 147 147 148 self.legend = ax.legend(loc='upper right', shadow=True) 148 149 if self.legend: -
src/sas/qtgui/Plotting/Plotter2D.py
r01cda57 rd5c5d3d 87 87 self._item = item 88 88 89 def plot(self, data=None, marker=None ):89 def plot(self, data=None, marker=None, show_colorbar=True): 90 90 """ 91 91 Plot 2D self._data … … 109 109 ymin=self.ymin, ymax=self.ymax, 110 110 cmap=self.cmap, zmin=zmin_2D_temp, 111 zmax=zmax_2D_temp )111 zmax=zmax_2D_temp, show_colorbar=show_colorbar) 112 112 113 113 def calculateDepth(self): … … 379 379 380 380 def showPlot(self, data, qx_data, qy_data, xmin, xmax, ymin, ymax, 381 zmin, zmax, label='data2D', cmap=DEFAULT_CMAP ):381 zmin, zmax, label='data2D', cmap=DEFAULT_CMAP, show_colorbar=True): 382 382 """ 383 383 Render and show the current data … … 457 457 self.vmax = cb.vmax 458 458 459 if show_colorbar is False: 460 cb.remove() 461 459 462 else: 460 463 # clear the previous 2D from memory -
src/sas/qtgui/Utilities/GuiUtils.py
re694f0f rf0bb711 144 144 # custom open_path 145 145 open_folder = custom_config.DEFAULT_OPEN_FOLDER 146 if open_folder !=None and os.path.isdir(open_folder):146 if open_folder is not None and os.path.isdir(open_folder): 147 147 DEFAULT_OPEN_FOLDER = os.path.abspath(open_folder) 148 148 else: … … 230 230 dataDeletedSignal = QtCore.pyqtSignal(list) 231 231 232 # Send data to Data Operation Utility panel 233 sendDataToPanelSignal = QtCore.pyqtSignal(dict) 234 235 # Send result of Data Operation Utility panel to Data Explorer 236 updateModelFromDataOperationPanelSignal = QtCore.pyqtSignal(QtGui.QStandardItem, dict) 232 237 233 238 def updateModelItemWithPlot(item, update_data, name=""): … … 430 435 text += 'X_min = %s: X_max = %s\n' % (xmin, max(data.x)) 431 436 text += 'Y_min = %s: Y_max = %s\n' % (ymin, max(data.y)) 432 if data.dy !=None:437 if data.dy is not None: 433 438 text += 'dY_min = %s: dY_max = %s\n' % (min(data.dy), max(data.dy)) 434 439 text += '\nData Points:\n' 435 440 x_st = "X" 436 441 for index in range(len(data.x)): 437 if data.dy !=None and len(data.dy) > index:442 if data.dy is not None and len(data.dy) > index: 438 443 dy_val = data.dy[index] 439 444 else: 440 445 dy_val = 0.0 441 if data.dx !=None and len(data.dx) > index:446 if data.dx is not None and len(data.dx) > index: 442 447 dx_val = data.dx[index] 443 448 else: 444 449 dx_val = 0.0 445 if data.dxl !=None and len(data.dxl) > index:450 if data.dxl is not None and len(data.dxl) > index: 446 451 if index == 0: 447 452 x_st = "Xl" 448 453 dx_val = data.dxl[index] 449 elif data.dxw !=None and len(data.dxw) > index:454 elif data.dxw is not None and len(data.dxw) > index: 450 455 if index == 0: 451 456 x_st = "Xw" … … 486 491 y_val = data.qy_data[index] 487 492 i_val = data.data[index] 488 if data.err_data !=None:493 if data.err_data is not None: 489 494 di_val = data.err_data[index] 490 if data.dqx_data !=None:495 if data.dqx_data is not None: 491 496 dx_val = data.dqx_data[index] 492 if data.dqy_data !=None:497 if data.dqy_data is not None: 493 498 dy_val = data.dqy_data[index] 494 499 … … 523 528 has_errors = False 524 529 if has_errors: 525 if data.dx !=None and data.dx != []:530 if data.dx is not None and data.dx != []: 526 531 out.write("<X> <Y> <dY> <dX>\n") 527 532 else: … … 532 537 for i in range(len(data.x)): 533 538 if has_errors: 534 if data.dx !=None and data.dx != []:539 if data.dx is not None and data.dx != []: 535 540 if data.dx[i] != None: 536 541 out.write("%g %g %g %g\n" % (data.x[i], -
src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
r464cd07 rf0bb711 69 69 'progressBarUpdateSignal', 70 70 'activeGraphName', 71 'sendDataToPanelSignal', 72 'updateModelFromDataOperationPanelSignal' 71 73 ] 72 74 … … 412 414 self.assertEqual(yscale, "log") 413 415 416 414 417 class FormulaValidatorTest(unittest.TestCase): 415 418 """ Test the formula validator """ -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r8222f171 ra95c44b 137 137 model.setHeaderData(4, QtCore.Qt.Horizontal, QtCore.QVariant("Units")) 138 138 139 model.header_tooltips = ['Select parameter for fitting', 140 'Enter parameter value', 141 'Enter minimum value for parameter', 142 'Enter maximum value for parameter', 143 'Unit of the parameter'] 139 144 def addErrorHeadersToModel(model): 140 145 """ … … 147 152 model.setHeaderData(4, QtCore.Qt.Horizontal, QtCore.QVariant("Max")) 148 153 model.setHeaderData(5, QtCore.Qt.Horizontal, QtCore.QVariant("Units")) 154 155 model.header_tooltips = ['Select parameter for fitting', 156 'Enter parameter value', 157 'Error value for fitted parameter', 158 'Enter minimum value for parameter', 159 'Enter maximum value for parameter', 160 'Unit of the parameter'] 149 161 150 162 def addPolyHeadersToModel(model): … … 160 172 model.setHeaderData(6, QtCore.Qt.Horizontal, QtCore.QVariant("Function")) 161 173 model.setHeaderData(7, QtCore.Qt.Horizontal, QtCore.QVariant("Filename")) 174 175 model.header_tooltips = ['Select parameter for fitting', 176 'Enter polydispersity ratio (STD/mean). ' 177 'STD: standard deviation from the mean value', 178 'Enter minimum value for parameter', 179 'Enter maximum value for parameter', 180 'Enter number of points for parameter', 181 'Enter number of sigmas parameter', 182 'Select distribution function', 183 'Select filename with user-definable distribution'] 162 184 163 185 def addErrorPolyHeadersToModel(model): … … 174 196 model.setHeaderData(7, QtCore.Qt.Horizontal, QtCore.QVariant("Function")) 175 197 model.setHeaderData(8, QtCore.Qt.Horizontal, QtCore.QVariant("Filename")) 198 199 model.header_tooltips = ['Select parameter for fitting', 200 'Enter polydispersity ratio (STD/mean). ' 201 'STD: standard deviation from the mean value', 202 'Error value for fitted parameter', 203 'Enter minimum value for parameter', 204 'Enter maximum value for parameter', 205 'Enter number of points for parameter', 206 'Enter number of sigmas parameter', 207 'Select distribution function', 208 'Select filename with user-definable distribution'] 176 209 177 210 def addShellsToModel(parameters, model, index): -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r8f2548c ra95c44b 50 50 51 51 USING_TWISTED = True 52 53 class ToolTippedItemModel(QtGui.QStandardItemModel): 54 55 def __init__(self, parent = None): 56 QtGui.QStandardItemModel.__init__(self,parent) 57 58 def headerData(self, section, orientation, role): 59 60 if role == QtCore.Qt.ToolTipRole: 61 if orientation == QtCore.Qt.Horizontal: 62 return QtCore.QString(str(self.header_tooltips[section])) 63 64 return QtGui.QStandardItemModel.headerData(self, section, orientation, role) 52 65 53 66 class FittingWidget(QtGui.QWidget, Ui_FittingWidgetUI): … … 240 253 # We can't use a single model here, due to restrictions on flattening 241 254 # the model tree with subclassed QAbstractProxyModel... 242 self._model_model = QtGui.QStandardItemModel()243 self._poly_model = QtGui.QStandardItemModel()244 self._magnet_model = QtGui.QStandardItemModel()255 self._model_model = ToolTippedItemModel() 256 self._poly_model = ToolTippedItemModel() 257 self._magnet_model = ToolTippedItemModel() 245 258 246 259 # Param model displayed in param list -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
ra14a2b0 rc7358b2 342 342 self.assertEqual(self.widget.lstPoly.horizontalHeader().count(), 8) 343 343 self.assertFalse(self.widget.lstPoly.horizontalHeader().stretchLastSection()) 344 345 # Test tooltips 346 self.assertEqual(len(self.widget._poly_model.header_tooltips), 8) 347 348 header_tooltips = ['Select parameter for fitting', 349 'Enter polydispersity ratio (STD/mean). ' 350 'STD: standard deviation from the mean value', 351 'Enter minimum value for parameter', 352 'Enter maximum value for parameter', 353 'Enter number of points for parameter', 354 'Enter number of sigmas parameter', 355 'Select distribution function', 356 'Select filename with user-definable distribution'] 357 for column, tooltip in enumerate(header_tooltips): 358 self.assertEqual(self.widget._poly_model.headerData( column, 359 QtCore.Qt.Horizontal, QtCore.Qt.ToolTipRole), 360 header_tooltips[column]) 344 361 345 362 # Test presence of comboboxes in last column … … 478 495 self.assertFalse(self.widget.lstMagnetic.horizontalHeader().stretchLastSection()) 479 496 497 #Test tooltips 498 self.assertEqual(len(self.widget._magnet_model.header_tooltips), 5) 499 500 header_tooltips = ['Select parameter for fitting', 501 'Enter parameter value', 502 'Enter minimum value for parameter', 503 'Enter maximum value for parameter', 504 'Unit of the parameter'] 505 for column, tooltip in enumerate(header_tooltips): 506 self.assertEqual(self.widget._magnet_model.headerData(column, 507 QtCore.Qt.Horizontal, QtCore.Qt.ToolTipRole), 508 header_tooltips[column]) 509 480 510 # Test rows 481 511 for row in xrange(self.widget._magnet_model.rowCount()): … … 835 865 name_modified_param = str(self.widget._model_model.item(5, 0).text()) 836 866 867 # Check the model 868 self.assertEqual(self.widget._model_model.rowCount(), 6) 869 self.assertEqual(self.widget._model_model.columnCount(), 5) 870 871 # Test the header 872 #self.assertEqual(self.widget.lstParams.horizontalHeader().count(), 5) 873 #self.assertFalse(self.widget.lstParams.horizontalHeader().stretchLastSection()) 874 875 self.assertEqual(len(self.widget._model_model.header_tooltips), 5) 876 header_tooltips = ['Select parameter for fitting', 877 'Enter parameter value', 878 'Enter minimum value for parameter', 879 'Enter maximum value for parameter', 880 'Unit of the parameter'] 881 for column, tooltip in enumerate(header_tooltips): 882 self.assertEqual(self.widget._model_model.headerData(column, 883 QtCore.Qt.Horizontal, QtCore.Qt.ToolTipRole), 884 header_tooltips[column]) 885 837 886 # check that the value has been modified in kernel_module 838 887 self.assertEqual(new_value, -
src/sas/qtgui/Perspectives/Invariant/InvariantDetails.py
r457d961 r28cda69 64 64 self.label_3.setStyleSheet(new_font) 65 65 self.label_4.setStyleSheet(new_font) 66 self.label_ .setStyleSheet(new_font)66 self.label_7.setStyleSheet(new_font) 67 67 68 68 self.show()
Note: See TracChangeset
for help on using the changeset viewer.