- Timestamp:
- Sep 6, 2018 4:53:39 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 605d944
- Parents:
- 2df558e
- Location:
- src/sas/qtgui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r6b50296 rfd7ef36 4 4 import time 5 5 import logging 6 import re7 6 8 7 from PyQt5 import QtCore … … 37 36 # The controller which is responsible for managing signal slots connections 38 37 # for the gui and providing an interface to the data model. 39 40 # This matches the ID of a plot created using FittingLogic._create1DPlot, e.g.41 # "5 [P(Q)] modelname"42 # or43 # "4 modelname".44 # Useful for determining whether the plot in question is for an intermediate result, such as P(Q) or S(Q) in the45 # case of a product model; the identifier for this is held in square brackets, as in the example above.46 theory_plot_ID_pattern = re.compile(r"^([0-9]+)\s+(\[(.*)\]\s+)?(.*)$")47 38 48 39 def __init__(self, parent=None, guimanager=None, manager=None): … … 581 572 else: 582 573 # Don't plot intermediate results, e.g. P(Q), S(Q) 583 match = self.theory_plot_ID_pattern.match(plot_id)574 match = GuiUtils.theory_plot_ID_pattern.match(plot_id) 584 575 # 2nd match group contains the identifier for the intermediate result, if present (e.g. "[P(Q)]") 585 576 if match and match.groups()[1] != None: … … 1290 1281 self.theory_model.appendRow(model_item) 1291 1282 1283 def deleteIntermediateTheoryPlotsByModelID(self, model_id): 1284 """Given a model's ID, deletes all items in the theory item model which reference the same ID. Useful in the 1285 case of intermediate results disappearing when changing calculations (in which case you don't want them to be 1286 retained in the list).""" 1287 items_to_delete = [] 1288 for r in range(self.theory_model.rowCount()): 1289 item = self.theory_model.item(r, 0) 1290 data = item.child(0).data() 1291 if not hasattr(data, "id"): 1292 return 1293 match = GuiUtils.theory_plot_ID_pattern.match(data.id) 1294 if match: 1295 item_model_id = match.groups()[-1] 1296 if item_model_id == model_id: 1297 # Only delete those identified as an intermediate plot 1298 if match.groups()[2] not in (None, ""): 1299 items_to_delete.append(item) 1300 1301 for item in items_to_delete: 1302 self.theory_model.removeRow(item.row()) -
src/sas/qtgui/MainWindow/GuiManager.py
r6b50296 rfd7ef36 395 395 self.communicate.perspectiveChangedSignal.connect(self.perspectiveChanged) 396 396 self.communicate.updateTheoryFromPerspectiveSignal.connect(self.updateTheoryFromPerspective) 397 self.communicate.deleteIntermediateTheoryPlotsSignal.connect(self.deleteIntermediateTheoryPlotsByModelID) 397 398 self.communicate.plotRequestedSignal.connect(self.showPlot) 398 399 self.communicate.plotFromFilenameSignal.connect(self.showPlotFromFilename) … … 886 887 self.filesWidget.updateTheoryFromPerspective(index) 887 888 889 def deleteIntermediateTheoryPlotsByModelID(self, model_id): 890 """ 891 Catch the signal to delete items in the Theory item model which correspond to a model ID. 892 Send the request to the DataExplorer for updating the theory model. 893 """ 894 self.filesWidget.deleteIntermediateTheoryPlotsByModelID(model_id) 895 888 896 def updateModelFromDataOperationPanel(self, new_item, new_datalist_item): 889 897 """ -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r444c221c rfd7ef36 2303 2303 new_plots.append(residuals) 2304 2304 2305 if self.data_is_loaded: 2306 GuiUtils.deleteRedundantPlots(self.all_data[self.data_index], new_plots) 2307 else: 2308 # delete theory items for the model, in order to get rid of any redundant items, e.g. beta(Q), S_eff(Q) 2309 self.communicate.deleteIntermediateTheoryPlotsSignal.emit(self.kernel_module.id) 2310 2305 2311 # Create plots for intermediate product data 2306 2312 pq_data, sq_data = self.logic.new1DProductPlots(return_data, self.tab_id) … … 2315 2321 # self.communicate.plotUpdateSignal.emit([sq_data]) 2316 2322 new_plots.append(sq_data) 2317 2318 if self.data_is_loaded:2319 GuiUtils.deleteRedundantPlots(self.all_data[self.data_index], new_plots)2320 2323 2321 2324 # Update/generate plots -
src/sas/qtgui/Utilities/GuiUtils.py
r9463ca2 rfd7ef36 35 35 HELP_DIRECTORY_LOCATION = "docs/sphinx-docs/build/html" 36 36 IMAGES_DIRECTORY_LOCATION = HELP_DIRECTORY_LOCATION + "/_images" 37 38 # This matches the ID of a plot created using FittingLogic._create1DPlot, e.g. 39 # "5 [P(Q)] modelname" 40 # or 41 # "4 modelname". 42 # Useful for determining whether the plot in question is for an intermediate result, such as P(Q) or S(Q) in the 43 # case of a product model; the identifier for this is held in square brackets, as in the example above. 44 theory_plot_ID_pattern = re.compile(r"^([0-9]+)\s+(\[(.*)\]\s+)?(.*)$") 37 45 38 46 def get_app_dir(): … … 211 219 # New theory data in current perspective 212 220 updateTheoryFromPerspectiveSignal = QtCore.pyqtSignal(QtGui.QStandardItem) 221 222 # Request to delete plots (in the theory view) related to a given model ID 223 deleteIntermediateTheoryPlotsSignal = QtCore.pyqtSignal(str) 213 224 214 225 # New plot requested from the GUI manager
Note: See TracChangeset
for help on using the changeset viewer.