Changeset 2a432e7 in sasview for src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
- Timestamp:
- May 17, 2017 3:17:36 AM (8 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:
- dc5ef15
- Parents:
- 00b3b40
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r00b3b40 r2a432e7 52 52 # Necessary globals 53 53 self.parent = parent 54 55 # Which tab is this widget displayed in? 56 self.tab_id = tab_id 57 58 # Main Data[12]D holder 59 self.logic = FittingLogic(data=data) 60 61 # Globals 62 self.initializeGlobals() 63 64 # Main GUI setup up 65 self.setupUi(self) 66 self.setWindowTitle("Fitting") 67 68 # Set up tabs widgets 69 self.initializeWidgets() 70 71 # Set up models and views 72 self.initializeModels() 73 74 # Defaults for the structure factors 75 self.setDefaultStructureCombo() 76 77 # Make structure factor and model CBs disabled 78 self.disableModelCombo() 79 self.disableStructureCombo() 80 81 # Generate the category list for display 82 self.initializeCategoryCombo() 83 84 # Connect signals to controls 85 self.initializeSignals() 86 87 # Initial control state 88 self.initializeControls() 89 90 # Display HTML content 91 self.helpView = QtWebKit.QWebView() 92 93 self._index = None 94 if data is not None: 95 self.data = data 96 97 def close(self): 98 """ 99 Remember to kill off things on exit 100 """ 101 self.helpView.close() 102 del self.helpView 103 104 @property 105 def data(self): 106 return self.logic.data 107 108 @data.setter 109 def data(self, value): 110 """ data setter """ 111 assert isinstance(value, QtGui.QStandardItem) 112 # _index contains the QIndex with data 113 self._index = value 114 115 # Update logics with data items 116 self.logic.data = GuiUtils.dataFromItem(value) 117 118 # Overwrite data type descriptor 119 self.is2D = True if isinstance(self.logic.data, Data2D) else False 120 121 self.data_is_loaded = True 122 123 # Enable/disable UI components 124 self.setEnablementOnDataLoad() 125 126 def initializeGlobals(self): 127 """ 128 Initialize global variables used in this class 129 """ 54 130 # SasModel is loaded 55 131 self.model_is_loaded = False … … 77 153 self.weighting = 0 78 154 self.chi2 = None 79 80 155 # Does the control support UNDO/REDO 81 156 # temporarily off … … 86 161 self.model_data = None 87 162 88 # Which tab is this widget displayed in?89 self.tab_id = tab_id90 91 163 # Which shell is being currently displayed? 92 164 self.current_shell_displayed = 0 93 165 self.has_error_column = False 94 166 95 # Main Data[12]D holder 96 self.logic = FittingLogic(data=data) 97 98 # Main GUI setup up 99 self.setupUi(self) 100 self.setWindowTitle("Fitting") 167 # signal communicator 101 168 self.communicate = self.parent.communicate 102 169 170 def initializeWidgets(self): 171 """ 172 Initialize widgets for tabs 173 """ 103 174 # Options widget 104 175 layout = QtGui.QGridLayout() … … 122 193 self.lblFilename.setText("") 123 194 195 def initializeModels(self): 196 """ 197 Set up models and views 198 """ 124 199 # Set the main models 125 200 # We can't use a single model here, due to restrictions on flattening … … 139 214 self.lstParams.setAlternatingRowColors(True) 140 215 stylesheet = """ 141 QTreeView {142 alternate-background-color: #f6fafb;143 b ackground: #e8f4fc;216 QTreeView::item:hover { 217 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1); 218 border: 1px solid #bfcde4; 144 219 } 145 """ 220 221 QTreeView::item:selected { 222 border: 1px solid #567dbc; 223 } 224 225 QTreeView::item:selected:active{ 226 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc); 227 } 228 229 QTreeView::item:selected:!active { 230 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf); 231 } 232 """ 146 233 self.lstParams.setStyleSheet(stylesheet) 147 234 self.lstParams.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) … … 160 247 self.setTableProperties(self.lstMagnetic) 161 248 162 # Defaults for the structure factors 163 self.setDefaultStructureCombo() 164 165 # Make structure factor and model CBs disabled 166 self.disableModelCombo() 167 self.disableStructureCombo() 168 169 # Generate the category list for display 249 def initializeCategoryCombo(self): 250 """ 251 Model category combo setup 252 """ 170 253 category_list = sorted(self.master_category_dict.keys()) 171 254 self.cbCategory.addItem(CATEGORY_DEFAULT) … … 173 256 self.cbCategory.addItem(CATEGORY_STRUCTURE) 174 257 self.cbCategory.setCurrentIndex(0) 175 176 # Connect signals to controls177 self.initializeSignals()178 179 # Initial control state180 self.initializeControls()181 182 # Display HTML content183 self.helpView = QtWebKit.QWebView()184 185 self._index = None186 if data is not None:187 self.data = data188 189 def close(self):190 """191 Remember to kill off things on exit192 """193 self.helpView.close()194 del self.helpView195 196 @property197 def data(self):198 return self.logic.data199 200 @data.setter201 def data(self, value):202 """ data setter """203 assert isinstance(value, QtGui.QStandardItem)204 # _index contains the QIndex with data205 self._index = value206 207 # Update logics with data items208 self.logic.data = GuiUtils.dataFromItem(value)209 210 # Overwrite data type descriptor211 self.is2D = True if isinstance(self.logic.data, Data2D) else False212 213 self.data_is_loaded = True214 215 # Enable/disable UI components216 self.setEnablementOnDataLoad()217 258 218 259 def setEnablementOnDataLoad(self):
Note: See TracChangeset
for help on using the changeset viewer.