コード例 #1
0
def newTiledWindow(name=None, sources=None, ncols=None):
    """Create an empty tiled window.

    Args:
        name: The name to give to the window (if None, a unique name will be generated).

    Returns:
        A handle to the created window.
    """
    if name is None:
        proxy = new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow)
    else:
        proxy = new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow,
                          name)

    if ncols is None:
        ncols = proxy.columnCount()

    if sources is not None:
        row = 0
        col = 0
        for source in sources:
            if isinstance(source, tuple):
                ws = source[0]
                indices = source[1]
                source = plotSpectrum(ws, indices)
            proxy.addWidget(source, row, col)
            col += 1
            if col == ncols:
                col = 0
                row += 1

    return proxy
コード例 #2
0
ファイル: __init__.py プロジェクト: mducle/mantid
def newTiledWindow(name=None, sources = None, ncols = None):
    """Create an empty tiled window.

    Args:
        name: The name to give to the window (if None, a unique name will be generated).

    Returns:
        A handle to the created window.
    """
    if name is None:
        proxy = new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow)
    else:
        proxy = new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow, name)

    if ncols is None:
        ncols = proxy.columnCount()

    if not sources is None:
        row = 0
        col = 0
        for source in sources:
            if isinstance(source, tuple):
                ws = source[0]
                indices = source[1]
                source = plotSpectrum(ws, indices)
            proxy.addWidget(source, row, col)
            col += 1
            if col == ncols:
                col = 0
                row += 1

    return proxy
コード例 #3
0
def newNote(name=None):
    """Create a note.

    Args:
        name: The name to give to the note (if None, a unique name will be generated).

    Returns:
        A handle to the created note.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newNote)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newNote, name)
コード例 #4
0
ファイル: __init__.py プロジェクト: stothe2/mantid
def newTiledWindow(name=None):
    """Create an empty tiled window.

    Args:
        name: The name to give to the window (if None, a unique name will be generated).

    Returns:
        A handle to the created window.
    """
    if name is None:
        return new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow)
    else:
        return new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow, name)
コード例 #5
0
ファイル: __init__.py プロジェクト: mducle/mantid
def newNote(name=None):
    """Create a note.

    Args:
        name: The name to give to the note (if None, a unique name will be generated).

    Returns:
        A handle to the created note.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newNote)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newNote, name)
コード例 #6
0
def newMatrix(name=None, rows=32, columns=32):
    """Create a matrix (N.B. This is not the same as a 'MantidMatrix').

    Args:
        name: The name to give to the matrix (if None, a unique name will be generated).
        row: The number of rows in the matrix (default: 32).
        columns: The number of columns in the matrix (default: 32).

    Returns:
        A handle to the created matrix.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newMatrix)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newMatrix, name, rows, columns)
コード例 #7
0
def newTable(name=None, rows=30, columns=2):
    """Create a table.

    Args:
        name: The name to give to the table (if None, a unique name will be generated).
        row: The number of rows in the table (default: 30).
        columns: The number of columns in the table (default: 2).

    Returns:
        A handle to the created table.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newTable)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newTable, name, rows, columns)
コード例 #8
0
ファイル: __init__.py プロジェクト: mducle/mantid
def newMatrix(name=None, rows=32, columns=32):
    """Create a matrix (N.B. This is not the same as a 'MantidMatrix').

    Args:
        name: The name to give to the matrix (if None, a unique name will be generated).
        row: The number of rows in the matrix (default: 32).
        columns: The number of columns in the matrix (default: 32).

    Returns:
        A handle to the created matrix.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newMatrix)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newMatrix, name, rows, columns)
コード例 #9
0
ファイル: __init__.py プロジェクト: mducle/mantid
def newTable(name=None, rows=30, columns=2):
    """Create a table.

    Args:
        name: The name to give to the table (if None, a unique name will be generated).
        row: The number of rows in the table (default: 30).
        columns: The number of columns in the table (default: 2).

    Returns:
        A handle to the created table.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newTable)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newTable, name, rows, columns)
コード例 #10
0
ファイル: __init__.py プロジェクト: mducle/mantid
def newGraph(name=None, layers=1, rows=1, columns=1):
    """Create a graph window.

    Args:
        name: The name to give to the graph (if None, a unique name will be generated).
        layers: The number of plots (a.k.a. layers) to put in the graph window (default: 1).
        rows: The number of rows of to put in the graph window (default: 1).
        columns: The number of columns of to put in the graph window (default: 1).

    Returns:
        A handle to the created graph widget.
    """
    if name is None:
        return new_proxy(proxies.Graph, _qti.app.newGraph)
    else:
        return new_proxy(proxies.Graph, _qti.app.newGraph, name, layers, rows, columns)
