- Timestamp:
- Oct 27, 2017 8:49:35 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:
- 0849aec
- Parents:
- 895e7359
- Location:
- src/sas/qtgui
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/DataOperationUtilityPanel.py
r895e7359 r99ea1b0 273 273 msg = 'DataOperation: Number requires a float number' 274 274 logging.warning(msg) 275 self.txtNumber.setStyleSheet( QtCore.QString(BG_RED))275 self.txtNumber.setStyleSheet(BG_RED) 276 276 277 277 elif float(self.txtNumber.text()) == 0.: … … 279 279 msg = 'DataOperation: Number requires a non zero number' 280 280 logging.warning(msg) 281 self.txtNumber.setStyleSheet( QtCore.QString(BG_RED))281 self.txtNumber.setStyleSheet(BG_RED) 282 282 283 283 else: 284 self.txtNumber.setStyleSheet( QtCore.QString(BG_WHITE))284 self.txtNumber.setStyleSheet(BG_WHITE) 285 285 self.data2 = float(self.txtNumber.text()) 286 286 self.updatePlot(self.graphData2, self.layoutData2, self.data2) … … 293 293 else: 294 294 if self.cbData2.currentText() == 'Number': 295 self.cbData1.setStyleSheet( QtCore.QString(BG_WHITE))296 self.cbData2.setStyleSheet( QtCore.QString(BG_WHITE))295 self.cbData1.setStyleSheet(BG_WHITE) 296 self.cbData2.setStyleSheet(BG_WHITE) 297 297 return True 298 298 299 299 elif self.data1.__class__.__name__ != self.data2.__class__.__name__: 300 self.cbData1.setStyleSheet( QtCore.QString(BG_RED))301 self.cbData2.setStyleSheet( QtCore.QString(BG_RED))300 self.cbData1.setStyleSheet(BG_RED) 301 self.cbData2.setStyleSheet(BG_RED) 302 302 print(self.data1.__class__.__name__ != self.data2.__class__.__name__) 303 303 logging.warning('Cannot compute data of different dimensions') … … 308 308 not all(i == j for i, j in zip(self.data1.x, self.data2.x))): 309 309 logging.warning('Cannot compute 1D data of different lengths') 310 self.cbData1.setStyleSheet( QtCore.QString(BG_RED))311 self.cbData2.setStyleSheet( QtCore.QString(BG_RED))310 self.cbData1.setStyleSheet(BG_RED) 311 self.cbData2.setStyleSheet(BG_RED) 312 312 return False 313 313 … … 320 320 zip(self.data1.qy_data, self.data2.qy_data)) 321 321 ): 322 self.cbData1.setStyleSheet( QtCore.QString(BG_RED))323 self.cbData2.setStyleSheet( QtCore.QString(BG_RED))322 self.cbData1.setStyleSheet(BG_RED) 323 self.cbData2.setStyleSheet(BG_RED) 324 324 logging.warning('Cannot compute 2D data of different lengths') 325 325 return False 326 326 327 327 else: 328 self.cbData1.setStyleSheet( QtCore.QString(BG_WHITE))329 self.cbData2.setStyleSheet( QtCore.QString(BG_WHITE))328 self.cbData1.setStyleSheet(BG_WHITE) 329 self.cbData2.setStyleSheet(BG_WHITE) 330 330 return True 331 331 … … 333 333 """ Check that name of output does not already exist """ 334 334 name_to_check = str(self.txtOutputData.text()) 335 self.txtOutputData.setStyleSheet( QtCore.QString(BG_WHITE))335 self.txtOutputData.setStyleSheet(BG_WHITE) 336 336 337 337 if name_to_check is None or name_to_check == '': 338 self.txtOutputData.setStyleSheet( QtCore.QString(BG_RED))338 self.txtOutputData.setStyleSheet(BG_RED) 339 339 logging.warning('No output name') 340 340 return False 341 341 342 342 elif name_to_check in self.list_data_items: 343 self.txtOutputData.setStyleSheet( QtCore.QString(BG_RED))343 self.txtOutputData.setStyleSheet(BG_RED) 344 344 logging.warning('The Output data name already exists') 345 345 return False 346 346 347 347 else: 348 self.txtOutputData.setStyleSheet( QtCore.QString(BG_WHITE))348 self.txtOutputData.setStyleSheet(BG_WHITE) 349 349 return True 350 350 -
src/sas/qtgui/Calculators/GenericScatteringCalculator.py
- Property mode changed from 100755 to 100644
rb0b09b9 r99ea1b0 235 235 """Check range of text edits for QMax and Number of Qbins """ 236 236 text_edit = self.sender() 237 text_edit.setStyleSheet( 238 QtCore.QString.fromUtf8('background-color: rgb(255, 255, 255);')) 237 text_edit.setStyleSheet('background-color: rgb(255, 255, 255);') 239 238 if text_edit.text(): 240 239 value = float(str(text_edit.text())) 241 240 if text_edit == self.txtQxMax: 242 241 if value <= 0 or value > 1000: 243 text_edit.setStyleSheet(QtCore.QString.fromUtf8( 244 'background-color: rgb(255, 182, 193);')) 242 text_edit.setStyleSheet('background-color: rgb(255, 182, 193);') 245 243 else: 246 text_edit.setStyleSheet(QtCore.QString.fromUtf8( 247 'background-color: rgb(255, 255, 255);')) 244 text_edit.setStyleSheet('background-color: rgb(255, 255, 255);') 248 245 elif text_edit == self.txtNoQBins: 249 246 if value < 2 or value > 1000: 250 self.txtNoQBins.setStyleSheet(QtCore.QString.fromUtf8( 251 'background-color: rgb(255, 182, 193);')) 247 self.txtNoQBins.setStyleSheet('background-color: rgb(255, 182, 193);') 252 248 else: 253 self.txtNoQBins.setStyleSheet(QtCore.QString.fromUtf8( 254 'background-color: rgb(255, 255, 255);')) 249 self.txtNoQBins.setStyleSheet('background-color: rgb(255, 255, 255);') 255 250 256 251 def update_gui(self): … … 555 550 # Add deferred callback for call return 556 551 d.addCallback(self.plot_1_2d) 552 d.addErrback(self.calculateFailed) 557 553 except: 558 554 log_msg = "{}. stop".format(sys.exc_info()[1]) … … 564 560 Copied from previous version 565 561 """ 562 pass 563 564 def calculateFailed(self, reason): 565 """ 566 """ 567 print("Calculate Failed with:\n", reason) 566 568 pass 567 569 -
src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py
- Property mode changed from 100755 to 100644
rb0b09b9 r99ea1b0 111 111 # call compute to calculate with default values 112 112 self.createTemplate2DPlot() 113 self.onCompute()113 #self.onCompute() 114 114 115 115 # ################################# … … 123 123 text_edit = self.txtWavelength # self.sender() 124 124 if text_edit.isModified(): 125 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))125 text_edit.setStyleSheet(BG_WHITE) 126 126 input_string = str(text_edit.text()) 127 127 if self.cbWaveColor.currentText() != 'TOF': 128 128 input_wavelength = re.match('\d+\.?\d*', input_string) 129 129 if input_wavelength is None: 130 text_edit.setStyleSheet( QtCore.QString(BG_RED))130 text_edit.setStyleSheet(BG_RED) 131 131 self.cmdCompute.setEnabled(False) 132 132 logging.info('Wavelength has to be a number.') 133 133 else: 134 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))134 text_edit.setStyleSheet(BG_WHITE) 135 135 self.cmdCompute.setEnabled(True) 136 136 else: … … 139 139 140 140 if interval_wavelength is None: 141 text_edit.setStyleSheet( QtCore.QString(BG_RED))141 text_edit.setStyleSheet(BG_RED) 142 142 self.cmdCompute.setEnabled(False) 143 143 logging.info("Wavelength's input has to be an interval: " … … 149 149 150 150 if float(wavelength_min) >= float(wavelength_max): 151 text_edit.setStyleSheet( QtCore.QString(BG_RED))151 text_edit.setStyleSheet(BG_RED) 152 152 self.cmdCompute.setEnabled(False) 153 153 logging.info("Wavelength: min must be smaller than max.") 154 154 155 155 else: 156 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))156 text_edit.setStyleSheet(BG_WHITE) 157 157 self.cmdCompute.setEnabled(True) 158 158 … … 163 163 164 164 if text_edit.isModified(): 165 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))165 text_edit.setStyleSheet(BG_WHITE) 166 166 if self.cbWaveColor.currentText() != 'TOF': 167 167 pattern = '^\d+\.?\d*(|;\s*\d+)$' … … 170 170 171 171 if wavelength_spread_input is None: 172 text_edit.setStyleSheet( QtCore.QString(BG_RED))172 text_edit.setStyleSheet(BG_RED) 173 173 self.cmdCompute.setEnabled(False) 174 174 logging.info('Wavelength spread has to be specified: ' … … 178 178 split_input = wavelength_spread_input.group().split(';') 179 179 self.num_wave = split_input[1] if len(split_input) > 1 else 10 180 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))180 text_edit.setStyleSheet(BG_WHITE) 181 181 self.cmdCompute.setEnabled(True) 182 182 else: … … 186 186 187 187 if wavelength_spread_input is None: 188 text_edit.setStyleSheet( QtCore.QString(BG_RED))188 text_edit.setStyleSheet(BG_RED) 189 189 self.cmdCompute.setEnabled(False) 190 190 logging.info("Wavelength spread has to be specified: " … … 197 197 self.num_wave = split_input[1] if len( 198 198 split_input) > 1 else 10 199 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))199 text_edit.setStyleSheet(BG_WHITE) 200 200 self.cmdCompute.setEnabled(True) 201 201 … … 205 205 206 206 if text_edit.isModified(): 207 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))207 text_edit.setStyleSheet(BG_WHITE) 208 208 pattern = '^\d+\.?\d*,\s*\d+\.?\d*$' 209 209 input_string = str(text_edit.text()) … … 211 211 212 212 if pixels_input is None: 213 text_edit.setStyleSheet( QtCore.QString(BG_RED))213 text_edit.setStyleSheet(BG_RED) 214 214 self.cmdCompute.setEnabled(False) 215 215 logging.info('The input for the detector should contain 2 ' … … 217 217 218 218 else: 219 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))219 text_edit.setStyleSheet(BG_WHITE) 220 220 self.cmdCompute.setEnabled(True) 221 221 … … 229 229 q_input = re.match(pattern, input_string) 230 230 if q_input is None: 231 text_edit.setStyleSheet( QtCore.QString(BG_RED))231 text_edit.setStyleSheet(BG_RED) 232 232 self.cmdCompute.setEnabled(False) 233 233 logging.info('Qx and Qy should contain one or more comma-separated numbers.') 234 234 else: 235 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))235 text_edit.setStyleSheet(BG_WHITE) 236 236 self.cmdCompute.setEnabled(True) 237 237 qx = str(self.txtQx.text()).split(',') … … 247 247 248 248 elif len(qx) != len(qy): 249 text_edit.setStyleSheet( QtCore.QString(BG_RED))249 text_edit.setStyleSheet(BG_RED) 250 250 self.cmdCompute.setEnabled(False) 251 251 logging.info( … … 253 253 254 254 else: 255 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))255 text_edit.setStyleSheet(BG_WHITE) 256 256 self.cmdCompute.setEnabled(True) 257 257 … … 261 261 262 262 if text_edit.isModified(): 263 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))263 text_edit.setStyleSheet(BG_WHITE) 264 264 input_string = str(text_edit.text()) 265 265 pattern = '^\d+\.?\d*(|,\s*\d+)$' … … 267 267 268 268 if aperture_input is None: 269 text_edit.setStyleSheet( QtCore.QString(BG_RED))269 text_edit.setStyleSheet(BG_RED) 270 270 self.cmdCompute.setEnabled(False) 271 271 logging.info('A circular aperture is defined by a single ' … … 274 274 275 275 else: 276 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))276 text_edit.setStyleSheet(BG_WHITE) 277 277 self.cmdCompute.setEnabled(True) 278 278 … … 524 524 525 525 cal_res.addCallback(self.complete) 526 cal_res.addErrback(self.calculateFailed) 526 527 527 528 # logging.info("Computation is in progress...") … … 531 532 raise 532 533 534 def calculateFailed(self, reason): 535 print("calculateFailed Failed with:\n", reason) 536 pass 537 533 538 def complete(self, image): 534 539 """ … … 562 567 : return: image (numpy array) 563 568 """ 569 # This fails in py3 with 570 # [Failure instance: Traceback: <class 'TypeError'>: 'map' object is not subscriptable 571 # INVESTIGATE 564 572 image = map(func, qx, qy, 565 573 qx_min, qx_max, -
src/sas/qtgui/Calculators/SldPanel.py
- Property mode changed from 100755 to 100644
-
src/sas/qtgui/Calculators/SlitSizeCalculator.py
- Property mode changed from 100755 to 100644
rb0b09b9 r99ea1b0 82 82 return 83 83 84 if isinstance(path, QtCore.QString):85 path = str(path)86 87 84 return path 88 85 -
src/sas/qtgui/Calculators/UnitTesting/DataOperationUtilityTest.py
r0c468bf r99ea1b0 8 8 from PyQt4.QtTest import QTest 9 9 from PyQt4.QtCore import Qt 10 from mock import MagicMock11 from mock import patch10 from unittest.mock import MagicMock 11 from unittest.mock import patch 12 12 13 13 from twisted.internet import threads -
src/sas/qtgui/Calculators/UnitTesting/DensityCalculatorTest.py
r464cd07 r99ea1b0 6 6 from PyQt4.QtTest import QTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 ####### TEMP -
src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculatorTest.py
rf4a1433 r99ea1b0 7 7 8 8 from PyQt4.QtCore import Qt 9 from mock import MagicMock10 from mock import patch9 from unittest.mock import MagicMock 10 from unittest.mock import patch 11 11 12 12 # set up import paths -
src/sas/qtgui/Calculators/UnitTesting/ResolutionCalculatorPanelTest.py
r170e95d r99ea1b0 8 8 from PyQt4.QtTest import QTest 9 9 from PyQt4.QtCore import Qt 10 from mock import MagicMock 11 from mock import patch 10 from unittest.mock import MagicMock 12 11 13 12 from twisted.internet import threads -
src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py
rf4a1433 r99ea1b0 6 6 from PyQt4.QtTest import QTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 ####### TEMP -
src/sas/qtgui/Calculators/UnitTesting/SlitSizeCalculatorTest.py
- Property mode changed from 100755 to 100644
rb0b09b9 r99ea1b0 4 4 from PyQt4.QtTest import QTest 5 5 from PyQt4.QtCore import Qt 6 from mock import MagicMock6 from unittest.mock import MagicMock 7 7 8 8 # set up import paths -
src/sas/qtgui/MainWindow/DataExplorer.py
- Property mode changed from 100755 to 100644
rb0b09b9 r99ea1b0 175 175 load_thread = threads.deferToThread(self.readData, url) 176 176 load_thread.addCallback(self.loadComplete) 177 load_thread.addErrback(self.loadFailed) 177 178 178 179 def loadFile(self, event=None): … … 221 222 load_thread = threads.deferToThread(self.readProject, filename) 222 223 load_thread.addCallback(self.readProjectComplete) 224 load_thread.addErrback(self.readProjectFailed) 225 226 def readProjectFailed(self, reason): 227 """ 228 """ 229 print("readProjectFailed FAILED: ", reason) 230 pass 223 231 224 232 def readProject(self, filename): … … 614 622 return 615 623 616 #if isinstance(paths, QtCore.QStringList):617 # paths = [str(f) for f in paths]618 619 624 if not isinstance(paths, list): 620 625 paths = [paths] … … 992 997 self.manager.add_data(data_list=output_data) 993 998 999 def loadErrback(self, reason): 1000 print("File Load Failed with:\n", reason) 1001 pass 1002 994 1003 def updateModel(self, data, p_file): 995 1004 """ -
src/sas/qtgui/MainWindow/UnitTesting/AboutBoxTest.py
r464cd07 r99ea1b0 6 6 from PyQt4.QtTest import QTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 # set up import paths -
src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py
- Property mode changed from 100644 to 100755
r88e1f57 r99ea1b0 5 5 from PyQt4.QtTest import QTest 6 6 from PyQt4.QtCore import * 7 from mock import MagicMock8 from mock import patch7 from unittest.mock import MagicMock 8 from unittest.mock import patch 9 9 from mpl_toolkits.mplot3d import Axes3D 10 10 … … 157 157 158 158 expected_list = [0, 0, 33, 66, -1] 159 spied_list = [spy_progress_bar_update.called()[i]['args'][0] for i in xrange(5)]159 spied_list = [spy_progress_bar_update.called()[i]['args'][0] for i in range(5)] 160 160 self.assertEqual(expected_list, spied_list) 161 161 … … 173 173 filename = ["cyl_400_20.txt", "cyl_400_20.txt", "P123_D2O_10_percent.dat"] 174 174 self.form.readData(filename) 175 176 self.form.show()177 app.exec_()178 175 179 176 # Assure the model contains three items … … 329 326 self.form.cbSelect.setCurrentIndex(1) 330 327 328 self.form.show() 329 app.exec_() 330 331 331 # Test the current selection 332 332 item1D = self.form.model.item(0) … … 507 507 # We don't know the data ID, so need to iterate over dict 508 508 data_dict = spy_data_received.called()[0]['args'][0] 509 for data_key, data_value in data_dict.ite ritems():509 for data_key, data_value in data_dict.items(): 510 510 self.assertIsInstance(data_value, Data1D) 511 511 -
src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py
- Property mode changed from 100644 to 100755
r8222f171 r99ea1b0 9 9 from PyQt4.QtCore import * 10 10 from PyQt4.QtWebKit import * 11 from mock import MagicMock11 from unittest.mock import MagicMock 12 12 13 13 # set up import paths … … 74 74 # We are in the MainWindow scope, so simple 'print' will work 75 75 message = "from stdout" 76 print message76 print(message) 77 77 self.assertIn(message, self.manager.logDockWidget.widget().toPlainText()) 78 78 … … 162 162 """ 163 163 # 1. version = 0.0.0 164 version_info = { u'version' : u'0.0.0'}164 version_info = {'version' : '0.0.0'} 165 165 spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 166 166 … … 172 172 173 173 # 2. version < LocalConfig.__version__ 174 version_info = { u'version' : u'0.0.1'}174 version_info = {'version' : '0.0.1'} 175 175 spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 176 176 … … 182 182 183 183 # 3. version > LocalConfig.__version__ 184 version_info = { u'version' : u'999.0.0'}184 version_info = {'version' : '999.0.0'} 185 185 spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 186 186 webbrowser.open = MagicMock() -
src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py
r464cd07 r99ea1b0 5 5 from PyQt4 import QtTest 6 6 from PyQt4 import QtCore 7 from mock import MagicMock7 from unittest.mock import MagicMock 8 8 9 9 # set up import paths -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r895e7359 r99ea1b0 566 566 model_row = item.row() 567 567 name_index = self._poly_model.index(model_row, 0) 568 parameter_name = str(name_index.data() .toString()).lower() # "distribution of sld" etc.568 parameter_name = str(name_index.data()).lower() # "distribution of sld" etc. 569 569 if "distribution of" in parameter_name: 570 570 # just the last word -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingLogicTest.py
r464cd07 r99ea1b0 3 3 4 4 import numpy 5 from mock import MagicMock5 from unittest.mock import MagicMock 6 6 7 7 # set up import paths -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingOptionsTest.py
r464cd07 r99ea1b0 6 6 from PyQt4 import QtWebKit 7 7 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 # set up import paths -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingPerspectiveTest.py
r464cd07 r99ea1b0 6 6 from PyQt4 import QtTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 # set up import paths -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
- Property mode changed from 100644 to 100755
rc7358b2 r99ea1b0 6 6 from PyQt4 import QtTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 from twisted.internet import threads 10 10 … … 60 60 61 61 #Test loading from json categories 62 category_list = fittingWindow.master_category_dict.keys()62 category_list = list(fittingWindow.master_category_dict.keys()) 63 63 64 64 for category in category_list: … … 93 93 fittingWindow.SASModelToQModel("cylinder") 94 94 pd_index = fittingWindow.lstPoly.model().index(0,0) 95 self.assertEqual(str(pd_index.data() .toString()), "Distribution of radius")95 self.assertEqual(str(pd_index.data()), "Distribution of radius") 96 96 pd_index = fittingWindow.lstPoly.model().index(1,0) 97 self.assertEqual(str(pd_index.data() .toString()), "Distribution of length")97 self.assertEqual(str(pd_index.data()), "Distribution of length") 98 98 99 99 # test the delegate a bit 100 100 delegate = fittingWindow.lstPoly.itemDelegate() 101 101 self.assertEqual(len(delegate.POLYDISPERSE_FUNCTIONS), 5) 102 self.assertEqual(delegate.editableParameters(), [ 2, 3, 4, 5])102 self.assertEqual(delegate.editableParameters(), [1, 2, 3, 4, 5]) 103 103 self.assertEqual(delegate.poly_function, 6) 104 104 self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal) … … 361 361 362 362 # Test presence of comboboxes in last column 363 for row in xrange(self.widget._poly_model.rowCount()):363 for row in range(self.widget._poly_model.rowCount()): 364 364 func_index = self.widget._poly_model.index(row, 6) 365 365 self.assertTrue(isinstance(self.widget.lstPoly.indexWidget(func_index), QtGui.QComboBox)) … … 509 509 510 510 # Test rows 511 for row in xrange(self.widget._magnet_model.rowCount()):511 for row in range(self.widget._magnet_model.rowCount()): 512 512 func_index = self.widget._magnet_model.index(row, 0) 513 513 self.assertIn(':', self.widget._magnet_model.item(row, 0).text()) … … 889 889 890 890 # check that range of variation for this parameter has NOT been changed 891 print self.widget.kernel_module.details[name_modified_param]891 print(self.widget.kernel_module.details[name_modified_param]) 892 892 self.assertNotIn(new_value, self.widget.kernel_module.details[name_modified_param] ) 893 893 -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
r895e7359 r99ea1b0 180 180 # Add deferred callback for call return 181 181 d.addCallback(self.plotResult) 182 d.addErrback(self.plotFailed) 182 183 except Exception as ex: 183 184 # Set the button back to available … … 186 187 self.pushButton.setStyleSheet(self.style) 187 188 189 def plotFailed(self, reason): 190 """ 191 """ 192 print("plotFailed FAILED: ", reason) 193 pass 188 194 189 195 def plotResult(self, model): -
src/sas/qtgui/Plotting/UnitTesting/AddTextTest.py
r464cd07 r99ea1b0 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/BoxSumTest.py
r895e7359 r99ea1b0 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/ColorMapTest.py
r464cd07 r99ea1b0 4 4 5 5 from PyQt4 import QtGui 6 from mock import MagicMock6 from unittest.mock import MagicMock 7 7 import matplotlib as mpl 8 8 -
src/sas/qtgui/Plotting/UnitTesting/LinearFitTest.py
r464cd07 r99ea1b0 4 4 5 5 from PyQt4 import QtGui 6 from mock import MagicMock6 from unittest.mock import MagicMock 7 7 8 8 # set up import paths … … 59 59 return_values = self.widget.parent.emit.call_args[0][1] 60 60 # Compare 61 self.assert ItemsEqual(return_values[0], [1.0, 3.0])61 self.assertCountEqual(return_values[0], [1.0, 3.0]) 62 62 self.assertAlmostEqual(return_values[1][0], 10.004054329, 6) 63 63 self.assertAlmostEqual(return_values[1][1], 12.030439848, 6) … … 68 68 return_values = self.widget.parent.emit.call_args[0][1] 69 69 # Compare 70 self.assert ItemsEqual(return_values[0], [1.0, 3.0])70 self.assertCountEqual(return_values[0], [1.0, 3.0]) 71 71 self.assertAlmostEqual(return_values[1][0], 9.987732937, 6) 72 72 self.assertAlmostEqual(return_values[1][1], 11.84365082, 6) … … 81 81 x, y, dy = self.widget.origData() 82 82 83 self.assert ItemsEqual(x, orig_x)83 self.assertCountEqual(x, orig_x) 84 84 self.assertEqual(y[0], orig_y[0]) 85 85 self.assertAlmostEqual(y[1], orig_y[1], 8) … … 98 98 x, y, dy = self.widget.origData() 99 99 100 self.assert ItemsEqual(x, orig_x)101 self.assert ItemsEqual(y, orig_y)102 self.assert ItemsEqual(dy, orig_dy)100 self.assertCountEqual(x, orig_x) 101 self.assertCountEqual(y, orig_y) 102 self.assertCountEqual(dy, orig_dy) 103 103 104 104 # x, log(y) … … 111 111 x, y, dy = self.widget.origData() 112 112 113 self.assert ItemsEqual(x, orig_x)113 self.assertCountEqual(x, orig_x) 114 114 self.assertEqual(y[0], orig_y[0]) 115 115 self.assertAlmostEqual(y[1], orig_y[1], 8) -
src/sas/qtgui/Plotting/UnitTesting/PlotPropertiesTest.py
r464cd07 r99ea1b0 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/Plotter2DTest.py
rb2a5042 r99ea1b0 7 7 from PyQt4 import QtCore 8 8 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 9 from mock import MagicMock9 from unittest.mock import MagicMock 10 10 from mpl_toolkits.mplot3d import Axes3D 11 11 -
src/sas/qtgui/Plotting/UnitTesting/PlotterBaseTest.py
rb2a5042 r99ea1b0 2 2 import unittest 3 3 import platform 4 from mock import patch,MagicMock4 from unittest.mock import MagicMock 5 5 6 6 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/PlotterTest.py
- Property mode changed from 100644 to 100755
rb2a5042 r99ea1b0 6 6 from PyQt4 import QtCore 7 7 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 8 from mock import MagicMock9 from mock import patch8 from unittest.mock import MagicMock 9 from unittest.mock import patch 10 10 11 11 ####### TEMP … … 236 236 237 237 # Just this one plot 238 self.assertEqual(len( self.plotter.plot_dict.keys()), 1)238 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 1) 239 239 self.plotter.onLinearFit(1) 240 240 … … 260 260 261 261 # Assure we have two sets 262 self.assertEqual(len( self.plotter.plot_dict.keys()), 2)262 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 2) 263 263 264 264 # Delete one set 265 265 self.plotter.onRemovePlot(2) 266 266 # Assure we have two sets 267 self.assertEqual(len( self.plotter.plot_dict.keys()), 1)267 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 1) 268 268 269 269 self.plotter.manager = MagicMock() … … 272 272 self.plotter.onRemovePlot(1) 273 273 # Assure we have no plots 274 self.assertEqual(len( self.plotter.plot_dict.keys()), 0)274 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 0) 275 275 # Assure the plotter window is closed 276 276 self.assertFalse(self.plotter.isVisible()) -
src/sas/qtgui/Plotting/UnitTesting/SlicerModelTest.py
r464cd07 r99ea1b0 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/SlicerParametersTest.py
r464cd07 r99ea1b0 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui … … 7 7 from PyQt4 import QtTest 8 8 from PyQt4 import QtWebKit 9 10 from mock import MagicMock11 9 12 10 # set up import paths -
src/sas/qtgui/UnitTesting/TestUtils.py
- Property mode changed from 100644 to 100755
r895e7359 r99ea1b0 10 10 """ 11 11 if method_name is not None: 12 print( "\nWARNING: %s needs implementing!"%method_name)12 print(("\nWARNING: %s needs implementing!"%method_name)) 13 13 else: 14 14 (frame, filename, line_number, 15 15 function_name, lines, index) = inspect.getouterframes(inspect.currentframe())[1] 16 print( "\nWARNING: %s needs implementing!"%function_name)16 print(("\nWARNING: %s needs implementing!"%function_name)) 17 17 18 18 class QtSignalSpy(QObject): … … 39 39 except AttributeError: 40 40 msg = "Wrong construction of QtSignalSpy instance" 41 raise RuntimeError , msg41 raise RuntimeError(msg) 42 42 43 43 def slot(self, *args, **kwargs): -
src/sas/qtgui/UnitTesting/TestUtilsTest.py
r464cd07 r99ea1b0 5 5 from PyQt4.QtTest import QTest 6 6 from PyQt4.QtCore import * 7 from mock import MagicMock7 from unittest.mock import MagicMock 8 8 9 9 # Local -
src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
r895e7359 r99ea1b0 5 5 from PyQt4 import QtCore 6 6 from PyQt4 import QtGui 7 from mock import MagicMock7 from unittest.mock import MagicMock 8 8 9 9 # set up import paths
Note: See TracChangeset
for help on using the changeset viewer.