Changeset fbfc488 in sasview for src/sas/qtgui/Calculators
- Timestamp:
- Nov 9, 2017 8:43:55 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:
- d6b8a1d
- Parents:
- 7969b9c
- git-author:
- Piotr Rozyczko <rozyczko@…> (11/03/17 10:58:39)
- git-committer:
- Piotr Rozyczko <rozyczko@…> (11/09/17 08:43:55)
- Location:
- src/sas/qtgui/Calculators
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/DataOperationUtilityPanel.py
r4992ff2 rfbfc488 140 140 data1 = self.data1 141 141 data2 = self.data2 142 exec("output = data1 %s data2" % operator) 143 except: 144 raise 142 output = eval("data1 %s data2" % operator) 143 except Exception as ex: 144 logging.error(ex) 145 return 145 146 146 147 self.output = output -
src/sas/qtgui/Calculators/DensityPanel.py
r4992ff2 rfbfc488 60 60 61 61 # set validators 62 self.ui.editMolecularFormula.setValidator(FormulaValidator(self.ui.editMolecularFormula))62 #self.ui.editMolecularFormula.setValidator(FormulaValidator(self.ui.editMolecularFormula)) 63 63 64 64 rx = QtCore.QRegExp("[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?") … … 94 94 self.mapper.addMapping(self.ui.editMassDensity , MODEL.MASS_DENSITY) 95 95 96 # FIXME DOESNT WORK WITH QT5 97 #self.mapper.toFirst() 96 self.mapper.toFirst() 98 97 99 98 def dataChanged(self, top, bottom): … … 140 139 141 140 def modelReset(self): 142 #self.model.beginResetModel()143 141 try: 144 142 self.setMode(None) … … 148 146 finally: 149 147 pass 150 #self.model.endResetModel()151 148 152 149 def displayHelp(self): -
src/sas/qtgui/Calculators/GenericScatteringCalculator.py
r4992ff2 rfbfc488 135 135 "SLD files (*.SLD *.sld);;PDB files (*.pdb *.PDB);; " 136 136 "OMF files (*.OMF *.omf);; " 137 "All files (*.*)") 137 "All files (*.*)")[0] 138 138 if self.datafile: 139 139 self.default_shape = str(self.cbShape.currentText()) -
src/sas/qtgui/Calculators/KiessigPanel.py
r4992ff2 rfbfc488 55 55 self.thickness.set_deltaq(dq=float(self.deltaq_in.text())) 56 56 kiessing_result = self.thickness.compute_thickness() 57 float_as_str = "{:.3f}".format(kiessing_result) 58 self.lengthscale_out.setText(float_as_str) 57 if kiessing_result: 58 float_as_str = "{:.3f}".format(kiessing_result) 59 self.lengthscale_out.setText(float_as_str) 60 else: 61 # error or division by zero 62 self.lengthscale_out.setText("") 63 59 64 except (ArithmeticError, ValueError): 60 65 self.lengthscale_out.setText("") -
src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py
r4992ff2 rfbfc488 317 317 if self.cbCustomSpectrum.currentText() == 'Add New': 318 318 datafile = QtWidgets.QFileDialog.getOpenFileName( 319 self, "Choose a spectral distribution file", 320 "All files (*.*)", 321 QtWidgets.QFileDialog.DontUseNativeDialog) 319 self, "Choose a spectral distribution file","", 320 "All files (*.*)", None, 321 QtWidgets.QFileDialog.DontUseNativeDialog)[0] 322 322 323 323 if datafile is None or str(datafile) == '': … … 568 568 : return: image (numpy array) 569 569 """ 570 # This fails in py3 with 571 # [Failure instance: Traceback: <class 'TypeError'>: 'map' object is not subscriptable 572 # INVESTIGATE 573 image = map(func, qx, qy, 570 image = list(map(func, qx, qy, 574 571 qx_min, qx_max, 575 qy_min, qy_max)[0] 572 qy_min, qy_max))[0] 573 576 574 return image 577 575 … … 751 749 self.plotter.plot() 752 750 self.plotter.show() 751 self.plotter.update() 753 752 754 753 def drawLines(self): -
src/sas/qtgui/Calculators/SldPanel.py
r4992ff2 rfbfc488 128 128 129 129 # set validators 130 self.ui.editMolecularFormula.setValidator(GuiUtils.FormulaValidator(self.ui.editMolecularFormula)) 130 # TODO: GuiUtils.FormulaValidator() crashes with Qt5 - fix 131 #self.ui.editMolecularFormula.setValidator(GuiUtils.FormulaValidator(self.ui.editMolecularFormula)) 131 132 132 133 rx = QtCore.QRegExp("[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?") … … 148 149 149 150 self.model.dataChanged.connect(self.dataChanged) 150 #QtCore.QObject.connect(151 # self.model,152 # QtCore.SIGNAL("dataChanged(QModelIndex,QModelIndex)"),153 # self.dataChanged)154 151 155 152 self.modelReset() … … 166 163 self.mapper.addMapping(edit, key) 167 164 168 # FIXME DOESNT WORK WITH QT5 169 #self.mapper.toFirst() 165 self.mapper.toFirst() 170 166 171 167 def dataChanged(self, top, bottom): … … 216 212 finally: 217 213 pass 218 214 #self.model.endResetModel() 219 215 220 216 def displayHelp(self): -
src/sas/qtgui/Calculators/SlitSizeCalculator.py
r4992ff2 rfbfc488 4 4 import os 5 5 import sys 6 import logging 6 7 7 8 from PyQt5 import QtCore … … 64 65 return 65 66 loader = Loader() 66 data = loader.load(path_str)[0] 67 try: 68 data = loader.load(path_str)[0] 69 # Can return multiple exceptions - gather them all under one umbrella and complain 70 except Exception as ex: 71 logging.error(ex) 72 return 67 73 68 74 self.data_file.setText(os.path.basename(path_str)) … … 79 85 "SAXSess 1D data (*.txt *.TXT *.dat *.DAT)", 80 86 None, 81 QtWidgets.QFileDialog.DontUseNativeDialog) 82 83 if path is None: 84 return 85 87 QtWidgets.QFileDialog.DontUseNativeDialog)[0] 86 88 return path 87 89 … … 106 108 self.clearResults() 107 109 msg = "ERROR: Data hasn't been loaded correctly" 108 raise RuntimeError(msg) 110 logging.error(msg) 111 return 109 112 110 113 if data.__class__.__name__ == 'Data2D': 111 114 self.clearResults() 112 115 msg = "Slit Length cannot be computed for 2D Data" 113 raise RuntimeError(msg) 116 logging.error(msg) 117 return 114 118 115 119 #compute the slit size … … 119 123 if xdata == [] or xdata is None or ydata == [] or ydata is None: 120 124 msg = "The current data is empty please check x and y" 121 raise ValueError(msg) 125 logging.error(msg) 126 return 122 127 slit_length_calculator = SlitlengthCalculator() 123 128 slit_length_calculator.set_data(x=xdata, y=ydata) … … 126 131 self.clearResults() 127 132 msg = "Slit Size Calculator: %s" % (sys.exc_info()[1]) 128 raise RuntimeError(msg) 133 logging.error(msg) 134 return 129 135 130 136 slit_length_str = "{:.5f}".format(slit_length)
Note: See TracChangeset
for help on using the changeset viewer.