コード例 #11
0
def newGraph(name=None, layers=1, rows=1, columns=1):
    """Create a graph window.

    Args:
        name: The name to give to the graph (if None, a unique name will be generated).
        layers: The number of plots (a.k.a. layers) to put in the graph window (default: 1).
        rows: The number of rows of to put in the graph window (default: 1).
        columns: The number of columns of to put in the graph window (default: 1).

    Returns:
        A handle to the created graph widget.
    """
    if name is None:
        return new_proxy(proxies.Graph, _qti.app.newGraph)
    else:
        return new_proxy(proxies.Graph, _qti.app.newGraph, name, layers, rows, columns)
コード例 #12
0
def importMatrixWorkspace(name,
                          firstIndex=None,
                          lastIndex=None,
                          showDialog=False,
                          visible=False):
    """Create a MantidMatrix object from the named workspace.

    Args:
        name: The name of the workspace.
        firstIndex: The workspace index to start at (default: the first one).
        lastIndex: The workspace index to stop at (default: the last one).
        showDialog: Whether to bring up a dialog to allow options to be entered manually (default: no).
        visible: Whether to initially show the created matrix (default: no).

    Returns:
        A handle to the created matrix.
    """
    # Turn the optional arguments into the magic numbers that the C++ expects
    if firstIndex is None:
        firstIndex = -1
    if lastIndex is None:
        lastIndex = -1
    return new_proxy(proxies.MantidMatrix,
                     _qti.app.mantidUI.importMatrixWorkspace, name, firstIndex,
                     lastIndex, showDialog, visible)
コード例 #13
0
def importImage(filename):
    """Load an image file into a matrix.

    Args:
        filename: The name of the file to load.

    Returns:
        A handle to the matrix containing the image data.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.importImage, filename)
コード例 #14
0
def note(name):
    """Get a handle on a note.

    Args:
        name: The name of the note.

    Returns:
        A handle to the note.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.note, name)
コード例 #15
0
def graph(name):
    """Get a handle on a graph widget.

    Args:
        name: The name of the graph window.

    Returns:
        A handle to the graph.
    """
    return new_proxy(proxies.Graph, _qti.app.graph, name)
コード例 #16
0
def matrix(name):
    """Get a handle on a matrix.

    Args:
        name: The name of the matrix.

    Returns:
        A handle to the matrix.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.matrix, name)
コード例 #17
0
def table(name):
    """Get a handle on a table.

    Args:
        name: The name of the table.

    Returns:
        A handle to the table.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.table, name)
コード例 #18
0
ファイル: __init__.py プロジェクト: mducle/mantid
def matrix(name):
    """Get a handle on a matrix.

    Args:
        name: The name of the matrix.

    Returns:
        A handle to the matrix.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.matrix, name)
コード例 #19
0
ファイル: __init__.py プロジェクト: mducle/mantid
def note(name):
    """Get a handle on a note.

    Args:
        name: The name of the note.

    Returns:
        A handle to the note.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.note, name)
コード例 #20
0
ファイル: __init__.py プロジェクト: mducle/mantid
def graph(name):
    """Get a handle on a graph widget.

    Args:
        name: The name of the graph window.

    Returns:
        A handle to the graph.
    """
    return new_proxy(proxies.Graph, _qti.app.graph, name)
コード例 #21
0
ファイル: __init__.py プロジェクト: mducle/mantid
def table(name):
    """Get a handle on a table.

    Args:
        name: The name of the table.

    Returns:
        A handle to the table.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.table, name)
コード例 #22
0
ファイル: __init__.py プロジェクト: mducle/mantid
def importImage(filename):
    """Load an image file into a matrix.

    Args:
        filename: The name of the file to load.

    Returns:
        A handle to the matrix containing the image data.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.importImage, filename)
コード例 #23
0
def importTableWorkspace(name, visible=False):
    """Create a MantidPlot table from a table workspace.

    Args:
        name: The name of the workspace.
        visible: Whether to initially show the created matrix (default: no).

    Returns:
        A handle to the newly created table.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.mantidUI.importTableWorkspace, name, False, visible)
コード例 #24
0
def waterfallPlot(table, columns):
    """Create a waterfall plot from data in a table.

    Args:
        table: A reference to the table containing the data to plot
        columns: A tuple of the column numbers whose data to plot

    Returns:
        A handle to the created plot (Layer).
    """
    return new_proxy(proxies.Graph, _qti.app.waterfallPlot, table._getHeldObject(), columns)
コード例 #25
0
ファイル: __init__.py プロジェクト: mducle/mantid
def waterfallPlot(table, columns):
    """Create a waterfall plot from data in a table.

    Args:
        table: A reference to the table containing the data to plot
        columns: A tuple of the column numbers whose data to plot

    Returns:
        A handle to the created plot (Layer).
    """
    return new_proxy(proxies.Graph, _qti.app.waterfallPlot, table._getHeldObject(), columns)
コード例 #26
0
ファイル: __init__.py プロジェクト: mducle/mantid
def importTableWorkspace(name, visible=False):
    """Create a MantidPlot table from a table workspace.

    Args:
        name: The name of the workspace.
        visible: Whether to initially show the created matrix (default: no).

    Returns:
        A handle to the newly created table.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.mantidUI.importTableWorkspace, name, False, visible)
