Changeset 8b480d27 in sasview for src/sas/qtgui
- Timestamp:
- Mar 21, 2018 8:24:36 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:
- 8ac3551
- Parents:
- 3b3b40b
- Location:
- src/sas/qtgui
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
r3b3b40b r8b480d27 171 171 # No such tab! 172 172 return 173 sim_fitter_list, fitter_id = tab_object.prepareFitters(fitter=sim_fitter_list[0], fit_id=fitter_id) 173 sim_fitter_list, fitter_id = \ 174 tab_object.prepareFitters(fitter=sim_fitter_list[0], fit_id=fitter_id) 174 175 page_ids.append([tab_object.page_id]) 175 176 except ValueError: -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r3b3b40b r8b480d27 424 424 self.onSelectModel() 425 425 426 def customModels(self): 426 @classmethod 427 def customModels(cls): 427 428 """ Reads in file names in the custom plugin directory """ 428 429 return ModelUtilities._find_models() … … 1051 1052 self._model_model.clear() 1052 1053 return 1053 1054 1054 1055 # Safely clear and enable the model combo 1055 1056 self.cbModel.blockSignals(True) … … 1357 1358 smearing, accuracy, smearing_min, smearing_max = self.smearing_widget.state() 1358 1359 1359 constraints = self.getConstraintsForFitting() 1360 # Get the constraints. 1361 constraints = self.getComplexConstraintsForModel() 1362 if fitter is None: 1363 # For single fits - check for inter-model constraints 1364 constraints = self.getConstraintsForFitting() 1360 1365 1361 1366 smearer = None -
src/sas/qtgui/Utilities/GridPanel.py
r3b3b40b r8b480d27 4 4 import webbrowser 5 5 6 from PyQt5 import QtCore, Qt Gui, QtWidgets6 from PyQt5 import QtCore, QtWidgets 7 7 8 8 import sas.qtgui.Utilities.GuiUtils as GuiUtils … … 91 91 return 92 92 93 def onHelp(self): 93 @classmethod 94 def onHelp(cls): 94 95 """ 95 96 Open a local url in the default browser … … 119 120 return 120 121 121 def dataFromTable(self, table): 122 @classmethod 123 def dataFromTable(cls, table): 122 124 """ 123 125 Creates a dictionary {<parameter>:[list of values]} from the parameter table … … 125 127 assert(isinstance(table, QtWidgets.QTableWidget)) 126 128 params = {} 127 #return {"sld_solvent":[1.2, 2.0, 0.0], "scale":[1.0, 2.0, 3.0]}128 129 for column in range(table.columnCount()): 129 #pass130 130 value = [table.item(row, column).data(0) for row in range(table.rowCount())] 131 131 key = table.horizontalHeaderItem(column).data(0) … … 144 144 t = time.localtime(time.time()) 145 145 time_str = time.strftime("%b %d %H:%M of %Y", t) 146 details = "File Generated by SasView " 146 details = "File Generated by SasView " 147 147 details += "on %s.\n" % time_str 148 148 self.writeBatchToFile(data=data, tmpfile=tmpfile, details=details) … … 247 247 self.tblParams.resizeColumnsToContents() 248 248 249 def writeBatchToFile(self, data, tmpfile, details=""): 249 @classmethod 250 def writeBatchToFile(cls, data, tmpfile, details=""): 250 251 """ 251 252 Helper to write result from batch into cvs file -
src/sas/qtgui/Utilities/ModelEditor.py
r3b3b40b r8b480d27 1 # global2 import sys3 import os4 import types5 import webbrowser6 7 1 from PyQt5 import QtCore 8 from PyQt5 import QtGui9 2 from PyQt5 import QtWidgets 10 3 11 import sas.qtgui.Utilities.GuiUtils as GuiUtils12 4 from sas.qtgui.Utilities.PythonSyntax import PythonHighlighter 13 5 … … 49 41 if self.txtEditor.toPlainText() != "": 50 42 self.modelModified.emit() 51 pass52 43 53 44 def getModel(self): -
src/sas/qtgui/Utilities/PluginDefinition.py
r3b3b40b r8b480d27 1 # global2 import sys3 import os4 import logging5 6 1 from PyQt5 import QtCore 7 2 from PyQt5 import QtGui … … 69 64 txt_validator = QtGui.QRegExpValidator(rx) 70 65 self.txtName.setValidator(txt_validator) 71 self.highlight = PythonHighlighter(self.txtFunction.document()) 66 self.highlight = PythonHighlighter(self.txtFunction.document()) 72 67 73 68 def initializeModel(self): -
src/sas/qtgui/Utilities/PluginManager.py
r3b3b40b r8b480d27 1 1 # global 2 import sys3 2 import os 4 import logging5 3 from shutil import copyfile 6 4 7 from PyQt5 import QtCore8 from PyQt5 import QtGui9 5 from PyQt5 import QtWidgets 10 6 -
src/sas/qtgui/Utilities/PythonSyntax.py
- Property mode changed from 100755 to 100644
r3b3b40b r8b480d27 1 import sys2 3 1 from PyQt5.QtCore import QRegExp 4 2 from PyQt5.QtGui import QColor, QTextCharFormat, QFont, QSyntaxHighlighter … … 175 173 176 174 if __name__ == '__main__': 177 import sys178 179 175 from PyQt5 import QtWidgets 180 176 -
src/sas/qtgui/Utilities/TabbedModelEditor.py
r3b3b40b r8b480d27 2 2 import sys 3 3 import os 4 import types5 4 import datetime 6 5 import numpy as np 7 import webbrowser8 6 import logging 9 7 10 from PyQt5 import QtCore11 from PyQt5 import QtGui12 8 from PyQt5 import QtWidgets 13 9 … … 17 13 from sas.qtgui.Utilities.PluginDefinition import PluginDefinition 18 14 from sas.qtgui.Utilities.ModelEditor import ModelEditor 19 import sas.qtgui.Utilities.GuiUtils as GuiUtils20 15 21 16 class TabbedModelEditor(QtWidgets.QDialog, Ui_TabbedModelEditor): … … 314 309 return self.tabWidget.currentWidget().getModel() 315 310 316 def writeFile(self, fname, model_str=""): 311 @classmethod 312 def writeFile(cls, fname, model_str=""): 317 313 """ 318 314 Write model content to file "fname" … … 342 338 model_text += 'parameters = [ \n' 343 339 model_text += '# ["name", "units", default, [lower, upper], "type", "description"],\n' 344 for pname, pvalue, desc in self.getParamHelper(param_str): 345 param_names.append(pname) 346 model_text += " ['%s', '', %s, [-inf, inf], '', '%s'],\n" % (pname, pvalue, desc) 347 for pname, pvalue, desc in self.getParamHelper(pd_param_str): 348 param_names.append(pname) 349 pd_params.append(pname) 350 model_text += " ['%s', '', %s, [-inf, inf], 'volume', '%s'],\n" % (pname, pvalue, desc) 340 if param_str: 341 for pname, pvalue, desc in self.getParamHelper(param_str): 342 param_names.append(pname) 343 model_text += " ['%s', '', %s, [-inf, inf], '', '%s'],\n" % (pname, pvalue, desc) 344 if pd_param_str: 345 for pname, pvalue, desc in self.getParamHelper(pd_param_str): 346 param_names.append(pname) 347 pd_params.append(pname) 348 model_text += " ['%s', '', %s, [-inf, inf], 'volume', '%s'],\n" % (pname, pvalue, desc) 351 349 model_text += ' ]\n' 352 350 … … 381 379 return model_text 382 380 383 def checkModel(self, path): 381 @classmethod 382 def checkModel(cls, path): 384 383 """ 385 384 Check that the model save in file 'path' can run. … … 390 389 model = Model() 391 390 q = np.array([0.01, 0.1]) 392 Iq= model.evalDistribution(q)391 _ = model.evalDistribution(q) 393 392 qx, qy = np.array([0.01, 0.01]), np.array([0.1, 0.1]) 394 Iqxy= model.evalDistribution([qx, qy])393 _ = model.evalDistribution([qx, qy]) 395 394 396 395 # check the model's unit tests run … … 400 399 return result 401 400 402 def getParamHelper(self, param_str): 401 @classmethod 402 def getParamHelper(cls, param_str): 403 403 """ 404 404 yield a sequence of name, value pairs for the parameters in param_str … … 414 414 if name: 415 415 yield [v.strip() for v in (name, value, desc)] 416 417 def strFromParamDict(self, param_dict): 416 417 @classmethod 418 def strFromParamDict(cls, param_dict): 418 419 """ 419 420 Creates string from parameter dictionary … … 423 424 """ 424 425 param_str = "" 425 for row, params in param_dict.items():426 for _, params in param_dict.items(): 426 427 if not params[0]: continue 427 428 value = 1 … … 500 501 501 502 if __name__ == '__main__': 502 import sys503 503 app = QtWidgets.QApplication(sys.argv) 504 504 sheet = TabbedModelEditor() 505 505 sheet.show() 506 sys.exit(app.exec_())506 app.exec_() 507 507
Note: See TracChangeset
for help on using the changeset viewer.