Exemple #1
0
                article = "an"
            else:
                article = "a"
            raise ooferror.ErrUserError(
                "Script '%s' raised %s %s exception" %
                (filename, article, interp.error[0].__name__)
                # "Script '%s' raised %s %s exception: %s" %
                # (filename, article, interp.error[0].__name__, interp.error[1])
                )
        debug.fmsg('finished reading', filename)

_loadmenu.addItem(OOFMenuItem(
    'Script',
    callback=loadscript,
    params=[filenameparam.ReadFileNameParameter('filename', 'logfile',
                                                tip="Name of the file.",
                                                ident="load")],
    no_log=1,
    ellipsis=1,
    accel='l',
    help="Execute a Python script.",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/common/menu/loadscript.xml')
    ))

_startupmenu.addItem(OOFMenuItem(
    'Script',
    callback=loadscript,
    params=[filenameparam.ReadFileNameParameter('filename', 'logfile',
                                                tip="Name of the file.",
                                                ident="load")],
    no_log=1,
Exemple #2
0
        # data to be found by Python (and keeps a live reference to
        # it, so we don't have to transfer ownership to C++).  All of
        # this registration doesn't actually duplicate the data.
        orientmapplugin = mscontext.getObject().getPlugIn("OrientationMap")
        orientmapplugin.set_data(data, filename)
        orientmapplugin.timestamp.increment()
    finally:
        mscontext.end_writing()
        mscontext.cancel_reservation()
    reader.postProcess(mscontext)
    orientmapdata.orientationmapNotify(mscontext.getObject())


loadparams = [
    filenameparam.ReadFileNameParameter(
        'filename',
        tip="Name of the file containing the orientation map data."),
    parameter.RegisteredParameter('reader', orientmapdata.OrientMapReader),
    MicrostructureWithoutOrientMapParameter(
        'microstructure', tip='Add the orientation map to this Microstructure.')
    ]

mainmenu.OOF.File.Load.addItem(oofmenu.OOFMenuItem(
    'OrientationMap',
    callback=_loadOrientationMap,
    ordering=10,
    params=loadparams,
    help = "Load an orientation map into a Microstructure",
    discussion =xmlmenudump.loadFile('DISCUSSIONS/orientationmap/menu/load.xml')))

# OOF.OrientationMap.Load is the same as OOF.File.Load.OrientationMap
Exemple #3
0
        "Physical depth of image, or 'automatic'."))

###################################

if config.dimension() == 2:

    def loadImage(menuitem, filename, microstructure, height, width):
        if filename:
            # Read file and create an OOFImage object
            image = autoReadImage(filename, height, width, depth=0)
            loadImageIntoMS(image, microstructure)
            switchboard.notify("redraw")

    imageparams = parameter.ParameterGroup(
        filenameparam.ReadFileNameParameter('filename',
                                            'image',
                                            tip="Name of the image file."),
        whoville.WhoParameter('microstructure',
                              whoville.getClass('Microstructure'),
                              tip=parameter.emptyTipString))

elif config.dimension() == 3:

    def loadImage(menuitem, filenames, microstructure, height, width, depth):
        if filenames:
            # Read file and create an OOFImage3D object
            image = autoReadImage(filenames, height, width, depth)
            loadImageIntoMS(image, microstructure)
            switchboard.notify("redraw")

    imageparams = parameter.ParameterGroup(
Exemple #4
0
    gtklogger.replay(filename,
                     beginCB=activityViewer.openActivityViewer,
                     finishCB=logFinished,
                     debugLevel=dblevel,
                     threaded=thread_enable.query(),
                     exceptHook=loggererror,
                     checkpoints=checkpoints)


guidebugmenu.addItem(
    oofmenu.OOFMenuItem('Replay',
                        callback=loadLog,
                        params=[
                            filenameparam.ReadFileNameParameter(
                                'filename',
                                ident='guilog',
                                tip="Name of the file."),
                            parameter.BooleanParameter('checkpoints', True,
                                                       'obey checkpoints?')
                        ],
                        ellipsis=1,
                        help="Load a GUI log file"))

##############################


def rerecordLog(menuitem, filename, checkpoints, use_gui):
    if gtklogger.replaying():
        raise ooferror.ErrUserError(
            "Multiple GUI logs cannot be replayed simultaneously!")
    menuitem.root().setOption('post_hook', menucheckpoint)