Changeset fd7ef36 in sasview for src/sas/qtgui/MainWindow
- 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/MainWindow
- Files:
-
- 2 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 """
Note: See TracChangeset
for help on using the changeset viewer.