Changeset 4cdfa17 in sasview for src


Ignore:
Timestamp:
Dec 12, 2018 1:04:12 AM (6 years ago)
Author:
wojciech
Branches:
ESS_GUI, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_sync_sascalc
Children:
09b7da68
Parents:
b1626bea
Message:

Moving qt parts to main thread in Invariant perspective

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py

    r1dc1d431 r4cdfa17  
    409409                                       self._model_item, high_out_data, title) 
    410410 
    411         item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction))) 
    412         self.model.setItem(WIDGETS.W_VOLUME_FRACTION, item) 
    413         item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction_error))) 
    414         self.model.setItem(WIDGETS.W_VOLUME_FRACTION_ERR, item) 
     411        reactor.callFromThread(self.updateModelFromThread, WIDGETS.W_VOLUME_FRACTION, volume_fraction) 
     412        reactor.callFromThread(self.updateModelFromThread, WIDGETS.W_VOLUME_FRACTION_ERR, volume_fraction_error) 
    415413        if surface: 
    416             item = QtGui.QStandardItem(str(float('%.3g'% surface))) 
    417             self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE, item) 
    418             item = QtGui.QStandardItem(str(float('%.3g'% surface_error))) 
    419             self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE_ERR, item) 
    420         item = QtGui.QStandardItem(str(float('%.3g'% qstar_total))) 
    421         self.model.setItem(WIDGETS.W_INVARIANT, item) 
    422         item = QtGui.QStandardItem(str(float('%.3g'% qstar_total_error))) 
    423         self.model.setItem(WIDGETS.W_INVARIANT_ERR, item) 
    424  
    425         item = QtGui.QStandardItem(str(float('%.3g'% qstar_low))) 
    426         self.model.setItem(WIDGETS.D_LOW_QSTAR, item) 
    427         item = QtGui.QStandardItem(str(float('%.3g'% qstar_low_err))) 
    428         self.model.setItem(WIDGETS.D_LOW_QSTAR_ERR, item) 
    429         item = QtGui.QStandardItem(str(float('%.3g'% qstar_high))) 
    430         self.model.setItem(WIDGETS.D_HIGH_QSTAR, item) 
    431         item = QtGui.QStandardItem(str(float('%.3g'% qstar_high_err))) 
    432         self.model.setItem(WIDGETS.D_HIGH_QSTAR_ERR, item) 
    433  
     414            reactor.callFromThread(self.updateModelFromThread, WIDGETS.W_SPECIFIC_SURFACE, surface) 
     415            reactor.callFromThread(self.updateModelFromThread, WIDGETS.W_SPECIFIC_SURFACE_ERR, 
     416                                                    surface_error) 
     417 
     418        reactor.callFromThread(self.updateModelFromThread, WIDGETS.W_INVARIANT, qstar_total) 
     419        reactor.callFromThread(self.updateModelFromThread, WIDGETS.W_INVARIANT_ERR, qstar_total_error) 
     420        reactor.callFromThread(self.updateModelFromThread, WIDGETS.D_LOW_QSTAR, qstar_low) 
     421        reactor.callFromThread(self.updateModelFromThread, WIDGETS.D_LOW_QSTAR_ERR, qstar_low_err) 
     422        reactor.callFromThread(self.updateModelFromThread, WIDGETS.D_HIGH_QSTAR, qstar_high) 
     423        reactor.callFromThread(self.updateModelFromThread, WIDGETS.D_HIGH_QSTAR_ERR, qstar_high_err) 
    434424        return self.model 
     425 
     426 
     427    def updateModelFromThread(self, widget, value): 
     428        """ 
     429        Update the model in the main thread 
     430        """ 
     431        item = QtGui.QStandardItem(str(float('%.3g' % value))) 
     432        self.model.setItem(widget, item) 
    435433 
    436434    def title(self): 
Note: See TracChangeset for help on using the changeset viewer.