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!
- __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(<function CategoryInstaller._get_home_dir>)>, '_regenerate_model_dict': <staticmethod(<function CategoryInstaller._regenerate_model_dict>)>, '_regenerate_master_dict': <staticmethod(<function CategoryInstaller._regenerate_master_dict>)>, 'get_user_file': <staticmethod(<function CategoryInstaller.get_user_file>)>, 'get_default_file': <staticmethod(<function CategoryInstaller.get_default_file>)>, 'check_install': <staticmethod(<function CategoryInstaller.check_install>)>, '__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
- 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
- _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¶
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
- __annotations__ = {}¶
- __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
- __annotations__ = {}¶
- __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¶
sas.qtgui.Utilities.GuiUtils module¶
sas.qtgui.Utilities.IPythonWidget module¶
sas.qtgui.Utilities.ImageViewer module¶
sas.qtgui.Utilities.LocalConfig module¶
Application settings
sas.qtgui.Utilities.ModelEditor module¶
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
- class sas.qtgui.Utilities.PlotView.PlotView(*args, **kw)[source]¶
Bases:
QWidget
,_PlotViewShared
- __annotations__ = {}¶
- __doc__ = None¶
- __module__ = 'sas.qtgui.Utilities.PlotView'¶
Bases:
object
list of weak references to the object
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¶
sas.qtgui.Utilities.PluginManager module¶
sas.qtgui.Utilities.PythonSyntax module¶
- class sas.qtgui.Utilities.PythonSyntax.PythonHighlighter(document, is_python=True)[source]¶
Bases:
QSyntaxHighlighter
Syntax highlighter for the Python language.
- __annotations__ = {}¶
- __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¶
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.
- __annotations__ = {}¶
- __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¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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()
- __annotations__ = {}¶
- __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¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.