Changeset 731efec in sasview for src/sas/qtgui/Perspectives


Ignore:
Timestamp:
Feb 12, 2018 2:12:13 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
6ca0da0
Parents:
235d766
Message:

Disconnect slots before reconnecting them again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py

    r235d766 r731efec  
    11import os 
    22import sys 
     3import logging 
    34 
    45from twisted.internet import threads 
     
    100101        Intercept update signals from fitting tabs 
    101102        """ 
    102         if tab is not None: 
    103             ObjectLibrary.getObject(tab).constraintAddedSignal.connect(self.initializeFitList) 
    104             ObjectLibrary.getObject(tab).newModelSignal.connect(self.initializeFitList) 
     103        if tab is None: 
     104            return 
     105        tab_object = ObjectLibrary.getObject(tab) 
     106 
     107        # Disconnect all local slots 
     108        tab_object.disconnect() 
     109 
     110        # Reconnect tab signals to local slots 
     111        tab_object.constraintAddedSignal.connect(self.initializeFitList) 
     112        tab_object.newModelSignal.connect(self.initializeFitList) 
    105113 
    106114    def onFitTypeChange(self, checked): 
     
    548556            self.tabs_for_fitting[tab_name] = True 
    549557 
     558        # Disable signals so we don't get infinite call recursion 
     559        self.tblTabList.blockSignals(True) 
    550560        self.tblTabList.setItem(pos, 0, item) 
    551561        self.tblTabList.setItem(pos, 1, self.uneditableItem(model_name)) 
     
    553563        # Moniker is editable, so no option change 
    554564        item = QtWidgets.QTableWidgetItem(moniker) 
    555         # Disable signals so we don't get infinite call recursion 
    556         self.tblTabList.blockSignals(True) 
    557565        self.tblTabList.setItem(pos, 3, item) 
    558566        self.tblTabList.blockSignals(False) 
     
    564572            return 
    565573        self.tblConstraints.setEnabled(True) 
     574        self.tblConstraints.blockSignals(True) 
    566575        for constraint, constraint_name in zip(constraints, constraint_names): 
    567576            # Create the text for widget item 
     
    576585            self.tblConstraints.insertRow(pos) 
    577586            self.tblConstraints.setItem(pos, 0, item) 
     587        self.tblConstraints.blockSignals(False) 
    578588 
    579589    def initializeFitList(self): 
     
    625635 
    626636    def getObjectByName(self, name): 
     637        """ 
     638        Given name of the fit, returns associated fit object 
     639        """ 
    627640        for object_name in ObjectLibrary.listObjects(): 
    628641            object = ObjectLibrary.getObject(object_name) 
Note: See TracChangeset for help on using the changeset viewer.