Changeset 14ec91c5 in sasview for src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
- Timestamp:
- Feb 2, 2018 9:21:48 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:
- a90c9c5
- Parents:
- 5e66738
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
rda9a0722 r14ec91c5 5 5 6 6 import sas.qtgui.Utilities.GuiUtils as GuiUtils 7 import sas.qtgui.Utilities.LocalConfig as LocalConfig 8 7 9 from PyQt5 import QtGui, QtCore, QtWidgets 8 10 … … 15 17 from sas.qtgui.Perspectives.Fitting.ConsoleUpdate import ConsoleUpdate 16 18 from sas.qtgui.Perspectives.Fitting.ComplexConstraint import ComplexConstraint 17 from sas.qtgui.Perspectives.Fitting.Constraint simport Constraint19 from sas.qtgui.Perspectives.Fitting.Constraint import Constraint 18 20 19 21 class ConstraintWidget(QtWidgets.QWidget, Ui_ConstraintWidgetUI): … … 22 24 """ 23 25 24 def __init__(self, parent=None , tab_id=1):26 def __init__(self, parent=None): 25 27 super(ConstraintWidget, self).__init__() 26 28 self.parent = parent 27 29 self.setupUi(self) 28 30 self.currentType = "FitPage" 29 self.tab_id = tab_id30 31 # Page id for fitting 31 32 # To keep with previous SasView values, use 300 as the start offset 32 self.page_id = 30 0 + self.tab_id33 self.page_id = 301 33 34 34 35 # Remember previous content of modified cell … … 118 119 pass 119 120 121 def getTabsForFit(self): 122 """ 123 Returns list of tab names selected for fitting 124 """ 125 return [tab for tab in self.tabs_for_fitting if self.tabs_for_fitting[tab]] 126 120 127 def onFit(self): 121 128 """ … … 123 130 """ 124 131 # Find out all tabs to fit 125 tabs_to_fit = [tab for tab in self.tabs_for_fitting if self.tabs_for_fitting[tab]]132 tabs_to_fit = self.getTabsForFit() 126 133 127 134 # Single fitter for the simultaneous run 128 135 sim_fitter = Fit() 129 136 sim_fitter.fitter_id = self.page_id 137 138 # Notify the parent about fitting started 139 self.parent.fittingStartedSignal.emit(tabs_to_fit) 130 140 131 141 # prepare fitting problems for each tab … … 157 167 completefn = self.onBatchFitComplete if self.currentType=='BatchPage' else self.onFitComplete 158 168 159 #ifUSING_TWISTED:160 handler = None161 updater = None162 #else:163 #handler = ConsoleUpdate(parent=self.parent,164 #manager=self,165 #improvement_delta=0.1)166 #updater = handler.update_fit169 if LocalConfig.USING_TWISTED: 170 handler = None 171 updater = None 172 else: 173 handler = ConsoleUpdate(parent=self.parent, 174 manager=self, 175 improvement_delta=0.1) 176 updater = handler.update_fit 167 177 168 178 batch_inputs = {} … … 178 188 completefn=completefn) 179 189 180 #ifUSING_TWISTED:181 # start the trhrhread with twisted182 calc_thread = threads.deferToThread(calc_fit.compute)183 calc_thread.addCallback(completefn)184 calc_thread.addErrback(self.onFitFailed)185 #else:186 ## Use the old python threads + Queue187 #calc_fit.queue()188 #calc_fit.ready(2.5)190 if LocalConfig.USING_TWISTED: 191 # start the trhrhread with twisted 192 calc_thread = threads.deferToThread(calc_fit.compute) 193 calc_thread.addCallback(completefn) 194 calc_thread.addErrback(self.onFitFailed) 195 else: 196 # Use the old python threads + Queue 197 calc_fit.queue() 198 calc_fit.ready(2.5) 189 199 190 200 … … 300 310 self.cmdFit.setEnabled(True) 301 311 312 # Notify the parent about completed fitting 313 self.parent.fittingStoppedSignal.emit(self.getTabsForFit()) 314 302 315 # get the elapsed time 303 316 elapsed = result[1] … … 330 343 self.cmdFit.setEnabled(True) 331 344 345 # Notify the parent about completed fitting 346 self.parent.fittingStoppedSignal.emit(self.getTabsForFit()) 347 332 348 # get the elapsed time 333 349 elapsed = result[1] … … 348 364 self.cmdFit.setText("Fit") 349 365 self.cmdFit.setEnabled(True) 366 367 # Notify the parent about completed fitting 368 self.parent.fittingStoppedSignal.emit(self.getTabsForFit()) 350 369 351 370 msg = "Fitting failed: %s s.\n" % reason
Note: See TracChangeset
for help on using the changeset viewer.