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:
QDialog
,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.
- __doc__ = '\n Dialog for easy custom composite models. Provides a Dialog panel\n to choose two existing models (including pre-existing Plugin Models which\n may themselves be composite models) as well as an operation on those models\n (add or multiply) the resulting model will add a scale parameter and a\n background parameter.\n The user can also give a brief help for the model in the description box and\n must provide a unique name which is verified before the new model is saved.\n '¶
- __module__ = 'sas.qtgui.Utilities.AddMultEditor'¶
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!
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Utilities.CategoryInstaller', '__doc__': '\n Class for making sure all category stuff is installed\n\n Note - class is entirely static!\n ', '__init__': <function CategoryInstaller.__init__>, '_get_home_dir': <staticmethod object>, '_regenerate_model_dict': <staticmethod object>, '_regenerate_master_dict': <staticmethod object>, 'get_user_file': <staticmethod object>, 'get_default_file': <staticmethod object>, 'check_install': <staticmethod object>, '__dict__': <attribute '__dict__' of 'CategoryInstaller' objects>, '__weakref__': <attribute '__weakref__' of 'CategoryInstaller' objects>, '__annotations__': {}})¶
- __doc__ = '\n Class for making sure all category stuff is installed\n\n Note - class is entirely static!\n '¶
- __module__ = 'sas.qtgui.Utilities.CategoryInstaller'¶
- __weakref__¶
list of weak references to the object (if defined)
- static _regenerate_master_dict(by_model_dict, model_enabled_dict)[source]¶
regenerates master_category_dict from by_model_dict and model_enabled_dict returns the master category dictionary
- static _regenerate_model_dict(master_category_dict)[source]¶
regenerates self.by_model_dict which has each model name as the key and the list of categories belonging to that model along with the enabled mapping returns tuplet (by_model_dict, model_enabled_dict)
sas.qtgui.Utilities.CodeEditor module¶
sas.qtgui.Utilities.ConnectionProxy module¶
- class sas.qtgui.Utilities.ConnectionProxy.ConnectionProxy(url, timeout)[source]¶
Bases:
object
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Utilities.ConnectionProxy', '__init__': <function ConnectionProxy.__init__>, '_get_addresses_of_proxy_pac': <function ConnectionProxy._get_addresses_of_proxy_pac>, '_parse_proxy_pac': <function ConnectionProxy._parse_proxy_pac>, '_set_proxy': <function ConnectionProxy._set_proxy>, 'connect': <function ConnectionProxy.connect>, '__dict__': <attribute '__dict__' of 'ConnectionProxy' objects>, '__weakref__': <attribute '__weakref__' of 'ConnectionProxy' objects>, '__doc__': None, '__annotations__': {}})¶
- __doc__ = None¶
- __module__ = 'sas.qtgui.Utilities.ConnectionProxy'¶
- __weakref__¶
list of weak references to the object (if defined)
- _get_addresses_of_proxy_pac()[source]¶
Return a list of possible auto proxy .pac files being used, based on the system registry (win32) or system preferences (OSX). @return: list of urls
- _parse_proxy_pac(pac_urls_list)[source]¶
For every pac file url in pac_urls_list, it tryes to connect. If the connection is successful parses the file in search for http proxies. @param pac_urls_list: List with urls for the pac files @return: list with all found http proxies
- _set_proxy(proxy_dic=None)[source]¶
Sets connection proxy. if proxy_dic is None get’s teh proxy from the system. To disable autodetected proxy pass an empty dictionary: {} @param proxy_dic: format: {‘http’: ‘http://www.example.com:3128/’}
sas.qtgui.Utilities.CustomDir module¶
sas.qtgui.Utilities.FileConverter module¶
File Converter Widget
- class sas.qtgui.Utilities.FileConverter.FileConverterWidget(parent=None)[source]¶
Bases:
QDialog
,Ui_FileConverterUI
Class to describe the behaviour of the File Converter widget
- __doc__ = '\n Class to describe the behaviour of the File Converter widget\n '¶
- __init__(parent=None)[source]¶
Parent here is the GUI Manager. Required for access to the help location and to the file loader.
- __module__ = 'sas.qtgui.Utilities.FileConverter'¶
- 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
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:
QDialog
,Ui_FrameSelect
Class to describe the behaviour of the Frame Selector widget
- __doc__ = '\n Class to describe the behaviour of the Frame Selector widget\n '¶
- __module__ = 'sas.qtgui.Utilities.FrameSelect'¶
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:
CalcThread
Load a sld data given a filename
- __doc__ = '\n Load a sld data given a filename\n '¶
- __init__(path, loader, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source]¶
Prepare the calculator
- __module__ = 'sas.qtgui.Utilities.GenericReader'¶
sas.qtgui.Utilities.GridPanel module¶
- class sas.qtgui.Utilities.GridPanel.BatchInversionOutputPanel(parent=None, output_data=None)[source]¶
Bases:
BatchOutputPanel
Class for stateless grid-like printout of P(r) parameters for any number of data sets
- __doc__ = '\n Class for stateless grid-like printout of P(r) parameters for any number\n of data sets\n '¶
- __module__ = 'sas.qtgui.Utilities.GridPanel'¶
- class sas.qtgui.Utilities.GridPanel.BatchOutputPanel(parent=None, output_data=None)[source]¶
Bases:
QMainWindow
,Ui_GridPanelUI
Class for stateless grid-like printout of model parameters for mutiple models
- ERROR_COLUMN_CAPTION = ' (Err)'¶
- IS_WIN = True¶
- __doc__ = '\n Class for stateless grid-like printout of model parameters for mutiple models\n '¶
- __module__ = 'sas.qtgui.Utilities.GridPanel'¶
- classmethod dataFromTable(table)[source]¶
Creates a dictionary {<parameter>:[list of values]} from the parameter table
- windowClosedSignal¶
sas.qtgui.Utilities.GuiUtils module¶
Global defaults and various utility functions usable by the general GUI
- class sas.qtgui.Utilities.GuiUtils.Communicate[source]¶
Bases:
QObject
Utility class for tracking of the Qt signals
- SaveFitParamsSignal¶
- __doc__ = '\n Utility class for tracking of the Qt signals\n '¶
- __module__ = 'sas.qtgui.Utilities.GuiUtils'¶
- 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:
QDoubleValidator
Allow only dots as decimal separator
- __doc__ = '\n Allow only dots as decimal separator\n '¶
- __module__ = 'sas.qtgui.Utilities.GuiUtils'¶
- class sas.qtgui.Utilities.GuiUtils.FormulaValidator(parent=None)[source]¶
Bases:
QValidator
- __doc__ = None¶
- __module__ = 'sas.qtgui.Utilities.GuiUtils'¶
- class sas.qtgui.Utilities.GuiUtils.HashableStandardItem(parent=None)[source]¶
Bases:
QStandardItem
Subclassed standard item with reimplemented __hash__ to allow for use as an index.
- __doc__ = '\n Subclassed standard item with reimplemented __hash__\n to allow for use as an index.\n '¶
- __module__ = 'sas.qtgui.Utilities.GuiUtils'¶
- sas.qtgui.Utilities.GuiUtils._find_local_config(confg_file, path)[source]¶
Find configuration file for the current application
- 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.formatValue(value)[source]¶
Formats specific data types for the GUI.
This function accepts three types of data: numeric data castable to float, a numpy.ndarray of type castable to float, or None. Numeric data is returned in human-readable format by formatNumber(), numpy arrays are averaged over all axes, and the mean returned in human-readable format. If value=None then the string “NaN” is returned.
- Parameters:
value (float, numeric type castable to float, numpy.ndarray, None) – The value to be formatted
- Returns:
The formatted value
- Return type:
str
- 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.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.openLink(url)[source]¶
Open a URL in an external browser. Check the URL first, though.
- 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.saveAnyData(data, wildcard_dict=None)[source]¶
Generic file save routine called by SaveData1D and SaveData2D
- Parameters:
data – Data 1D or Data2D object the data will be taken from
wildcard_dict – Dictionary in format {“Display Text”: “.ext”}
- 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
- Parameters:
data – Data1D object the data will be taken from
- sas.qtgui.Utilities.GuiUtils.saveData2D(data)[source]¶
Save data2d data points
- Parameters:
data – Data2D object the data will be taken from
- 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.IPythonWidget module¶
- class sas.qtgui.Utilities.IPythonWidget.IPythonWidget(**kwargs: Any)[source]¶
Bases:
RichJupyterWidget
- __doc__ = None¶
- __module__ = 'sas.qtgui.Utilities.IPythonWidget'¶
- _all_trait_default_generators: Dict[str, Any] = {'_display_banner': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, '_highlighter': <bound method TraitType.default of <traitlets.traitlets.Instance object>>, '_jpg_supported': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'ansi_codes': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'banner': <traitlets.traitlets.DefaultHandler object>, 'buffer_size': <bound method TraitType.default of <traitlets.traitlets.Int object>>, 'clear_on_kernel_restart': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'config': <bound method TraitType.default of <traitlets.traitlets.Instance object>>, 'confirm_restart': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'console_height': <bound method TraitType.default of <traitlets.traitlets.Int object>>, 'console_width': <bound method TraitType.default of <traitlets.traitlets.Int object>>, 'custom_edit': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'custom_interrupt': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'custom_restart': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'editor': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'editor_line': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'enable_calltips': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'execute_on_complete_input': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'font_family': <function ConsoleWidget._font_family_default>, 'font_size': <bound method TraitType.default of <traitlets.traitlets.Int object>>, 'gui_completion': <bound method TraitType.default of <traitlets.traitlets.Enum object>>, 'history_lock': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'in_prompt': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'include_other_output': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'input_sep': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'kernel_banner': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'kind': <bound method TraitType.default of <traitlets.traitlets.Enum object>>, 'lexer': <function FrontendWidget._lexer_default>, 'lexer_class': <function FrontendWidget._lexer_class_default>, 'log': <traitlets.traitlets.DefaultHandler object>, 'other_output_prefix': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'out_prompt': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'output_sep': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'output_sep2': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'override_shortcuts': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'paging': <bound method TraitType.default of <traitlets.traitlets.Enum object>>, 'parent': <bound method TraitType.default of <traitlets.traitlets.Instance object>>, 'scrollbar_visibility': <bound method TraitType.default of <traitlets.traitlets.Bool object>>, 'style_sheet': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>, 'syntax_style': <bound method TraitType.default of <traitlets.traitlets.Unicode object>>}¶
- _cross_validation_lock: bool¶
- _descriptors = [<traitlets.traitlets.DefaultHandler object>, <traitlets.traitlets.ObserveHandler object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Instance object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.DefaultHandler object>, <traitlets.traitlets.ObserveHandler object>, <traitlets.traitlets.ObserveHandler object>, <traitlets.traitlets.ValidateHandler object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Int object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Instance object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Int object>, <traitlets.traitlets.Int object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Int object>, <traitlets.traitlets.Enum object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Enum object>, <traitlets.traitlets.Any object>, <traitlets.traitlets.DottedObjectName object>, <traitlets.traitlets.Any object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Enum object>, <traitlets.traitlets.Instance object>, <traitlets.traitlets.Bool object>, <traitlets.traitlets.Unicode object>, <traitlets.traitlets.Unicode object>]¶
- _instance_inits = [<bound method BaseDescriptor.instance_init of <traitlets.traitlets.DefaultHandler object>>, <bound method ObserveHandler.instance_init of <traitlets.traitlets.ObserveHandler object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>, <bound method BaseDescriptor.instance_init of <traitlets.traitlets.DefaultHandler object>>, <bound method ObserveHandler.instance_init of <traitlets.traitlets.ObserveHandler object>>, <bound method ObserveHandler.instance_init of <traitlets.traitlets.ObserveHandler object>>, <bound method ValidateHandler.instance_init of <traitlets.traitlets.ValidateHandler object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>, <bound method BaseDescriptor.instance_init of <traitlets.traitlets.DottedObjectName object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>]¶
- _static_immutable_initial_values: Dict[str, Any] = {'_display_banner': False, '_highlighter': None, '_jpg_supported': False, 'ansi_codes': True, 'buffer_size': 500, 'clear_on_kernel_restart': True, 'confirm_restart': True, 'console_height': 25, 'console_width': 81, 'custom_edit': False, 'custom_interrupt': False, 'custom_restart': False, 'editor': 'notepad', 'editor_line': '', 'enable_calltips': True, 'execute_on_complete_input': True, 'font_size': 0, 'history_lock': False, 'in_prompt': 'In [<span class="in-prompt-number">%i</span>]: ', 'include_other_output': False, 'input_sep': '\n', 'kernel_banner': '', 'other_output_prefix': '[remote] ', 'out_prompt': 'Out[<span class="out-prompt-number">%i</span>]: ', 'output_sep': '', 'output_sep2': '', 'override_shortcuts': False, 'parent': None, 'scrollbar_visibility': True, 'style_sheet': '', 'syntax_style': ''}¶
- _trait_default_generators = {}¶
- _trait_notifiers: Dict[str, Any]¶
- _trait_validators: Dict[str, Any]¶
- _trait_values: Dict[str, Any]¶
- _traits: Dict[str, Any] = {'_display_banner': <traitlets.traitlets.Bool object>, '_highlighter': <traitlets.traitlets.Instance object>, '_jpg_supported': <traitlets.traitlets.Bool object>, 'ansi_codes': <traitlets.traitlets.Bool object>, 'banner': <traitlets.traitlets.Unicode object>, 'buffer_size': <traitlets.traitlets.Int object>, 'clear_on_kernel_restart': <traitlets.traitlets.Bool object>, 'config': <traitlets.traitlets.Instance object>, 'confirm_restart': <traitlets.traitlets.Bool object>, 'console_height': <traitlets.traitlets.Int object>, 'console_width': <traitlets.traitlets.Int object>, 'custom_edit': <traitlets.traitlets.Bool object>, 'custom_interrupt': <traitlets.traitlets.Bool object>, 'custom_restart': <traitlets.traitlets.Bool object>, 'editor': <traitlets.traitlets.Unicode object>, 'editor_line': <traitlets.traitlets.Unicode object>, 'enable_calltips': <traitlets.traitlets.Bool object>, 'execute_on_complete_input': <traitlets.traitlets.Bool object>, 'font_family': <traitlets.traitlets.Unicode object>, 'font_size': <traitlets.traitlets.Int object>, 'gui_completion': <traitlets.traitlets.Enum object>, 'history_lock': <traitlets.traitlets.Bool object>, 'in_prompt': <traitlets.traitlets.Unicode object>, 'include_other_output': <traitlets.traitlets.Bool object>, 'input_sep': <traitlets.traitlets.Unicode object>, 'kernel_banner': <traitlets.traitlets.Unicode object>, 'kind': <traitlets.traitlets.Enum object>, 'lexer': <traitlets.traitlets.Any object>, 'lexer_class': <traitlets.traitlets.DottedObjectName object>, 'log': <traitlets.traitlets.Any object>, 'other_output_prefix': <traitlets.traitlets.Unicode object>, 'out_prompt': <traitlets.traitlets.Unicode object>, 'output_sep': <traitlets.traitlets.Unicode object>, 'output_sep2': <traitlets.traitlets.Unicode object>, 'override_shortcuts': <traitlets.traitlets.Bool object>, 'paging': <traitlets.traitlets.Enum object>, 'parent': <traitlets.traitlets.Instance object>, 'scrollbar_visibility': <traitlets.traitlets.Bool object>, 'style_sheet': <traitlets.traitlets.Unicode object>, 'syntax_style': <traitlets.traitlets.Unicode object>}¶
sas.qtgui.Utilities.ImageViewer module¶
Image viewer widget.
- class sas.qtgui.Utilities.ImageViewer.ImageViewer(parent=None)[source]¶
Bases:
QMainWindow
,Ui_ImageViewerUI
Implemented as QMainWindow to enable easy menus
- __doc__ = '\n Implemented as QMainWindow to enable easy menus\n '¶
- __module__ = 'sas.qtgui.Utilities.ImageViewer'¶
sas.qtgui.Utilities.LocalConfig module¶
Application settings
sas.qtgui.Utilities.ModelEditor module¶
- class sas.qtgui.Utilities.ModelEditor.ModelEditor(parent=None, is_python=True)[source]¶
Bases:
QDialog
,Ui_ModelEditor
Class describing the “advanced” model editor. This is a simple text browser allowing for editing python and supporting simple highlighting.
- __doc__ = '\n Class describing the "advanced" model editor.\n This is a simple text browser allowing for editing python and\n supporting simple highlighting.\n '¶
- __module__ = 'sas.qtgui.Utilities.ModelEditor'¶
- modelModified¶
sas.qtgui.Utilities.ObjectLibrary module¶
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.
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Utilities.PlotView', '__doc__': "\n Define a 'with' context manager that lets you use pylab commands to\n plot on an embedded canvas. This is useful for wrapping existing\n scripts in a GUI, and benefits from being more familiar than the\n underlying object oriented interface.\n\n As a convenience, the pylab module is returned on entry.\n\n *Example*\n\n The following example shows how to use the WxAgg backend in a wx panel::\n\n from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas\n from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as Toolbar\n from matplotlib.figure import Figure\n\n class PlotPanel(wx.Panel):\n def __init__(self, *args, **kw):\n wx.Panel.__init__(self, *args, **kw)\n\n figure = Figure(figsize=(1,1), dpi=72)\n canvas = FigureCanvas(self, wx.ID_ANY, figure)\n self.pylab_interface = EmbeddedPylab(canvas)\n\n # Instantiate the matplotlib navigation toolbar and explicitly show it.\n mpl_toolbar = Toolbar(canvas)\n mpl_toolbar.Realize()\n\n # Create a vertical box sizer to manage the widgets in the main panel.\n sizer = wx.BoxSizer(wx.VERTICAL)\n sizer.Add(canvas, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, border=0)\n sizer.Add(mpl_toolbar, 0, wx.EXPAND|wx.ALL, border=0)\n\n # Associate the sizer with its container.\n self.SetSizer(sizer)\n sizer.Fit(self)\n\n def plot(self, *args, **kw):\n with self.pylab_interface as pylab:\n pylab.clf()\n pylab.plot(*args, **kw)\n\n Similar patterns should work for the other backends. Check the source code\n in matplotlib.backend_bases.* for examples showing how to use matplotlib\n with other GUI toolkits.\n ", '__init__': <function EmbeddedPylab.__init__>, '__enter__': <function EmbeddedPylab.__enter__>, '__exit__': <function EmbeddedPylab.__exit__>, '__dict__': <attribute '__dict__' of 'EmbeddedPylab' objects>, '__weakref__': <attribute '__weakref__' of 'EmbeddedPylab' objects>, '__annotations__': {}})¶
- __doc__ = "\n Define a 'with' context manager that lets you use pylab commands to\n plot on an embedded canvas. This is useful for wrapping existing\n scripts in a GUI, and benefits from being more familiar than the\n underlying object oriented interface.\n\n As a convenience, the pylab module is returned on entry.\n\n *Example*\n\n The following example shows how to use the WxAgg backend in a wx panel::\n\n from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas\n from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as Toolbar\n from matplotlib.figure import Figure\n\n class PlotPanel(wx.Panel):\n def __init__(self, *args, **kw):\n wx.Panel.__init__(self, *args, **kw)\n\n figure = Figure(figsize=(1,1), dpi=72)\n canvas = FigureCanvas(self, wx.ID_ANY, figure)\n self.pylab_interface = EmbeddedPylab(canvas)\n\n # Instantiate the matplotlib navigation toolbar and explicitly show it.\n mpl_toolbar = Toolbar(canvas)\n mpl_toolbar.Realize()\n\n # Create a vertical box sizer to manage the widgets in the main panel.\n sizer = wx.BoxSizer(wx.VERTICAL)\n sizer.Add(canvas, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, border=0)\n sizer.Add(mpl_toolbar, 0, wx.EXPAND|wx.ALL, border=0)\n\n # Associate the sizer with its container.\n self.SetSizer(sizer)\n sizer.Fit(self)\n\n def plot(self, *args, **kw):\n with self.pylab_interface as pylab:\n pylab.clf()\n pylab.plot(*args, **kw)\n\n Similar patterns should work for the other backends. Check the source code\n in matplotlib.backend_bases.* for examples showing how to use matplotlib\n with other GUI toolkits.\n "¶
- __module__ = 'sas.qtgui.Utilities.PlotView'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.qtgui.Utilities.PlotView.PlotView(*args, **kw)[source]¶
Bases:
QWidget
,_PlotViewShared
- __doc__ = None¶
- __module__ = 'sas.qtgui.Utilities.PlotView'¶
Bases:
object
list of weak references to the object (if defined)
Return a model specific menu
New or updated model structure. Do any sort or precalculation you need. plot will be called separately when you are done.
For long calculations, periodically perform wx.YieldIfNeeded() and then if self.cancel_calculation is True, return from the plot.
Plot to the current figure. If model has a plot method, just use that.
For long calculations, periodically perform wx.YieldIfNeeded() and then if self.cancel_calculation is True, return from the plot.
sas.qtgui.Utilities.PluginDefinition module¶
- class sas.qtgui.Utilities.PluginDefinition.PluginDefinition(parent=None)[source]¶
Bases:
QDialog
,Ui_PluginDefinition
Class describing the “simple” plugin editor. This is a simple series of widgets allowing for specifying model form and parameters.
- __doc__ = '\n Class describing the "simple" plugin editor.\n This is a simple series of widgets allowing for specifying\n model form and parameters.\n '¶
- __module__ = 'sas.qtgui.Utilities.PluginDefinition'¶
- modelModified¶
sas.qtgui.Utilities.PluginManager module¶
- class sas.qtgui.Utilities.PluginManager.PluginManager(parent=None)[source]¶
Bases:
QDialog
,Ui_PluginManagerUI
Class describing the model plugin manager. This is a simple list widget allowing for viewing/adding/deleting custom models.
- __doc__ = '\n Class describing the model plugin manager.\n This is a simple list widget allowing for viewing/adding/deleting custom models.\n '¶
- __module__ = 'sas.qtgui.Utilities.PluginManager'¶
sas.qtgui.Utilities.PythonSyntax module¶
- class sas.qtgui.Utilities.PythonSyntax.PythonHighlighter(document, is_python=True)[source]¶
Bases:
QSyntaxHighlighter
Syntax highlighter for the Python language.
- __doc__ = 'Syntax highlighter for the Python language.\n '¶
- __module__ = 'sas.qtgui.Utilities.PythonSyntax'¶
- 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']¶
- 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.ReportDialog module¶
- class sas.qtgui.Utilities.ReportDialog.ReportDialog(parent=None, report_list=None)[source]¶
Bases:
QDialog
,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
- __doc__ = '\n Class for stateless grid-like printout of model parameters for mutiple models\n '¶
- __module__ = 'sas.qtgui.Utilities.ReportDialog'¶
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:
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.
- __doc__ = '\n FitPanel class contains fields allowing to fit models and data\n\n :note: For Fit to be performed the user should check at least one parameter\n on fit Panel window.\n\n '¶
- __module__ = 'sas.qtgui.Utilities.ResultPanel'¶
- windowClosedSignal¶
- window_name = 'Result panel'¶
sas.qtgui.Utilities.SasviewLogger module¶
- class sas.qtgui.Utilities.SasviewLogger.QtHandler[source]¶
Bases:
QObject
,Handler
Version of logging handler “emitting” the message to custom stdout()
- __doc__ = '\n Version of logging handler "emitting" the message to custom stdout()\n '¶
- __module__ = 'sas.qtgui.Utilities.SasviewLogger'¶
- 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.TabbedModelEditor module¶
- class sas.qtgui.Utilities.TabbedModelEditor.TabbedModelEditor(parent=None, edit_only=False)[source]¶
Bases:
QDialog
,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.
- __doc__ = '\n Model editor "container" class describing interaction between\n plugin definition widget and model editor widget.\n Once the model is defined, it can be saved as a plugin.\n '¶
- __module__ = 'sas.qtgui.Utilities.TabbedModelEditor'¶
- canWriteModel(model=None, full_path='')[source]¶
Determine if the current plugin can be written to file
- checkModel(model_str)[source]¶
Run the ast check and return True if the model is good. False otherwise.
- editorModelModified()[source]¶
User modified the model in the Model Editor. Disable the plugin editor and show that the model is changed.
- 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.
- onApply()[source]¶
Write the plugin and update the model editor if plugin editor open Write/overwrite the plugin if model editor open
- 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/ ….”.
- pluginTitleSet()[source]¶
User modified the model name. Display the model name in the window title and allow for model save.
- 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