Changeset 488c49d in sasview for src/sas/qtgui/DataExplorer.py
- Timestamp:
- Jun 8, 2016 7:56:28 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:
- 5032ea68
- Parents:
- f721030
- git-author:
- Piotr Rozyczko <piotr.rozyczko@…> (06/08/16 07:53:59)
- git-committer:
- Piotr Rozyczko <piotr.rozyczko@…> (06/08/16 07:56:28)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/DataExplorer.py
rf721030 r488c49d 15 15 16 16 # UI 17 #from UI.DataExplorerUI import DataExplorerUI18 17 from UI.TabbedFileLoadUI import DataLoadWidget 19 18 … … 39 38 self.cmdDelete.clicked.connect(self.deleteFile) 40 39 self.cmdSendTo.clicked.connect(self.sendData) 40 41 # Connect the comboboxes 42 self.cbSelect.currentIndexChanged.connect(self.selectData) 41 43 42 44 # Communicator for signal definitions … … 222 224 223 225 return wlist 224 226 227 def selectData(self, index): 228 """ 229 Callback method for modifying the TreeView on Selection Options change 230 """ 231 if not isinstance(index, int): 232 msg = "Incorrect type passed to DataExplorer.selectData()" 233 raise AttributeError, msg 234 235 # Respond appropriately 236 if index == 0: 237 # Select All 238 for index in range(self.model.rowCount()): 239 item = self.model.item(index) 240 if item.isCheckable() and item.checkState() == QtCore.Qt.Unchecked: 241 item.setCheckState(QtCore.Qt.Checked) 242 elif index == 1: 243 # De-select All 244 for index in range(self.model.rowCount()): 245 item = self.model.item(index) 246 if item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 247 item.setCheckState(QtCore.Qt.Unchecked) 248 249 elif index == 2: 250 # Select All 1-D 251 for index in range(self.model.rowCount()): 252 item = self.model.item(index) 253 item.setCheckState(QtCore.Qt.Unchecked) 254 255 try: 256 is1D = item.child(0).data().toPyObject().__class__.__name__ == 'Data1D' 257 except AttributeError: 258 msg = "Bad structure of the data model." 259 raise RuntimeError, msg 260 261 if is1D: 262 item.setCheckState(QtCore.Qt.Checked) 263 264 elif index == 3: 265 # Unselect All 1-D 266 for index in range(self.model.rowCount()): 267 item = self.model.item(index) 268 269 try: 270 is1D = item.child(0).data().toPyObject().__class__.__name__ == 'Data1D' 271 except AttributeError: 272 msg = "Bad structure of the data model." 273 raise RuntimeError, msg 274 275 if item.isCheckable() and item.checkState() == QtCore.Qt.Checked and is1D: 276 item.setCheckState(QtCore.Qt.Unchecked) 277 278 elif index == 4: 279 # Select All 2-D 280 for index in range(self.model.rowCount()): 281 item = self.model.item(index) 282 item.setCheckState(QtCore.Qt.Unchecked) 283 try: 284 is2D = item.child(0).data().toPyObject().__class__.__name__ == 'Data2D' 285 except AttributeError: 286 msg = "Bad structure of the data model." 287 raise RuntimeError, msg 288 289 if is2D: 290 item.setCheckState(QtCore.Qt.Checked) 291 292 elif index == 5: 293 # Unselect All 2-D 294 for index in range(self.model.rowCount()): 295 item = self.model.item(index) 296 297 try: 298 is2D = item.child(0).data().toPyObject().__class__.__name__ == 'Data2D' 299 except AttributeError: 300 msg = "Bad structure of the data model." 301 raise RuntimeError, msg 302 303 if item.isCheckable() and item.checkState() == QtCore.Qt.Checked and is2D: 304 item.setCheckState(QtCore.Qt.Unchecked) 305 306 else: 307 msg = "Incorrect value in the Selection Option" 308 # Change this to a proper logging action 309 raise Exception, msg 310 225 311 226 312 def loadComplete(self, output, message=""): … … 262 348 object_item.setData(QtCore.QVariant(data)) 263 349 350 checkbox_item.setChild(0, object_item) 351 264 352 # Add rows for display in the view 265 353 self.addExtraRows(info_item, data) 266 354 267 355 # Set info_item as the only child 268 checkbox_item.setChild( 0, info_item)356 checkbox_item.setChild(1, info_item) 269 357 270 358 # New row in the model
Note: See TracChangeset
for help on using the changeset viewer.