コード例 #27
0
ファイル: __init__.py プロジェクト: mducle/mantid
def addFolder(name, parentFolder=None):
    """Create a new folder.

    Args:
        name: The name of the folder to create.
        parentFolder: If given, make the new folder a subfolder of this one.

    Returns:
        A handle to the newly created folder.
    """
    if parentFolder is not None:
        parentFolder = parentFolder._getHeldObject()
    return new_proxy(proxies.Folder, _qti.app.addFolder, name, parentFolder)
コード例 #28
0
def addFolder(name, parentFolder=None):
    """Create a new folder.

    Args:
        name: The name of the folder to create.
        parentFolder: If given, make the new folder a subfolder of this one.

    Returns:
        A handle to the newly created folder.
    """
    if parentFolder is not None:
        parentFolder = parentFolder._getHeldObject()
    return new_proxy(proxies.Folder, _qti.app.addFolder, name, parentFolder)
コード例 #29
0
ファイル: __init__.py プロジェクト: mducle/mantid
def createDetectorTable(source):
    try:
        import mantidqtpython
    except:
        print("Could not find module mantidqtpython. Cannot open the detector table.")
        return

    workspace_names = getWorkspaceNames(source)

    if len(workspace_names) != 1:
        raise Exception("Please specify only one workspace.")
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.mantidUI.createDetectorTable, workspace_names[0])
コード例 #30
0
def createDetectorTable(source):
    try:
        import mantidqtpython
    except:
        print "Could not find module mantidqtpython. Cannot open the detector table."
        return

    workspace_names = getWorkspaceNames(source)

    if len(workspace_names) != 1:
        raise Exception("Please specify only one workspace.")
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.mantidUI.createDetectorTable, workspace_names[0])
コード例 #31
0
ファイル: __init__.py プロジェクト: mkoennecke/mantid
def plot(source, *args, **kwargs):
    """Create a new plot given a workspace, table or matrix.

    Args:
        source: what to plot; if it is a Workspace, will
                call plotSpectrum()

    Returns:
        A handle to the created Graph widget.
    """
    if hasattr(source, '_getHeldObject') and isinstance(source._getHeldObject(), QtCore.QObject):
        return new_proxy(proxies.Graph,_qti.app.plot, source._getHeldObject(), *args, **kwargs)
    else:
        return plotSpectrum(source, *args, **kwargs)
コード例 #32
0
def getInstrumentView(name, tab=InstrumentWidget.RENDER):
    """Create an instrument view window based on the given workspace.

    Args:
        name: The name of the workspace.
        tab: The index of the tab to display initially, (default=InstrumentWidget.RENDER)

    Returns:
        A handle to the created instrument view widget.
    """
    ads = _get_analysis_data_service()
    if name not in ads:
        raise ValueError("Workspace '%s' does not exist" % name)
    return new_proxy(proxies.InstrumentView, _qti.app.mantidUI.getInstrumentView, name, tab)
コード例 #33
0
ファイル: __init__.py プロジェクト: mducle/mantid
def getInstrumentView(name, tab=InstrumentWidget.RENDER):
    """Create an instrument view window based on the given workspace.

    Args:
        name: The name of the workspace.
        tab: The index of the tab to display initially, (default=InstrumentWidget.RENDER)

    Returns:
        A handle to the created instrument view widget.
    """
    ads = _get_analysis_data_service()
    if name not in ads:
        raise ValueError("Workspace '%s' does not exist" % name)
    return new_proxy(proxies.InstrumentView, _qti.app.mantidUI.getInstrumentView, name, tab)
コード例 #34
0
ファイル: __init__.py プロジェクト: mducle/mantid
def importMatrixWorkspace(name, firstIndex=None, lastIndex=None, showDialog=False, visible=False):
    """Create a MantidMatrix object from the named workspace.

    Args:
        name: The name of the workspace.
        firstIndex: The workspace index to start at (default: the first one).
        lastIndex: The workspace index to stop at (default: the last one).
        showDialog: Whether to bring up a dialog to allow options to be entered manually (default: no).
        visible: Whether to initially show the created matrix (default: no).

    Returns:
        A handle to the created matrix.
    """
    # Turn the optional arguments into the magic numbers that the C++ expects
    if firstIndex is None:
        firstIndex = -1
    if lastIndex is None:
        lastIndex = -1
    return new_proxy(proxies.MantidMatrix, _qti.app.mantidUI.importMatrixWorkspace, name,
                     firstIndex, lastIndex, showDialog, visible)
