- Timestamp:
- Feb 21, 2017 8:56:32 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:
- b9c4c1e1
- Parents:
- 2162fa0
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
r8595edd r0efe791 2 2 import json 3 3 import os 4 from collections import defaultdict 5 4 6 from PyQt4 import QtGui 5 7 from PyQt4 import QtCore … … 9 11 from sasmodels import generate 10 12 from sasmodels import modelinfo 11 12 from collections import defaultdict13 13 from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 14 14 15 15 class FittingWindow(QtGui.QDialog, Ui_FittingUI): 16 """ 17 Main window for selecting form and structure factor models 18 """ 16 19 name = "Fitting" # For displaying in the combo box 17 20 def __init__(self, manager=None, parent=None): 21 """ 22 23 :param manager: 24 :param parent: 25 :return: 26 """ 18 27 super(FittingWindow, self).__init__() 28 19 29 self._model_model = QtGui.QStandardItemModel() 20 30 self._poly_model = QtGui.QStandardItemModel() 21 31 self.setupUi(self) 32 self.tableView.setModel(self._model_model) 22 33 23 34 self._readCategoryInfo() 24 cat_list = sorted(self.master_category_dict.keys()) 25 self.comboBox.addItems(cat_list) 26 self.tableView.setModel(self._model_model) 27 self.comboBox.currentIndexChanged.connect(self.selectCategoryModels) 28 29 category = self.comboBox.currentText() 30 31 #self.comboBox_2.addItem('Select Model') 32 item = QtGui.QStandardItem('Select Model') 33 item.setForeground(QtGui.QColor('red')) 34 self.comboBox_2.model().appendRow(item) 35 #This should disable selectin "Select Model" but it doesn't work 36 self.comboBox.setItemData(0, False, QtCore.Qt.UserRole - 1) 37 35 36 structure_factor_list = self.master_category_dict.pop('Structure Factor') 37 for (structure_factor, enabled) in structure_factor_list: 38 self.cbStructureFactor.addItem(structure_factor) 39 self.cbStructureFactor.currentIndexChanged.connect(self.selectStructureFactor) 40 41 category_list = sorted(self.master_category_dict.keys()) 42 self.cbCategory.addItems(category_list) 43 self.cbCategory.currentIndexChanged.connect(self.selectCategory) 44 45 category = self.cbCategory.currentText() 38 46 model_list = self.master_category_dict[str(category)] 39 47 for (model, enabled) in model_list: 40 self.comboBox_2.addItem(model) 41 42 self.comboBox_2.currentIndexChanged.connect(self.selectModel) 48 self.cbModel.addItem(model) 49 self.cbModel.currentIndexChanged.connect(self.selectModel) 43 50 44 51 self.pushButton.setEnabled(False) 45 self.checkBox_3.setEnabled(False) 46 self.checkBox_4.setEnabled(False) 47 self.label_20.setText("---") 48 self.label_21.setText("---") 49 self.label_24.setText("---") 52 self.chkPolydispersity.setEnabled(False) 53 self.chkSmearing.setEnabled(False) 54 55 #TODO: Can these be removed? 56 self.lblMinRangeDef.setText("---") 57 self.lblMaxRangeDef.setText("---") 58 self.lblChi2Value.setText("---") 50 59 51 60 #self.setTableProperties(self.tableView) … … 61 70 self.tableView_2.setIndexWidget(i,c) 62 71 63 def selectCategoryModels(self, index): 64 self.comboBox_2.clear() 65 category = self.comboBox.currentText() 72 def selectCategory(self): 73 """ 74 Select Category from list 75 :return: 76 """ 77 self.cbModel.clear() 78 category = self.cbCategory.currentText() 66 79 model_list = self.master_category_dict[str(category)] 67 80 for (model, enabled) in model_list: 68 self.comboBox_2.addItem(model) 69 70 def selectModel(self, index): 71 72 model = self.comboBox_2.currentText() 81 self.cbModel.addItem(model) 82 83 def selectModel(self): 84 """ 85 Select Model from list 86 :return: 87 """ 88 model = self.cbModel.currentText() 73 89 self.setModelModel(model) 90 91 def selectStructureFactor(self): 92 """ 93 Select Structure Factor from list 94 :param: 95 :return: 96 """ 97 74 98 75 99 def _readCategoryInfo(self): … … 109 133 110 134 def setModelModel(self, model_name): 135 """ 136 Setting model parameters into table based on selected 137 :param model_name: 138 :return: 139 """ 111 140 # Crete/overwrite model items 112 141 self._model_model.clear() … … 150 179 151 180 def setTableProperties(self, table): 152 181 """ 182 Setting table properties 183 :param table: 184 :return: 185 """ 153 186 table.setStyleSheet("background-image: url(model.png);") 154 187 … … 164 197 165 198 def setPolyModel(self): 199 """ 200 Set polydispersity values 201 :return: 202 """ 166 203 item1 = QtGui.QStandardItem("Distribution of radius") 167 204 item1.setCheckable(True) -
src/sas/qtgui/Perspectives/Fitting/UI/FittingUI.ui
r6a9559d r0efe791 133 133 </item> 134 134 <item row="1" column="0"> 135 <widget class="QComboBox" name="c omboBox"/>135 <widget class="QComboBox" name="cbCategory"/> 136 136 </item> 137 137 <item row="1" column="1"> 138 <widget class="QComboBox" name="c omboBox_2"/>138 <widget class="QComboBox" name="cbModel"/> 139 139 </item> 140 140 <item row="1" column="2"> 141 <widget class="QComboBox" name="comboBox_3"> 142 <item> 143 <property name="text"> 144 <string>Hard Sphere Structure</string> 145 </property> 146 </item> 141 <widget class="QComboBox" name="cbStructureFactor"> 147 142 <item> 148 143 <property name="text"> … … 174 169 <layout class="QGridLayout" name="gridLayout_16"> 175 170 <item row="0" column="0"> 176 <widget class="QCheckBox" name="ch eckBox_3">171 <widget class="QCheckBox" name="chkPolydispersity"> 177 172 <property name="enabled"> 178 173 <bool>true</bool> … … 187 182 </item> 188 183 <item row="1" column="0"> 189 <widget class="QCheckBox" name="ch eckBox_4">184 <widget class="QCheckBox" name="chkSmearing"> 190 185 <property name="enabled"> 191 186 <bool>true</bool> … … 211 206 <layout class="QGridLayout" name="gridLayout_8"> 212 207 <item row="0" column="0"> 213 <widget class="QLabel" name="l abel_16">208 <widget class="QLabel" name="lblMinRange"> 214 209 <property name="text"> 215 210 <string>Min range</string> … … 218 213 </item> 219 214 <item row="0" column="1"> 220 <widget class="QLabel" name="l abel_20">215 <widget class="QLabel" name="lblMinRangeDef"> 221 216 <property name="text"> 222 217 <string>0.005</string> … … 225 220 </item> 226 221 <item row="0" column="2"> 227 <widget class="QLabel" name="l abel_17">222 <widget class="QLabel" name="lblMinRangeUnit"> 228 223 <property name="text"> 229 224 <string><html><head/><body><p>Ã … … 233 228 </item> 234 229 <item row="1" column="0"> 235 <widget class="QLabel" name="l abel_18">230 <widget class="QLabel" name="lblMaxRange"> 236 231 <property name="text"> 237 232 <string>Max range</string> … … 240 235 </item> 241 236 <item row="1" column="1"> 242 <widget class="QLabel" name="l abel_21">237 <widget class="QLabel" name="lblMaxRangeDef"> 243 238 <property name="text"> 244 239 <string>0.1</string> … … 247 242 </item> 248 243 <item row="1" column="2"> 249 <widget class="QLabel" name="l abel_19">244 <widget class="QLabel" name="lblMaxRangeUnit"> 250 245 <property name="text"> 251 246 <string><html><head/><body><p>Ã … … 281 276 <layout class="QHBoxLayout" name="horizontalLayout_2"> 282 277 <item> 283 <widget class="QLabel" name="l abel_23">278 <widget class="QLabel" name="lblChi2"> 284 279 <property name="text"> 285 280 <string><html><head/><body><p><span style=" font-weight:600;">Ï</span><span style=" font-weight:600; vertical-align:super;">2</span></p></body></html></string> … … 288 283 </item> 289 284 <item> 290 <widget class="QLabel" name="l abel_24">285 <widget class="QLabel" name="lblChi2Value"> 291 286 <property name="text"> 292 287 <string><html><head/><body><p><span style=" font-weight:600;">0.01625</span></p></body></html></string>
Note: See TracChangeset
for help on using the changeset viewer.