Changeset a281ab8 in sasview for src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
- Timestamp:
- Jun 15, 2016 5:57:34 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:
- 1042dba
- Parents:
- 5032ea68
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
r5032ea68 ra281ab8 12 12 from sas.sasgui.guiframe.dataFitting import Data1D 13 13 from sas.qtgui.GuiUtils import Communicate 14 from sas.qtgui.GuiUtils import updateModelItem 14 15 15 16 # local … … 35 36 self._model.appendRow(item) 36 37 37 # class InvariantWindow(InvariantUI):38 38 class InvariantWindow(tabbedInvariantUI): 39 39 # The controller which is responsible for managing signal slots connections … … 53 53 self._manager = manager 54 54 self._reactor = self._manager.reactor() 55 self._model_item = QtGui.QStandardItem() 55 56 56 57 self._helpView = QtWebKit.QWebView() … … 119 120 self._high_power_value = float(self.model.item(WIDGETS.W_HIGHQ_POWER_VALUE).text()) 120 121 121 def calculate (self):122 def calculateInvariant(self): 122 123 """ 123 124 Use twisted to thread the calculations away. … … 151 152 """ 152 153 """ 153 self._plotter.show() 154 if self._low_extrapolate or self._high_extrapolate: 155 self._plotter.show() 154 156 self.model = model 155 157 self.mapper.toFirst() … … 160 162 self.pushButton.setStyleSheet(self.style) 161 163 162 # Send the new datato DE for keeping in the model163 self.communicate.updateModelFromPerspectiveSignal.emit(self._ data)164 # Send the modified model item to DE for keeping in the model 165 self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item) 164 166 165 167 … … 255 257 256 258 # Plot the chart 259 title = "Low-Q extrapolation" 257 260 self._plotter.data(extrapolated_data) 258 self._plotter.title( "Low-Q extrapolation")261 self._plotter.title(title) 259 262 self._plotter.plot() 260 263 264 # Add the plot to the model item 265 variant_item = QtCore.QVariant(self._plotter) 266 updateModelItem(self._model_item, variant_item, title) 261 267 262 268 if self._high_extrapolate: … … 271 277 # find how to add this plot to the existing plot for low_extrapolate 272 278 # Plot the chart 279 title = "High-Q extrapolation" 273 280 self._plotter.data(high_out_data) 274 self._plotter.title( "High-Q extrapolation")281 self._plotter.title(title) 275 282 self._plotter.plot() 283 284 # Add the plot to the model item 285 variant_item = QtCore.QVariant(self._plotter) 286 updateModelItem(self._model_item, variant_item, title) 276 287 277 288 … … 326 337 327 338 def setupSlots(self): 328 self.pushButton.clicked.connect(self.calculate )339 self.pushButton.clicked.connect(self.calculateInvariant) 329 340 self.pushButton_2.clicked.connect(self.status) 330 341 self.pushButton_3.clicked.connect(self.help) … … 489 500 self.mapper.toFirst() 490 501 491 def setData(self, data_list=None): 502 def setData(self, data_item): 503 """ 504 Obtain a QStandardItem object and dissect it to get Data1D/2D 505 Pass it over to the calculator 506 """ 507 if not isinstance(data_item, list): 508 msg = "Incorrect type passed to the Invariant Perspective" 509 raise AttributeError, msg 510 511 if not isinstance(data_item[0], QtGui.QStandardItem): 512 msg = "Incorrect type passed to the Invariant Perspective" 513 raise AttributeError, msg 514 515 self._model_item = data_item[0] 516 517 # Extract data on 1st child - this is the Data1D/2D component 518 data = self._model_item.child(0).data().toPyObject() 519 520 self.calculate(data_list=[data]) 521 522 def calculate(self, data_list=None): 492 523 """ 493 524 receive a list of data and compute invariant 525 526 TODO: pass warnings/messages to log 494 527 """ 495 528 msg = "" … … 520 553 #wx.PostEvent(self.parent, StatusEvent(status=msg, info='error')) 521 554 return 522 msg += "Invariant panel does not allow multiple data!\n" 523 msg += "Please select one.\n" 555 556 # TODO: add msgbox for data choice 557 #msg += "Invariant panel does not allow multiple data!\n" 558 #msg += "Please select one.\n" 524 559 #if len(data_list) > 1: 525 560 #from invariant_widgets import DataDialog … … 545 580 self._data = data 546 581 self._path = "unique path" 547 self.calculate ()582 self.calculateInvariant() 548 583 except: 549 584 msg = "Invariant Set_data: " + str(sys.exc_value)
Note: See TracChangeset
for help on using the changeset viewer.