Changeset 200bd7e in sasview for src/sas/qtgui
- Timestamp:
- Dec 1, 2017 2:51:32 AM (7 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:
- 50bfab0
- Parents:
- 19fce84 (diff), 6cb305a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/qtgui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
rd1955d67 r6cb305a 63 63 self._model_item = QtGui.QStandardItem() 64 64 65 #self._helpView = QtWebKit.QWebView()65 self._helpView = QtWebKit.QWebView() 66 66 self.detailsDialog = DetailsDialog(self) 67 67 self.detailsDialog.cmdOK.clicked.connect(self.enabling) … … 82 82 # no reason to have this widget resizable 83 83 self.resize(self.minimumSizeHint()) 84 #self.setFixedSize(self.sizeHint())85 84 86 85 self.communicate = self._manager.communicator() … … 232 231 # Send the modified model item to DE for keeping in the model 233 232 # Currently -unused 234 # self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item)233 # self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item) 235 234 236 235 plot_data = GuiUtils.plotsFromCheckedItems(self._manager.filesWidget.model) … … 365 364 if self._high_extrapolate: 366 365 # for presentation in InvariantDetails 367 qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) # self._data.x)366 qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) 368 367 369 368 if qmax_plot > Q_MAXIMUM: -
src/sas/qtgui/Utilities/GuiUtils.py
rcb4d219 r6cb305a 58 58 # clean all these module variables and put them into a config class 59 59 # that can be passed by sasview.py. 60 # logging.info(sys.executable)61 # logging.info(str(sys.argv))60 # logging.info(sys.executable) 61 # logging.info(str(sys.argv)) 62 62 from sas import sasview as sasview 63 63 app_path = os.path.dirname(sasview.__file__) 64 # logging.info("Using application path: %s", app_path)64 # logging.info("Using application path: %s", app_path) 65 65 return app_path 66 66 … … 249 249 if plot_item.isCheckable(): 250 250 plot_data = plot_item.child(0).data() 251 if plot_data.id is not None and plot_data.id == update_data.id: 251 if plot_data.id is not None and \ 252 (plot_data.name == update_data.name or plot_data.id == update_data.id): 253 # if plot_data.id is not None and plot_data.id == update_data.id: 252 254 # replace data section in item 253 255 plot_item.child(0).setData(update_data) … … 343 345 for index in range(model_item.rowCount()): 344 346 item = model_item.item(index) 345 if item.text() == filename and item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 347 if item.text() == filename and item.isCheckable() \ 348 and item.checkState() == QtCore.Qt.Checked: 346 349 # Going 1 level deeper only 347 350 for index_2 in range(item.rowCount()): … … 360 363 361 364 # Iterate over model looking for named items 362 item = list([i for i in [model_item.item(index) for index in range(model_item.rowCount())] if str(i.text()) == filename]) 365 item = list([i for i in [model_item.item(index) 366 for index in range(model_item.rowCount())] 367 if str(i.text()) == filename]) 363 368 return item[0] if len(item)>0 else None 364 369 … … 396 401 for index in range(model_item.rowCount()): 397 402 item = model_item.item(index) 398 if item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 399 # TODO: assure item type is correct (either data1/2D or Plotter) 400 plot_data.append((item, item.child(0).data())) 403 401 404 # Going 1 level deeper only 402 405 for index_2 in range(item.rowCount()): … … 405 408 # TODO: assure item type is correct (either data1/2D or Plotter) 406 409 plot_data.append((item_2, item_2.child(0).data())) 410 411 if item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 412 # TODO: assure item type is correct (either data1/2D or Plotter) 413 plot_data.append((item, item.child(0).data())) 407 414 408 415 return plot_data -
src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
r0261bc1 r6cb305a 100 100 Test the QModelItem checkbox update method 101 101 """ 102 # test_item = QtGui.QStandardItem() 103 # test_list = ['aa','11'] 104 # update_data = test_list 105 # name = "Black Sabbath" 106 107 # # update the item 108 # updateModelItemWithPlot(test_item, update_data, name) 109 102 110 test_item = QtGui.QStandardItem() 103 test_list = ['aa','11'] 104 update_data = test_list 111 update_data = Data1D(x=[1.0, 2.0, 3.0], y=[10.0, 11.0, 12.0]) 105 112 name = "Black Sabbath" 106 113 update_data.id = '[0]data0' 114 update_data.name = 'data0' 107 115 # update the item 108 116 updateModelItemWithPlot(test_item, update_data, name) 109 117 110 118 # Make sure test_item got all data added 111 119 self.assertEqual(test_item.child(0).text(), name) 112 120 self.assertTrue(test_item.child(0).isCheckable()) 113 list_from_item = test_item.child(0).child(0).data() 114 self.assertIsInstance(list_from_item, list) 115 self.assertEqual(str(list_from_item[0]), test_list[0]) 116 self.assertEqual(str(list_from_item[1]), test_list[1]) 121 data_from_item = test_item.child(0).child(0).data() 122 self.assertIsInstance(data_from_item, Data1D) 123 self.assertSequenceEqual(list(data_from_item.x), [1.0, 2.0, 3.0]) 124 self.assertSequenceEqual(list(data_from_item.y), [10.0, 11.0, 12.0]) 125 self.assertEqual(test_item.rowCount(), 1) 126 127 # add another dataset (different from the first one) 128 update_data1 = Data1D(x=[1.1, 2.1, 3.1], y=[10.1, 11.1, 12.1]) 129 update_data1.id = '[0]data1' 130 update_data1.name = 'data1' 131 name1 = "Black Sabbath1" 132 # update the item and check number of rows 133 updateModelItemWithPlot(test_item, update_data1, name1) 134 135 self.assertEqual(test_item.rowCount(), 2) 136 137 # add another dataset (with the same name as the first one) 138 # check that number of rows was not changed but data have been updated 139 update_data2 = Data1D(x=[4.0, 5.0, 6.0], y=[13.0, 14.0, 15.0]) 140 update_data2.id = '[1]data0' 141 update_data2.name = 'data0' 142 name2 = "Black Sabbath2" 143 updateModelItemWithPlot(test_item, update_data2, name2) 144 self.assertEqual(test_item.rowCount(), 2) 145 146 data_from_item = test_item.child(0).child(0).data() 147 self.assertSequenceEqual(list(data_from_item.x), [4.0, 5.0, 6.0]) 148 self.assertSequenceEqual(list(data_from_item.y), [13.0, 14.0, 15.0]) 117 149 118 150 … … 162 194 # Make sure only the checked data is present 163 195 # FRIDAY IN 164 self.assertIn(test_list0, plot_list[ 0])196 self.assertIn(test_list0, plot_list[1]) 165 197 # SATURDAY IN 166 self.assertIn(test_list1, plot_list[ 1])198 self.assertIn(test_list1, plot_list[0]) 167 199 # MONDAY NOT IN 168 200 self.assertNotIn(test_list2, plot_list[0]) -
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
r8f83719f r19fce84 575 575 self.regConstantSuggestionButton.setText("{:.3g}".format(alpha)) 576 576 self.regConstantSuggestionButton.setEnabled(True) 577 self.model.setItem(WIDGETS.W_COMP_TIME, QtGui.QStandardItem( str(elapsed)))577 self.model.setItem(WIDGETS.W_COMP_TIME, QtGui.QStandardItem("{:.2g}".format(elapsed))) 578 578 if message: 579 579 logging.info(message)
Note: See TracChangeset
for help on using the changeset viewer.