sas.qtgui.Utilities package
Submodules
sas.qtgui.Utilities.AddMultEditor module
sas.qtgui.Utilities.CategoryInstaller module
Class for making sure all category stuff is installed and works fine.
Copyright (c) Institut Laue-Langevin 2012
@author kieranrcampbell@gmail.com @modified by NIST/MD sasview team
-
class
sas.qtgui.Utilities.CategoryInstaller.
CategoryInstaller
[source] Bases:
object
Class for making sure all category stuff is installed
Note - class is entirely static!
-
static
check_install
(homedir=None, model_list=None)[source] the main method of this class makes sure categories.json exists and if not compile it and install :param homefile: Override the default home directory :param model_list: List of model names except customized models
-
static
get_default_file
()[source]
-
static
get_user_file
()[source] returns the user data file, eg .sasview/categories.json.json
-
static
sas.qtgui.Utilities.ConnectionProxy module
sas.qtgui.Utilities.CustomDir module
-
sas.qtgui.Utilities.CustomDir.
setup_conf_dir
(path)[source] Setup the custom config dir and cat file
sas.qtgui.Utilities.FileConverter module
sas.qtgui.Utilities.FrameSelect module
sas.qtgui.Utilities.GenericReader module
Thread handler used to load data
-
class
sas.qtgui.Utilities.GenericReader.
GenReader
(path, loader, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source] Bases:
sas.sascalc.data_util.calcthread.CalcThread
Load a sld data given a filename
-
compute
()[source] Read some data
-
isquit
()[source] @raise KeyboardInterrupt: when the thread is interrupted
-
sas.qtgui.Utilities.GridPanel module
sas.qtgui.Utilities.GuiUtils module
Global defaults and various utility functions usable by the general GUI
-
class
sas.qtgui.Utilities.GuiUtils.
Communicate
(*args, **kwargs)[source] Bases:
sphinx.ext.autodoc.importer._MockObject
Utility class for tracking of the Qt signals
-
SaveFitParamsSignal
Used by autodoc_mock_imports.
-
activeGraphName
Used by autodoc_mock_imports.
-
activeGraphsSignal
Used by autodoc_mock_imports.
-
changeDataExplorerTabSignal
Used by autodoc_mock_imports.
-
copyExcelFitParamsSignal
Used by autodoc_mock_imports.
-
copyFitParamsSignal
Used by autodoc_mock_imports.
-
copyLatexFitParamsSignal
Used by autodoc_mock_imports.
-
customModelDirectoryChanged
Used by autodoc_mock_imports.
-
dataDeletedSignal
Used by autodoc_mock_imports.
-
deleteIntermediateTheoryPlotsSignal
Used by autodoc_mock_imports.
-
extMaskEditorSignal
Used by autodoc_mock_imports.
-
fileDataReceivedSignal
Used by autodoc_mock_imports.
-
fileReadSignal
Used by autodoc_mock_imports.
-
forcePlotDisplaySignal
Used by autodoc_mock_imports.
-
maskEditorSignal
Used by autodoc_mock_imports.
-
pasteFitParamsSignal
Used by autodoc_mock_imports.
-
perspectiveChangedSignal
Used by autodoc_mock_imports.
-
plotFromFilenameSignal
Used by autodoc_mock_imports.
-
plotRequestedSignal
Used by autodoc_mock_imports.
-
plotUpdateSignal
Used by autodoc_mock_imports.
-
progressBarUpdateSignal
Used by autodoc_mock_imports.
-
resultPlotUpdateSignal
Used by autodoc_mock_imports.
-
sendDataToGridSignal
Used by autodoc_mock_imports.
-
sendDataToPanelSignal
Used by autodoc_mock_imports.
-
statusBarUpdateSignal
Used by autodoc_mock_imports.
-
updateMaskedDataSignal
Used by autodoc_mock_imports.
-
updateModelCategoriesSignal
Used by autodoc_mock_imports.
-
updateModelFromDataOperationPanelSignal
Used by autodoc_mock_imports.
-
updateModelFromPerspectiveSignal
Used by autodoc_mock_imports.
-
updatePerspectiveWithDataSignal
Used by autodoc_mock_imports.
-
updateTheoryFromPerspectiveSignal
Used by autodoc_mock_imports.
-
-
class
sas.qtgui.Utilities.GuiUtils.
DoubleValidator
(*args, **kwargs)[source] Bases:
sphinx.ext.autodoc.importer._MockObject
Allow only dots as decimal separator
-
fixup
(input)[source] Correct (remove) potential preexisting content
-
validate
(input, pos)[source] Return invalid for commas
-
-
class
sas.qtgui.Utilities.GuiUtils.
FormulaValidator
(parent=None)[source] Bases:
sphinx.ext.autodoc.importer._MockObject
-
validate
(input, pos)[source]
-
-
class
sas.qtgui.Utilities.GuiUtils.
HashableStandardItem
(parent=None)[source] Bases:
sphinx.ext.autodoc.importer._MockObject
Subclassed standard item with reimplemented __hash__ to allow for use as an index.
-
clone
()[source] Assure __hash__ is cloned as well
-
-
sas.qtgui.Utilities.GuiUtils.
checkModel
(path)[source] Check that the model save in file ‘path’ can run.
-
sas.qtgui.Utilities.GuiUtils.
convertFromSVS
(datasets)[source] Read in properties from SVS and convert into a simple dict
-
sas.qtgui.Utilities.GuiUtils.
convertUnitToHTML
(unit)[source] Convert ASCII unit display into well rendering HTML
-
sas.qtgui.Utilities.GuiUtils.
convertUnitToUTF8
(unit)[source] Convert ASCII unit display into UTF-8 symbol
-
sas.qtgui.Utilities.GuiUtils.
createModelItemWithPlot
(update_data, name='')[source] Creates a checkboxed QStandardItem named “name” Adds ‘update_data’ to that row.
-
sas.qtgui.Utilities.GuiUtils.
dataFromItem
(item)[source] Retrieve Data1D/2D component from QStandardItem. The assumption - data stored in SasView standard, in child 0
-
sas.qtgui.Utilities.GuiUtils.
deleteRedundantPlots
(item, new_plots)[source] Checks all plots that are children of the given item; if any have an ID or name not included in new_plots, it is deleted. Useful for e.g. switching from P(Q)S(Q) to P(Q); this would remove the old S(Q) plot.
Ensure that new_plots contains ALL the relevant plots(!!!)
-
sas.qtgui.Utilities.GuiUtils.
enum
(*sequential, **named)[source] Create an enumeration object from a list of strings
-
sas.qtgui.Utilities.GuiUtils.
findNextFilename
(filename, directory)[source] Finds the next available (non-existing) name for ‘filename’ in ‘directory’. plugin.py -> plugin (n).py - for first ‘n’ for which the file doesn’t exist
-
sas.qtgui.Utilities.GuiUtils.
formatNumber
(value, high=False)[source] Return a float in a standardized, human-readable formatted string. This is used to output readable (e.g. x.xxxe-y) values to the panel.
-
sas.qtgui.Utilities.GuiUtils.
getChildrenFromItem
(root)[source] Recursively go down the model item looking for all children
-
sas.qtgui.Utilities.GuiUtils.
getMonospaceFont
()[source] Convenience function; returns a monospace font to be used in any shells, code editors, etc.
-
sas.qtgui.Utilities.GuiUtils.
get_app_dir
()[source] The application directory is the one where the default custom_config.py file resides.
Returns: app_path - the path to the applicatin directory
-
sas.qtgui.Utilities.GuiUtils.
get_user_directory
()[source] Returns the user’s home directory
-
sas.qtgui.Utilities.GuiUtils.
infoFromData
(data)[source] Given Data1D/Data2D object, extract relevant Info elements and add them to a model item
-
sas.qtgui.Utilities.GuiUtils.
itemFromFilename
(filename, model_item)[source] Returns the model item text=filename in the model
-
sas.qtgui.Utilities.GuiUtils.
onTXTSave
(data, path)[source] Save file as formatted txt
-
sas.qtgui.Utilities.GuiUtils.
openLink
(url)[source] Open a URL in an external browser. Check the URL first, though.
-
sas.qtgui.Utilities.GuiUtils.
parseName
(name, expression)[source] remove “_” in front of a name
-
sas.qtgui.Utilities.GuiUtils.
plotsFromCheckedItems
(model_item)[source] Returns the list of plots for items in the model which are checked
-
sas.qtgui.Utilities.GuiUtils.
plotsFromFilename
(filename, model_item)[source] Returns the list of plots for the item with text=filename in the model
-
sas.qtgui.Utilities.GuiUtils.
plotsFromModel
(model_name, model_item)[source] Returns the list of plots for the item with model name in the model
-
sas.qtgui.Utilities.GuiUtils.
readDataFromFile
(fp)[source] Reads in Data1D/Data2 datasets from the file. Datasets are stored in the JSON format.
-
sas.qtgui.Utilities.GuiUtils.
readProjectFromSVS
(filepath)[source] Read old SVS file and convert to the project dictionary
-
sas.qtgui.Utilities.GuiUtils.
replaceHTMLwithASCII
(html)[source] Replace some important HTML-encoded characters with their ASCII equivalents
-
sas.qtgui.Utilities.GuiUtils.
replaceHTMLwithUTF8
(html)[source] Replace some important HTML-encoded characters with their UTF-8 equivalents
-
sas.qtgui.Utilities.GuiUtils.
retrieveData1d
(data)[source] Retrieve 1D data from file and construct its text representation
-
sas.qtgui.Utilities.GuiUtils.
retrieveData2d
(data)[source] Retrieve 2D data from file and construct its text representation
-
sas.qtgui.Utilities.GuiUtils.
saveData
(fp, data)[source] save content of data to fp (a .write()-supporting file-like object)
-
sas.qtgui.Utilities.GuiUtils.
saveData1D
(data)[source] Save 1D data points
-
sas.qtgui.Utilities.GuiUtils.
saveData2D
(data)[source] Save data2d dialog
-
sas.qtgui.Utilities.GuiUtils.
showHelp
(url)[source] Open a local url in the default browser
-
sas.qtgui.Utilities.GuiUtils.
toDouble
(value_string)[source] toFloat conversion which cares deeply about user’s locale
-
sas.qtgui.Utilities.GuiUtils.
updateModelItem
(item, update_data, name='')[source] Adds a simple named child to QStandardItem
-
sas.qtgui.Utilities.GuiUtils.
updateModelItemStatus
(model_item, filename='', name='', status=2)[source] Update status of checkbox related to high- and low-Q extrapolation choice in Invariant Panel
-
sas.qtgui.Utilities.GuiUtils.
updateModelItemWithPlot
(item, update_data, name='', checkbox_state=None)[source] Adds a checkboxed row named “name” to QStandardItem Adds ‘update_data’ to that row.
-
sas.qtgui.Utilities.GuiUtils.
xyTransform
(data, xLabel='', yLabel='')[source] Transforms x and y in View and set the scale
sas.qtgui.Utilities.IPythonWidget module
sas.qtgui.Utilities.ImageViewer module
sas.qtgui.Utilities.LocalConfig module
Application settings
-
sas.qtgui.Utilities.LocalConfig.
printEVT
(message)[source] Post a debug message to console/file
sas.qtgui.Utilities.ModelEditor module
sas.qtgui.Utilities.ObjectLibrary module
-
sas.qtgui.Utilities.ObjectLibrary.
addObject
(obj_name, obj)[source]
-
sas.qtgui.Utilities.ObjectLibrary.
deleteObjectByName
(obj_name)[source]
-
sas.qtgui.Utilities.ObjectLibrary.
deleteObjectByRef
(obj)[source]
-
sas.qtgui.Utilities.ObjectLibrary.
getObject
(obj_name)[source]
-
sas.qtgui.Utilities.ObjectLibrary.
listObjects
()[source]
sas.qtgui.Utilities.PlotView module
sas.qtgui.Utilities.PluginDefinition module
sas.qtgui.Utilities.PluginManager module
sas.qtgui.Utilities.PythonSyntax module
-
class
sas.qtgui.Utilities.PythonSyntax.
PythonHighlighter
(document, is_python=True)[source] Bases:
sphinx.ext.autodoc.importer._MockObject
Syntax highlighter for the Python language.
-
braces
= ['\\{', '\\}', '\\(', '\\)', '\\[', '\\]']
-
c_keywords
= ['auto', 'break', 'case', 'char', 'const', 'continue', 'default', 'do', 'double', 'else', 'enum', 'extern', 'float', 'for', 'goto', 'if', 'int', 'long', 'register', 'return', 'short', 'signed', 'sizeof', 'static', 'struct', 'switch', 'typedef', 'union', 'unsigned', 'void', 'volatile', 'while']
-
highlightBlock
(text)[source] Apply syntax highlighting to the given block of text.
-
match_multiline
(text, delimiter, in_state, style)[source] Do highlighting of multi-line strings.
delimiter
should be aQRegExp
for triple-single-quotes or triple-double-quotes, andin_state
should be a unique integer to represent the corresponding state changes when inside those strings. Returns True if we’re still inside a multi-line string when this function is finished.
-
operators
= ['=', '==', '!=', '<', '<=', '>', '>=', '\\+', '-', '\\*', '/', '//', '\\%', '\\*\\*', '\\+=', '-=', '\\*=', '/=', '\\%=', '\\^', '\\|', '\\&', '\\~', '>>', '<<']
-
python_keywords
= ['and', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'yield', 'None', 'True', 'False']
-
-
sas.qtgui.Utilities.PythonSyntax.
format
(color, style='')[source] Return a QTextCharFormat with the given attributes.
sas.qtgui.Utilities.ReportDialog module
sas.qtgui.Utilities.ResultPanel module
FitPanel class contains fields allowing to fit models and data
-
class
sas.qtgui.Utilities.ResultPanel.
ResultPanel
(parent, manager=None, *args, **kwargs)[source] Bases:
sphinx.ext.autodoc.importer._MockObject
FitPanel class contains fields allowing to fit models and data
Note: For Fit to be performed the user should check at least one parameter on fit Panel window. -
closeEvent
(event)[source] Overwrite QDialog close method to allow for custom widget close
-
onPlotResults
(results, optimizer='Unknown')[source]
-
updateBumps
()[source] Monkeypatching bumps plot viewer to allow Qt
-
windowClosedSignal
-
window_name
= 'Result panel'
-
sas.qtgui.Utilities.SasviewLogger module
-
class
sas.qtgui.Utilities.SasviewLogger.
QtHandler
[source] Bases:
PyQt5.QtCore.QObject
,logging.Handler
Version of logging handler “emitting” the message to custom stdout()
-
emit
(record)[source] Do whatever it takes to actually log the specified logging record.
This version is intended to be implemented by subclasses and so raises a NotImplementedError.
-
messageWritten
-
-
sas.qtgui.Utilities.SasviewLogger.
setup_qt_logging
()[source]