コード例 #35
0
ファイル: __init__.py プロジェクト: mducle/mantid
def tableToMatrix(table):
    return new_proxy(proxies.MDIWindow, _qti.app.tableToMatrix, table._getHeldObject())
コード例 #36
0
ファイル: __init__.py プロジェクト: mducle/mantid
def clone(window):
    return new_proxy(proxies.MDIWindow, _qti.app.clone, window._getHeldObject())
コード例 #37
0
ファイル: __init__.py プロジェクト: mducle/mantid
def openTemplate(filename):
    """Load a previously saved window template"""
    return new_proxy(proxies.MDIWindow, _qti.app.openTemplate, filename)
コード例 #38
0
def openTemplate(filename):
    """Load a previously saved window template"""
    return new_proxy(proxies.MDIWindow, _qti.app.openTemplate, filename)
コード例 #39
0
ファイル: __init__.py プロジェクト: mducle/mantid
def getMantidMatrix(name):
    """Get a handle to the named Mantid matrix"""
    return new_proxy(proxies.MantidMatrix, _qti.app.mantidUI.getMantidMatrix, name)
コード例 #40
0
ファイル: __init__.py プロジェクト: mducle/mantid
def newPlot3D():
    return new_proxy(proxies.Graph3D, _qti.app.newPlot3D)
コード例 #41
0
def matrixToTable(matrix, conversionType=_qti.app.Direct):
    return new_proxy(proxies.MDIWindow, _qti.app.matrixToTable,
                     matrix._getHeldObject(), conversionType)
コード例 #42
0
def mergePlots(graph1, graph2):
    """Combine two graphs into a single plot"""
    return new_proxy(proxies.Graph, _qti.app.mantidUI.mergePlots,
                     graph1._getHeldObject(), graph2._getHeldObject())
コード例 #43
0
def rootFolder():
    """Get a handle to the top-level folder."""
    return new_proxy(proxies.Folder, _qti.app.rootFolder)
コード例 #44
0
def getMantidMatrix(name):
    """Get a handle to the named Mantid matrix"""
    return new_proxy(proxies.MantidMatrix, _qti.app.mantidUI.getMantidMatrix,
                     name)
コード例 #45
0
def plot3D(*args):
    if isinstance(args[0], str):
        return new_proxy(proxies.Graph3D, _qti.app.plot3D, *args)
    else:
        return new_proxy(proxies.Graph3D, _qti.app.plot3D,
                         args[0]._getHeldObject(), *args[1:])
コード例 #46
0
ファイル: __init__.py プロジェクト: mducle/mantid
def matrixToTable(matrix, conversionType=_qti.app.Direct):
    return new_proxy(proxies.MDIWindow, _qti.app.matrixToTable, matrix._getHeldObject(), conversionType)
コード例 #47
0
ファイル: __init__.py プロジェクト: mducle/mantid
def mergePlots(graph1, graph2):
    """Combine two graphs into a single plot"""
    return new_proxy(proxies.Graph, _qti.app.mantidUI.mergePlots, graph1._getHeldObject(), graph2._getHeldObject())
コード例 #48
0
ファイル: __init__.py プロジェクト: mducle/mantid
def plot3D(*args):
    if isinstance(args[0], str):
        return new_proxy(proxies.Graph3D, _qti.app.plot3D, *args)
    else:
        return new_proxy(proxies.Graph3D, _qti.app.plot3D, args[0]._getHeldObject(), *args[1:])
コード例 #49
0
ファイル: __init__.py プロジェクト: mducle/mantid
def activeFolder():
    """Get a handle to the currently active folder."""
    return new_proxy(proxies.Folder, _qti.app.activeFolder)
コード例 #50
0
ファイル: __init__.py プロジェクト: mducle/mantid
def rootFolder():
    """Get a handle to the top-level folder."""
    return new_proxy(proxies.Folder, _qti.app.rootFolder)
コード例 #51
0
def clone(window):
    return new_proxy(proxies.MDIWindow, _qti.app.clone,
                     window._getHeldObject())
コード例 #52
0
def tableToMatrix(table):
    return new_proxy(proxies.MDIWindow, _qti.app.tableToMatrix,
                     table._getHeldObject())
コード例 #53
0
def activeFolder():
    """Get a handle to the currently active folder."""
    return new_proxy(proxies.Folder, _qti.app.activeFolder)
コード例 #54
0
def newPlot3D():
    return new_proxy(proxies.Graph3D, _qti.app.newPlot3D)