sas.qtgui.Utilities package
Submodules
sas.qtgui.Utilities.AddMultEditor module
Widget for simple add / multiply editor.
-
class
sas.qtgui.Utilities.AddMultEditor.
AddMultEditor
(parent=None)[source] Bases:
PyQt5.QtWidgets.QDialog
,sas.qtgui.Utilities.UI.AddMultEditorUI.Ui_AddMultEditorUI
Dialog for easy custom composite models. Provides a Dialog panel to choose two existing models (including pre-existing Plugin Models which may themselves be composite models) as well as an operation on those models (add or multiply) the resulting model will add a scale parameter and a background parameter. The user can also give a brief help for the model in the description box and must provide a unique name which is verified before the new model is saved.
-
onApply
()[source] Validity check, save model to file
-
onHelp
()[source] Display related help section
-
onNameCheck
()[source] Check if proposed new model name does not already exists (if the overwriting is not allowed). If not an error message not show error message is displayed
-
onOperatorChange
(index)[source] Respond to operator combo box changes
-
onOverwrite
()[source] Modify state on checkbox change
-
readModels
()[source] Generate list of models
-
setupModels
()[source] Add list of models to ‘Model1’ and ‘Model2’ comboboxes
-
setupSignals
()[source] Signals from various elements
-
updateModels
()[source] Update contents of comboboxes with new plugin models
-
write_new_model_to_file
(fname, model1_name, model2_name, operator)[source] Write and Save file
-
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
File Converter Widget
-
class
sas.qtgui.Utilities.FileConverter.
FileConverterWidget
(parent=None)[source] Bases:
PyQt5.QtWidgets.QDialog
,sas.qtgui.Utilities.UI.FileConverterUI.Ui_FileConverterUI
Class to describe the behaviour of the File Converter widget
-
addSlots
()[source] Create callbacks for UI elements and outside signals
-
askFrameRange
(n_frames=1)[source] Display a dialog asking the user to input the range of frames they would like to export
Parameters: n_frames – How many frames the loaded data file has Returns: A dictionary containing the parameters input by the user
-
convert1Ddata
(qdata, iqdata, ofile, metadata)[source] Formats a 1D array of q_axis data and a 2D array of I axis data (where each row of iqdata is a separate row), into an array of Data1D objects
-
extractBSLdata
(filename)[source] Extracts data from a 2D BSL file
Parameters: filename – The header file to extract the data from Return x_data: A 1D array containing all the x coordinates of the data Return y_data: A 1D array containing all the y coordinates of the data Return frame_data: A dictionary of the form {frame_number: data}, where data is a 2D numpy array containing the intensity data
-
getDetectorMetadata
()[source] Read the detector metadata fields and put them in the dictionary
-
getMetadata
()[source] metadata getter
-
getSampleMetadata
()[source] Read the sample metadata fields and put them in the dictionary
-
getSourceMetadata
()[source] Read the source metadata fields and put them in the dictionary
-
onConvert
()[source] Call the conversion method (and update DataExplorer with converted data)?
-
onHelp
()[source] Display online help related to the file converter
-
onIFileOpen
()[source] Show the path chooser for file with I
-
onInputFormat
()[source] Enable/disable UI items based on input format spec
-
onNewFile
()[source] show the save new file widget
-
onNewFileEdited
()[source] Update the output file state on direct field edit
-
onQFileOpen
()[source] Show the path chooser for file with Q
-
openFile
()[source] Show the path chooser for existent file
-
readMetadata
()[source] Read the metadata fields and put them in the dictionary
This reads the UI elements directly, but we don’t have a clear MVP distinction in this widgets, so there.
-
setValidators
()[source] Apply validators for double precision numbers to numerical fields
-
updateConvertState
()[source] Asserts presece of files for coversion. If all present -> enable the Convert button.
-
sas.qtgui.Utilities.FrameSelect module
FrameSelect class describes behaviour of the FrameSelect dialog
-
class
sas.qtgui.Utilities.FrameSelect.
FrameSelect
(parent=None, frames=1, isBSL=True)[source] Bases:
PyQt5.QtWidgets.QDialog
,sas.qtgui.Utilities.UI.FrameSelectUI.Ui_FrameSelect
Class to describe the behaviour of the Frame Selector widget
-
addSlots
()[source] Describe behaviour of OK and Cancel buttons
-
addState
()[source] Minor bookkeeping
-
addText
()[source] Initialize view
-
getFrames
()[source] Accessor for state values
-
onFirstChanged
()[source] Manage view-model sync
-
onIncrementChanged
()[source] Manage view-model sync
-
onLastChanged
()[source] Manage view-model sync
-
updateDisplay
()[source] manage model-view sync
-
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
-
class
sas.qtgui.Utilities.GridPanel.
BatchInversionOutputPanel
(parent=None, output_data=None)[source] Bases:
sas.qtgui.Utilities.GridPanel.BatchOutputPanel
Class for stateless grid-like printout of P(r) parameters for any number of data sets
-
closeEvent
(event)[source] Tell the parent window the window closed
-
classmethod
onHelp
()[source] Open a local url in the default browser
-
setupTable
(widget=None, data=None)[source] Create tablewidget items and show them, based on params
-
-
class
sas.qtgui.Utilities.GridPanel.
BatchOutputPanel
(parent=None, output_data=None)[source] Bases:
PyQt5.QtWidgets.QMainWindow
,sas.qtgui.Utilities.UI.GridPanelUI.Ui_GridPanelUI
Class for stateless grid-like printout of model parameters for mutiple models
-
ERROR_COLUMN_CAPTION
= ' (Err)'
-
IS_WIN
= False
-
actionLoadData
()[source] Open file load dialog and load a .csv file
-
actionSaveFile
()[source] Generate a .csv file and dump it do disk
-
actionSendToExcel
()[source] Generates a .csv file and opens the default CSV reader
-
addFitResults
(results)[source] Create a new tab with batch fitting results
-
addTabPage
(name=None)[source] Add new tab page with QTableWidget
-
addToolbarActions
()[source] Assing actions and callbacks to the File menu items
-
closeEvent
(event)[source] Overwrite QDialog close method to allow for custom widget close
-
currentTable
()[source] Returns the currently shown QTabWidget
-
classmethod
dataFromTable
(table)[source] Creates a dictionary {<parameter>:[list of values]} from the parameter table
-
classmethod
onHelp
()[source] Open a local url in the default browser
-
onPlot
()[source] Plot selected fits by sending signal to the parent
-
setupTable
(widget=None, data=None)[source] Create tablewidget items and show them, based on params
-
setupTableFromCSV
(csv_data)[source] Create tablewidget items and show them, based on params
-
showContextMenu
(position)[source] Show context specific menu in the tab table widget.
-
windowClosedSignal
-
classmethod
writeBatchToFile
(data, tmpfile, details='')[source] Helper to write result from batch into cvs file
-
sas.qtgui.Utilities.GuiUtils module
Global defaults and various utility functions usable by the general GUI
-
class
sas.qtgui.Utilities.GuiUtils.
Communicate
[source] Bases:
PyQt5.QtCore.QObject
Utility class for tracking of the Qt signals
-
SaveFitParamsSignal
-
activeGraphName
-
activeGraphsSignal
-
changeDataExplorerTabSignal
-
copyExcelFitParamsSignal
-
copyFitParamsSignal
-
copyLatexFitParamsSignal
-
customModelDirectoryChanged
-
dataDeletedSignal
-
deleteIntermediateTheoryPlotsSignal
-
extMaskEditorSignal
-
fileDataReceivedSignal
-
fileReadSignal
-
forcePlotDisplaySignal
-
maskEditorSignal
-
pasteFitParamsSignal
-
perspectiveChangedSignal
-
plotFromNameSignal
-
plotRequestedSignal
-
plotUpdateSignal
-
progressBarUpdateSignal
-
resultPlotUpdateSignal
-
sendDataToGridSignal
-
sendDataToPanelSignal
-
statusBarUpdateSignal
-
updateMaskedDataSignal
-
updateModelCategoriesSignal
-
updateModelFromDataOperationPanelSignal
-
updateModelFromPerspectiveSignal
-
updatePerspectiveWithDataSignal
-
updateTheoryFromPerspectiveSignal
-
-
class
sas.qtgui.Utilities.GuiUtils.
DoubleValidator
[source] Bases:
PyQt5.QtGui.QDoubleValidator
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:
PyQt5.QtGui.QValidator
-
validate
(self, str, int) → Tuple[QValidator.State, str, int][source]
-
-
class
sas.qtgui.Utilities.GuiUtils.
HashableStandardItem
(parent=None)[source] Bases:
PyQt5.QtGui.QStandardItem
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.
getConstraints
(fit_project)[source] Extracts constraints from fir_project dict and returns a dict where keys are the tab name and values are a list of constraints on that tab. The dict can then be passed to the updateFromConstraints method from the fitting perspective to apply the constraints with error checking mechanism
-
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.
itemFromDisplayName
(name, model_item)[source] Returns the model item text=name 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.
plotsFromDisplayName
(name, model_item)[source] Returns the list of plots for the item with text=name 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.
plotsOfType
(model, datatype=<class 'sas.qtgui.Plotting.PlotterData.Data1D'>)[source] Returns the list of plots for the whole model of type datatype
-
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
-
class
sas.qtgui.Utilities.IPythonWidget.
IPythonWidget
(parent=None, **kwargs)[source] Bases:
qtconsole.rich_jupyter_widget.RichJupyterWidget
sas.qtgui.Utilities.ImageViewer module
Image viewer widget.
-
class
sas.qtgui.Utilities.ImageViewer.
ImageViewer
(parent=None)[source] Bases:
PyQt5.QtWidgets.QMainWindow
,sas.qtgui.Utilities.UI.ImageViewerUI.Ui_ImageViewerUI
Implemented as QMainWindow to enable easy menus
-
actionConvertToData
()[source] Show the options dialog and if accepted, send data to conversion
-
actionCopyImage
()[source] Copy MPL widget area to buffer
-
actionHowTo
()[source] Send the image viewer help URL to the help viewer
-
actionLoadImage
()[source] Image loader given files extensions
-
actionPrintImage
()[source] Display printer dialog and print the MPL widget area
-
actionSaveImage
()[source] Use the internal MPL method for saving to file
-
addPlotter
()[source] Add a new plotter to the frame
-
addTriggers
()[source] Trigger definitions for all menu/toolbar actions.
-
convertImage
(rgb, xmin, xmax, ymin, ymax, zscale)[source] Convert image to data2D
-
disableMenus
()[source] All menu items but “Load File” and “Help” should be disabled when no data is present
-
enableMenus
()[source] Enable all menu items when data is present
-
rgb2gray
(rgb)[source] RGB to Grey
-
showImage
(filename)[source] Show the requested image in the main frame
-
-
class
sas.qtgui.Utilities.ImageViewer.
ImageViewerOptions
(parent=None)[source] Bases:
PyQt5.QtWidgets.QDialog
,sas.qtgui.Utilities.UI.ImageViewerOptionsUI.Ui_ImageViewerOptionsUI
Logics for the image viewer options UI
-
addDefaults
()[source] Fill out textedits with default values
-
addValidators
()[source] Define simple validators on line edits
-
getState
()[source] return current state of the widget
-
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
-
class
sas.qtgui.Utilities.ModelEditor.
ModelEditor
(parent=None, is_python=True)[source] Bases:
PyQt5.QtWidgets.QDialog
,sas.qtgui.Utilities.UI.ModelEditor.Ui_ModelEditor
Class describing the “advanced” model editor. This is a simple text browser allowing for editing python and supporting simple highlighting.
-
addSignals
()[source] Respond to signals in the widget
-
getModel
()[source] Return the current model, as displayed in the window
-
modelModified
-
onEdit
()[source] Respond to changes in the text browser.
-
setupWidgets
()[source] Set up dialog widgets. Here - just the highlighter connected to the text edit.
-
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
-
class
sas.qtgui.Utilities.PlotView.
EmbeddedPylab
(canvas)[source] Bases:
object
Define a ‘with’ context manager that lets you use pylab commands to plot on an embedded canvas. This is useful for wrapping existing scripts in a GUI, and benefits from being more familiar than the underlying object oriented interface.
As a convenience, the pylab module is returned on entry.
Example
The following example shows how to use the WxAgg backend in a wx panel:
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as Toolbar from matplotlib.figure import Figure class PlotPanel(wx.Panel): def __init__(self, *args, **kw): wx.Panel.__init__(self, *args, **kw) figure = Figure(figsize=(1,1), dpi=72) canvas = FigureCanvas(self, wx.ID_ANY, figure) self.pylab_interface = EmbeddedPylab(canvas) # Instantiate the matplotlib navigation toolbar and explicitly show it. mpl_toolbar = Toolbar(canvas) mpl_toolbar.Realize() # Create a vertical box sizer to manage the widgets in the main panel. sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(canvas, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, border=0) sizer.Add(mpl_toolbar, 0, wx.EXPAND|wx.ALL, border=0) # Associate the sizer with its container. self.SetSizer(sizer) sizer.Fit(self) def plot(self, *args, **kw): with self.pylab_interface as pylab: pylab.clf() pylab.plot(*args, **kw)
Similar patterns should work for the other backends. Check the source code in matplotlib.backend_bases.* for examples showing how to use matplotlib with other GUI toolkits.
-
class
sas.qtgui.Utilities.PlotView.
PlotView
(*args, **kw)[source] Bases:
PyQt5.QtWidgets.QWidget
,sas.qtgui.Utilities.PlotView._PlotViewShared
sas.qtgui.Utilities.PluginDefinition module
-
class
sas.qtgui.Utilities.PluginDefinition.
PluginDefinition
(parent=None)[source] Bases:
PyQt5.QtWidgets.QDialog
,sas.qtgui.Utilities.UI.PluginDefinitionUI.Ui_PluginDefinition
Class describing the “simple” plugin editor. This is a simple series of widgets allowing for specifying model form and parameters.
-
addSignals
()[source] Define slots for widget signals
-
addTooltip
()[source] Add the default tooltip to the text field
-
addWidgets
()[source] Initialize various widgets in the dialog
-
getModel
()[source] Return the current plugin model
-
initializeModel
()[source] Define the dictionary for internal data representation
-
modelModified
-
onDescriptionChanged
()[source] Respond to changes in plugin description
-
onFunctionChanged
()[source] Respond to changes in function body
-
onOverwrite
()[source] Respond to change in file overwrite checkbox
-
onParamsChanged
(row, column)[source] Respond to changes in non-polydisperse parameter table
-
onParamsPDChanged
(row, column)[source] Respond to changes in non-polydisperse parameter table
-
onPluginNameChanged
()[source] Respond to changes in plugin name
-
sas.qtgui.Utilities.PluginManager module
-
class
sas.qtgui.Utilities.PluginManager.
PluginManager
(parent=None)[source] Bases:
PyQt5.QtWidgets.QDialog
,sas.qtgui.Utilities.UI.PluginManagerUI.Ui_PluginManagerUI
Class describing the model plugin manager. This is a simple list widget allowing for viewing/adding/deleting custom models.
-
addSignals
()[source] Define slots for widget signals
-
onAdd
()[source] Show the add new model dialog
-
onAddFile
()[source] Open system Load FIle dialog, load a plugin and put it in the plugin directory
-
onDelete
()[source] Remove the file containing the selected plugin
-
onDuplicate
()[source] Creates a copy of the selected model(s)
-
onEdit
()[source] Show the edit existing model dialog
-
onHelp
()[source] Show the help page in the default browser
-
onSelectionChanged
()[source] Respond to row selection
-
readModels
()[source] Read in custom models from the default location
-
sas.qtgui.Utilities.PythonSyntax module
-
class
sas.qtgui.Utilities.PythonSyntax.
PythonHighlighter
(document, is_python=True)[source] Bases:
PyQt5.QtGui.QSyntaxHighlighter
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
-
class
sas.qtgui.Utilities.ReportDialog.
ReportDialog
(parent=None, report_list=None)[source] Bases:
PyQt5.QtWidgets.QDialog
,sas.qtgui.Utilities.UI.ReportDialogUI.Ui_ReportDialogUI
Class for stateless grid-like printout of model parameters for mutiple models
-
static
HTML2PDF
(data, filename)[source] Create a PDF file from html source string. Returns True is the file creation was successful. : data: html string : filename: name of file to be saved
-
getPictures
(basename)[source] Returns list of saved MPL figures
-
static
onHTMLSave
(html, filename)[source] HTML file write
-
onPrint
()[source] Display the print dialog and send the report to printer
-
onSave
()[source] Display the Save As… prompt and save the report if instructed so
-
static
onTXTSave
(data, filename)[source] Simple txt file serialization
-
setupDialog
(output=None)[source] Display the HTML content in the browser.
-
static
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:
PyQt5.QtWidgets.QTabWidget
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]
sas.qtgui.Utilities.TabbedModelEditor module
-
class
sas.qtgui.Utilities.TabbedModelEditor.
TabbedModelEditor
(parent=None, edit_only=False)[source] Bases:
PyQt5.QtWidgets.QDialog
,sas.qtgui.Utilities.UI.TabbedModelEditor.Ui_TabbedModelEditor
Model editor “container” class describing interaction between plugin definition widget and model editor widget. Once the model is defined, it can be saved as a plugin.
-
addSignals
()[source] Define slots for common widget signals
-
addWidgets
()[source] Populate tabs with widgets
-
canWriteModel
(model=None, full_path='')[source] Determine if the current plugin can be written to file
-
closeEvent
(event)[source] Overwrite the close even to assure intent
-
editorModelModified
()[source] User modified the model in the Model Editor. Disable the plugin editor and show that the model is changed.
-
generateModel
(model, fname)[source] generate model from the current plugin state
-
getModel
()[source] Retrieves plugin model from the currently open tab
-
classmethod
getParamHelper
(param_str)[source] yield a sequence of name, value pairs for the parameters in param_str
Parameters can be defined by one per line by name=value, or multiple on the same line by separating the pairs by semicolon or comma. The value is optional and defaults to “1.0”.
-
isModelCorrect
(full_path)[source] Run the sasmodels method for model check and return True if the model is good. False otherwise.
-
loadFile
(filename)[source] Performs the load operation and updates the view
-
onApply
()[source] Write the plugin and update the model editor if plugin editor open Write/overwrite the plugin if model editor open
-
onCancel
()[source] Accept if document not modified, confirm intent otherwise.
-
onHelp
()[source] Bring up the Model Editor Documentation whenever the HELP button is clicked. Calls Documentation Window with the path of the location within the documentation tree (after /doc/ ….”.
-
onLoad
()[source] Loads a model plugin file
-
onModifiedExit
()[source]
-
pluginTitleSet
()[source] User modified the model name. Display the model name in the window title and allow for model save.
-
saveClose
()[source] Check if file needs saving before closing or model reloading
-
setPluginActive
(is_active=True)[source] Enablement control for all the controls on the simple plugin editor
-
setTabEdited
(is_edited)[source] Change the widget name to indicate unsaved state Unsaved state: add “*” to filename display saved state: remove “*” from filename display
-
classmethod
strFromParamDict
(param_dict)[source] Creates string from parameter dictionary
Example:
{ 0: ('variable','value'), 1: ('variable','value'), ... }
-
updateFromEditor
()[source] Save the current state of the Model Editor
-
updateFromPlugin
()[source] Write the plugin and update the model editor
-
classmethod
writeFile
(fname, model_str='')[source] Write model content to file “fname”
-