Ejemplo n.º 1
0
def ipcmakemenu(menu_base,ipcmenu_base):
    menu_base.clearSubMenu()
    ipcmenu_base.clearSubMenu()
    for r in analyze.DataOperation.registry:
        try:
            help = r.tip
        except KeyError:
            help = None
        new_item = oofmenu.OOFMenuItem(
            utils.space2underscore(r.name()),
            callback = _ops_callback,
            params = common_analysis_params + r.params,
            help=help,
            discussion=r.discussion)
        new_ipcitem=ipcmenu_base.addItem(
            oofmenu.OOFMenuItem(
            utils.space2underscore(r.name()),
            callback = _ipcops_callback,
            threadable = oofmenu.PARALLEL_THREADABLE,
            params = common_analysis_params + r.params)
            )
        new_ipcitem.data=r
        #Introduce new data member into new_item (data), corresponding to
        # the ipc item that is to be called in parallel
        new_item.ipcmenu=new_ipcitem
        new_item.data = r
        menu_base.addItem(new_item)
Ejemplo n.º 2
0
 def ipcmakemenu(menu_base,ipcmenu_base):
     menu_base.clearSubMenu()
     ipcmenu_base.clearSubMenu()
     for r in analyze.DataOperation.registry:
         try:
             help = r.tip
         except KeyError:
             help = None
         new_item = oofmenu.OOFMenuItem(
             utils.space2underscore(r.name()),
             callback = _ops_callback,
             params = common_analysis_params + r.params,
             help=help,
             discussion=r.discussion)
         new_ipcitem=ipcmenu_base.addItem(
             oofmenu.OOFMenuItem(
             utils.space2underscore(r.name()),
             callback = _ipcops_callback,
             threadable = oofmenu.PARALLEL_THREADABLE,
             params = common_analysis_params + r.params)
             )
         new_ipcitem.data=r
         # Introduce new data member into new_item (data),
         # corresponding to the ipc item that is to be called in
         # parallel
         new_item.ipcmenu=new_ipcitem
         new_item.data = r
         menu_base.addItem(new_item)
Ejemplo n.º 3
0
 def okCB(self, *args):
     modmethod = self.pinModFactory.getRegistration()
     if modmethod is not None:
         self.pinModFactory.set_defaults()
         menuitem = getattr(mainmenu.OOF.Skeleton.PinNodes,
                            utils.space2underscore(modmethod.name()))
         menuitem.callWithDefaults(skeleton=self.currentSkelName())
Ejemplo n.º 4
0
 def okbuttonCB(self, button):
     modmeth = self.activeareaModFactory.getRegistration()
     if modmeth is not None:
         self.activeareaModFactory.set_defaults()
         menuitem = getattr(mainmenu.OOF.ActiveArea,
                            utils.space2underscore(modmeth.name()))
         menuitem.callWithDefaults(microstructure=self.getCurrentMSName())
Ejemplo n.º 5
0
 def __init__(self,
              name,
              ordering,
              parentClass=None,
              instanceClass=WhoDoUndo,
              proxyClasses=[],
              secret=0):
     WhoClass.__init__(self,
                       name,
                       ordering,
                       parentClass=parentClass,
                       instanceClass=instanceClass,
                       proxyClasses=proxyClasses,
                       secret=secret)
     self.historysize = historysize
     mainmenu.bufsizemenu.addItem(
         oofmenu.OOFMenuItem(
             utils.space2underscore(name),
             callback=self.setUndoBufferSize,
             # TODO 3.1: Disallow size=0.
             params=[
                 parameter.IntParameter(
                     'size',
                     historysize,
                     tip='number of previous versions to preserve')
             ],
             help="Set the history buffer size for %ss" % name,
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/common/menu/bufsize.xml',
                 lambda text, obj: text.replace('CLASS', name))))
Ejemplo n.º 6
0
 def okCB(self, *args):
     modmethod = self.pinModFactory.getRegistration()
     if modmethod is not None:
         self.pinModFactory.set_defaults()
         menuitem = getattr(mainmenu.OOF.Skeleton.PinNodes,
                            utils.space2underscore(modmethod.name()))
         menuitem.callWithDefaults(skeleton=self.currentSkelName())
Ejemplo n.º 7
0
 def okbuttonCB(self, button):
     modmeth = self.activeareaModFactory.getRegistration()
     if modmeth is not None:
         self.activeareaModFactory.set_defaults()
         menuitem = getattr(mainmenu.OOF.ActiveArea,
                            utils.space2underscore(modmeth.name()))
         menuitem.callWithDefaults(microstructure=self.getCurrentMSName())
Ejemplo n.º 8
0
    def okCB(self, gtkobj):
        mod = self.activemode().factory.getRegistration()
        if mod is not None:
            self.activemode().factory.set_defaults()
            menuitem = getattr(self.activemode().getSelectionMenu(),
                               utils.space2underscore(mod.name()) )
            skelpath = self.parent.getCurrentSkeletonName()

            # Set the skeleton parameter and call the registered class.
            menuitem.callWithDefaults(skeleton=skelpath)
Ejemplo n.º 9
0
def buildSelectionModMenu():
    selmodmenu.clearMenu()
    selmodmenu.addItem(oofmenu.OOFMenuItem(
        'Undo',
        params=[whoville.WhoParameter('microstructure',
                                      microstructure.microStructures,
                                      tip=parameter.emptyTipString)],
        callback=pixelselectionmod.undo,
        help="Undo the latest selection.",
        discussion=xmlmenudump.loadFile('DISCUSSIONS/common/menu/undo_pixsel.xml')
        ))
    
    selmodmenu.addItem(oofmenu.OOFMenuItem(
        'Redo',
        params=[whoville.WhoParameter('microstructure',
                                      microstructure.microStructures,
                                      tip=parameter.emptyTipString)],
        callback=pixelselectionmod.redo,
        help="Redo the latest undone selection.",
        discussion=xmlmenudump.loadFile('DISCUSSIONS/common/menu/redo_pixsel.xml')
        ))

    selmodmenu.addItem(oofmenu.OOFMenuItem(
        'Clear',
        params=[whoville.WhoParameter('microstructure',
                                      microstructure.microStructures,
                                      tip=parameter.emptyTipString)],
        callback=pixelselectionmod.clear,
        help="Clear the current selection.",
        discussion="<para>Clear the current selection.</para>"))
    
    for registration in pixelselectionmod.SelectionModifier.registry:
        # Help string
        try:
            help = registration.tip
        except AttributeError:
            help = None
        # Discussion
        try:
            discussion = registration.discussion
        except AttributeError:
            discussion = None
        menuitem = selmodmenu.addItem(
            oofmenu.OOFMenuItem(utils.space2underscore(registration.name()),
                                callback=pixelselectionmod.doSelectionMod,
                                threadable=oofmenu.THREADABLE,
                                params=[
            whoville.WhoParameter('microstructure',
                                  microstructure.microStructures,
                                  tip=parameter.emptyTipString)
            ]+registration.params,
                                help=help,
                                discussion=discussion))
        menuitem.data = registration
Ejemplo n.º 10
0
 def __init__(self, subject, ordering, lessons):
     self.subject = subject
     self.lessons = lessons
     self.ordering = ordering
     menuitem = tutorialMenu.addItem(
         oofmenu.OOFMenuItem(utils.space2underscore(subject),
                             ordering=ordering,
                             gui_callback=startTutorial,
                             threadable=oofmenu.UNTHREADABLE))
     menuitem.data = self
     allTutorials[subject] = self
Ejemplo n.º 11
0
 def __init__(self, subject, ordering, lessons):
     self.subject = subject
     self.lessons = lessons
     self.ordering = ordering
     menuitem = tutorialMenu.addItem(
         oofmenu.OOFMenuItem(utils.space2underscore(subject),
                             ordering=ordering,
                             gui_callback=startTutorial,
                             threadable=oofmenu.UNTHREADABLE))
     menuitem.data = self
     allTutorials[subject] = self
Ejemplo n.º 12
0
 def okbuttonCB(self, *args):
     # Actually perform the current selection modification operation.
     modmeth = self.selectionModFactory.getRegistration()
     if modmeth is not None:
         # Copy parameters from widgets to the registration.
         self.selectionModFactory.set_defaults()
         # Invoke the method by calling the corresponding menu
         # item.  The menu item and method registration share a
         # parameter list.
         menuitem = getattr(mainmenu.OOF.PixelSelection,
                            utils.space2underscore(modmeth.name()))
         menuitem.callWithDefaults(microstructure=self.getCurrentMSName())
Ejemplo n.º 13
0
    def go_buttonCB(self, gtkobj):
        op_reg = self.op_obj.get_value()
        regname = op_reg.getRegistration().name()
        menuitem = analyzemenu.ops_menu.getItem(
            utils.space2underscore(regname))

        menuitem.callWithDefaults(mesh=self.meshwidget.get_value(),
                                  time=self.timeWidget.get_value(),
                                  data=self.output_obj.get_value(),
                                  domain=self.domain_obj.get_value(),
                                  sampling=self.sample_obj.get_value(),
                                  destination=self.destwidget.get_value())
Ejemplo n.º 14
0
 def okbuttonCB(self, *args):
     # Actually perform the current selection modification operation.
     modmeth = self.selectionModFactory.getRegistration()
     if modmeth is not None:
         # Copy parameters from widgets to the registration.
         self.selectionModFactory.set_defaults()
         # Invoke the method by calling the corresponding menu
         # item.  The menu item and method registration share a
         # parameter list.
         menuitem = getattr(mainmenu.OOF.PixelSelection,
                            utils.space2underscore(modmeth.name()))
         menuitem.callWithDefaults(microstructure=self.getCurrentMSName())
Ejemplo n.º 15
0
    def go_buttonCB(self, gtkobj):
        op_reg = self.op_obj.get_value()
        regname = op_reg.getRegistration().name()
        menuitem = analyzemenu.ops_menu.getItem(
            utils.space2underscore(regname))

        menuitem.callWithDefaults(mesh=self.meshwidget.get_value(),
                                  time=self.timeWidget.get_value(),
                                  data=self.output_obj.get_value(),
                                  domain=self.domain_obj.get_value(),
                                  sampling=self.sample_obj.get_value(),
                                  destination=self.destwidget.get_value())
Ejemplo n.º 16
0
 def __init__(self, name, ordering, parentClass=None,
              instanceClass=WhoDoUndo, proxyClasses=[], secret=0):
     WhoClass.__init__(self, name, ordering, parentClass=parentClass,
                       instanceClass=instanceClass,
                       proxyClasses=proxyClasses, secret=secret)
     self.historysize = historysize
     mainmenu.bufsizemenu.addItem(oofmenu.OOFMenuItem(
         utils.space2underscore(name),
         callback=self.setUndoBufferSize,
         # TODO: Disallow size=0.
         params=[parameter.IntParameter('size', historysize,
                                        tip='number of previous versions to preserve')],
         help="Set the history buffer size for %ss" % name,
         discussion=xmlmenudump.loadFile(
            'DISCUSSIONS/common/menu/bufsize.xml',
            lambda text,obj: text.replace('CLASS', name))
         ))
Ejemplo n.º 17
0
def makemenu(menu_base):
    menu_base.clearSubMenu()
    for r in analyze.DataOperation.registry:
        help = getattr(r, "tip", None)
        new_item = oofmenu.OOFMenuItem(
            utils.space2underscore(r.name()),
            callback = _ops_callback,
            params = common_analysis_params + r.params,
            help=help,
            discussion=r.discussion)
        new_item.data = r
        menu_base.addItem(new_item)
    ops_menu.addItem(oofmenu.OOFMenuItem(
        'Rewind',
        callback=_rewind,
        params=[filenameparam.FileNameParameter(
                'filename',
                tip='The name of the output file.')],
        help="Overwrite the data currently in an output file.",
        discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/rewind.xml')
        ))
Ejemplo n.º 18
0
def makemenu(menu_base):
    menu_base.clearSubMenu()
    for r in analyze.DataOperation.registry:
        help = getattr(r, "tip", None)
        new_item = oofmenu.OOFMenuItem(
            utils.space2underscore(r.name()),
            callback = _ops_callback,
            params = common_analysis_params + r.params,
            help=help,
            discussion=r.discussion)
        new_item.data = r
        menu_base.addItem(new_item)
    ops_menu.addItem(oofmenu.OOFMenuItem(
        'Rewind',
        callback=_rewind,
        params=[filenameparam.FileNameParameter(
                'filename',
                tip='The name of the output file.')],
        help="Overwrite the data currently in an output file.",
        discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/rewind.xml')
        ))
Ejemplo n.º 19
0
def makeMenu(menu, modifier, selection_name):
    menu.clearMenu()

    objname = selection_name[:-9]       # 'node', 'segment', or 'element'

    undo_item = menu.addItem(oofmenu.OOFMenuItem(
        "Undo", callback=_undo,
        params = [
        whoville.WhoParameter("skeleton",
                              whoville.getClass('Skeleton'),
                              tip=parameter.emptyTipString)],
        help="Undo the latest Skeleton %s selection operation." % objname,
        discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/%s_undo.xml'
                                        % objname)
        ))
    undo_item.data = selection_name

    redo_item = menu.addItem(oofmenu.OOFMenuItem(
        "Redo", callback=_redo,
              params = [
        whoville.WhoParameter("skeleton",
                              whoville.getClass('Skeleton'),
                              tip=parameter.emptyTipString)],
        help="Redo the latest undone Skeleton %s selection operation."\
        % objname,
        discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/%s_redo.xml'
                                        % objname)
        ))
    redo_item.data = selection_name

    clear_item = menu.addItem(oofmenu.OOFMenuItem(
        "Clear", callback=_clear,
        params = [
        whoville.WhoParameter("skeleton",
                              whoville.getClass('Skeleton'),
                              tip=parameter.emptyTipString)],
        help="Clear the current Skeleton %s selection." % objname,
        discussion="<para>Unselect all %ss in the &skel;.</para>" % objname))
    clear_item.data = selection_name

    invert_item = menu.addItem(oofmenu.OOFMenuItem(
        "Invert",
        callback=_invert,
        params = [
        whoville.WhoParameter("skeleton",
                              whoville.getClass('Skeleton'),
                              tip=parameter.emptyTipString)],
        help="Invert the current Skeleton %s selection." % objname,
        discussion="""<para>
        Select the unselected %ss, and unselect the selected %ss in the &skel;.
        </para>""" % (objname, objname)))
    invert_item.data = selection_name    
        
    for r in modifier.registry:
        # For help
        try:
            help = r.tip
        except AttributeError:
            help = None
        # For discussion
        try:
            discussion = r.discussion
        except AttributeError:
            discussion = None
        menuitem = menu.addItem(
            oofmenu.OOFMenuItem(utils.space2underscore(r.name()),
                                callback = skeletonselectionmod.modify,
                                params = [
            whoville.WhoParameter("skeleton",
                                  whoville.getClass('Skeleton'),
                                  tip=parameter.emptyTipString)] +
                                r.params,
                                help=help,
                                discussion=discussion))
        menuitem.data = r
Ejemplo n.º 20
0
def makeMenu():
    pinnodesmenu.clearMenu()

    pinnodesmenu.addItem(
        oofmenu.OOFMenuItem('Undo',
                            callback=pinnodesmodifier.undo,
                            params=[
                                whoville.WhoParameter(
                                    'skeleton',
                                    skeletoncontext.skeletonContexts,
                                    tip=parameter.emptyTipString)
                            ],
                            help="Undo the pinning operation.",
                            discussion=xmlmenudump.loadFile(
                                'DISCUSSIONS/engine/menu/pinnodes_undo.xml')))

    pinnodesmenu.addItem(
        oofmenu.OOFMenuItem('Redo',
                            callback=pinnodesmodifier.redo,
                            params=[
                                whoville.WhoParameter(
                                    'skeleton',
                                    skeletoncontext.skeletonContexts,
                                    tip=parameter.emptyTipString)
                            ],
                            help="Undo the undone pinning operation.",
                            discussion=xmlmenudump.loadFile(
                                'DISCUSSIONS/engine/menu/pinnodes_redo.xml')))

    pinnodesmenu.addItem(
        oofmenu.OOFMenuItem('UnPinAll',
                            callback=pinnodesmodifier.unpinall,
                            params=[
                                whoville.WhoParameter(
                                    'skeleton',
                                    skeletoncontext.skeletonContexts,
                                    tip=parameter.emptyTipString)
                            ],
                            help="Unpin all nodes of the Skeleton.",
                            discussion="""<para>
        Unpin all of the <link
        linkend='MenuItem-OOF.Skeleton.PinNodes'>pinned</link> &nodes;
        in the given &skel;.
        </para>"""))

    pinnodesmenu.addItem(
        oofmenu.OOFMenuItem('Invert',
                            callback=pinnodesmodifier.invert,
                            params=[
                                whoville.WhoParameter(
                                    'skeleton',
                                    skeletoncontext.skeletonContexts,
                                    tip=parameter.emptyTipString)
                            ],
                            help="Pin the unpinned and unpin the pinned.",
                            discussion="""<para>
        Invert the status of <link
        linkend='MenuItem-OOF.Skeleton.PinNodes'>pinned</link> &nodes;
        in the given &skel;. Pinned &nodes; will be released and free
        nodes will be pinned.
        </para>"""))

    for registration in pinnodesmodifier.PinNodesModifier.registry:
        try:
            help = registration.tip
        except AttributeError:
            help = None
        try:
            discussion = registration.discussion
        except AttributeError:
            discussion = None
        menuitem = pinnodesmenu.addItem(
            oofmenu.OOFMenuItem(
                utils.space2underscore(registration.name()),
                callback=pinnodesmodifier.pinnodesmod,
                params=[
                    whoville.WhoParameter('skeleton',
                                          skeletoncontext.skeletonContexts,
                                          tip=parameter.emptyTipString)
                ] + registration.params,
                help=help,
                discussion=discussion))
        menuitem.data = registration
Ejemplo n.º 21
0
def makeMenu():
    pinnodesmenu.clearMenu()

    pinnodesmenu.addItem(oofmenu.OOFMenuItem(
        'Undo',
        callback=pinnodesmodifier._undo,
        params=[whoville.WhoParameter('skeleton',
                                      skeletoncontext.skeletonContexts,
                                      tip=parameter.emptyTipString)],
        help="Undo the pinning operation.",
        discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/pinnodes_undo.xml')
        ))
    
    pinnodesmenu.addItem(oofmenu.OOFMenuItem(
        'Redo',
        callback=pinnodesmodifier._redo,
        params=[whoville.WhoParameter('skeleton',
                                      skeletoncontext.skeletonContexts,
                                      tip=parameter.emptyTipString)],
        help="Undo the undone pinning operation.",
        discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/pinnodes_redo.xml')
        ))
        
    pinnodesmenu.addItem(oofmenu.OOFMenuItem(
        'UnpinAll',
        callback=pinnodesmodifier._unpinall,
        params=[whoville.WhoParameter('skeleton',
                                      skeletoncontext.skeletonContexts,
                                      tip=parameter.emptyTipString)],
        help="Unpin all nodes of the Skeleton.",
        discussion="""<para>
        Unpin all of the <link
        linkend='MenuItem-OOF.Skeleton.PinNodes'>pinned</link> &nodes;
        in the given &skel;.
        </para>"""
        ))
    
    pinnodesmenu.addItem(oofmenu.OOFMenuItem(
        'Invert',
        callback=pinnodesmodifier._invert,
        params=[whoville.WhoParameter('skeleton',
                                      skeletoncontext.skeletonContexts,
                                      tip=parameter.emptyTipString)],
        help="Pin the unpinned and unpin the pinned.",
        discussion="""<para>
        Invert the status of <link
        linkend='MenuItem-OOF.Skeleton.PinNodes'>pinned</link> &nodes;
        in the given &skel;. Pinned &nodes; will be released and free
        nodes will be pinned.
        </para>"""))

    for registration in pinnodesmodifier.PinNodesModifier.registry:
        try:
            help = registration.tip
        except AttributeError:
            help = None
        try:
            discussion = registration.discussion
        except AttributeError:
            discussion = None
        menuitem = pinnodesmenu.addItem(
            oofmenu.OOFMenuItem(
            utils.space2underscore(registration.name()),
            callback=pinnodesmodifier.pinnodesmod,
            params=[whoville.WhoParameter('skeleton',
                                          skeletoncontext.skeletonContexts,
                                          tip=parameter.emptyTipString)]
            +registration.params,
            help=help,
            discussion=discussion))
        menuitem.data = registration
Ejemplo n.º 22
0
def buildActiveAreaModMenu():
    aamodmenu.clearMenu()
                                                                                
    aamodmenu.addItem(oofmenu.OOFMenuItem(
        'Undo',
        callback=_undo,
        params=[whoville.WhoParameter('microstructure',
                                      ooflib.common.microstructure.microStructures,
                                      tip=parameter.emptyTipString)
                ],
        help="Undo the latest active area modification.",
        discussion="""<para>
        Revert to the previous &active; in the given
        &micro;.</para>"""
        ))
                                                                                
    aamodmenu.addItem(oofmenu.OOFMenuItem(
        'Redo',
        callback=_redo,
        params=[whoville.WhoParameter('microstructure',
                                      ooflib.common.microstructure.microStructures,
                                      tip=parameter.emptyTipString)
                ],
        help="Redo the latest undone active area modification.",
        discussion="""<para>
        Undo the latest <xref linkend='MenuItem-OOF.ActiveArea.Undo'/>.
        </para>"""))

    aamodmenu.addItem(oofmenu.OOFMenuItem(
        'Override',
        params=[parameter.BooleanParameter('override', 0,
                                           tip="Whether to override or not."),
                whoville.WhoParameter('microstructure',
                                      ooflib.common.microstructure.microStructures,
                                      tip=parameter.emptyTipString)
                ],
        callback=_override,
        help="Temporarily activate the entire Microstructure.",
        discussion=xmlmenudump.loadFile('DISCUSSIONS/common/menu/activearea_override.xml')))

    aamodmenu.addItem(oofmenu.OOFMenuItem(
        'Store',
        callback=_store,
        params=parameter.ParameterGroup(
        whoville.WhoParameter('microstructure',
                              ooflib.common.microstructure.microStructures,
                              tip=parameter.emptyTipString),
        parameter.AutomaticNameParameter('name', value=automatic.automatic,
                                         resolver=activeAreaNameResolver,
                                         tip = "The name of the active are to be stored")),
        help="Store the current active area.",
        discussion="""<para>

        Give the current &active; a <varname>name</varname>, and store
        it for future use.  This makes it easy to switch between
        different active regions of a &micro;.  If the given
        <varname>name</varname> is already being used for another
        &active; in the same &micro;, then
        <userinput>&lt;x&gt;</userinput> will be appended to it, where
        <userinput>x</userinput> is an integer chosen to make the name
        unique.

        </para>"""))

    aamodmenu.addItem(oofmenu.OOFMenuItem(
        'Restore',
        callback=_restore,
        params=[whoville.WhoParameter('microstructure',
                                      ooflib.common.microstructure.microStructures,
                                      tip=parameter.emptyTipString),
                parameter.StringParameter('name', tip="The name of the active area to be restored.")],
        help="Restore a named active area.",
        discussion="""<para>
        Set the current &active; to the given <link
        linkend='MenuItem-OOF.ActiveArea.Store'>stored</link>
        &active;.
        </para>"""))
    
    aamodmenu.addItem(oofmenu.OOFMenuItem(
        'Rename',
        callback=_rename,
        params=[
        whoville.WhoParameter('microstructure',
                              ooflib.common.microstructure.microStructures,
                              tip=parameter.emptyTipString),
        parameter.StringParameter('oldname',
                                  tip="The name of a stored active area."),
        parameter.StringParameter('newname', '',
                                  tip='A new name for the active area.')
        ],
        help="Rename the stored active area.",
        discussion="<para>Assign a new name to a stored active area.</para>"))
    
    aamodmenu.addItem(oofmenu.OOFMenuItem(
        'Delete',
        callback=_delete,
        params=[
        whoville.WhoParameter('microstructure',
                              ooflib.common.microstructure.microStructures,
                              tip=parameter.emptyTipString),
        parameter.StringParameter('name', tip="The name of the active area to be deleted.")],
        help="Delete a stored active area.",
        discussion="""<para>
        Delete a <link
        linkend='MenuItem-OOF.ActiveArea.Store'>stored</link> active
        area.  This only deletes the stored copy of the active area.
        It does not affect the activity of any pixels.
        </para>"""))
    
                           
                                                                                
    for registration in activeareamod.ActiveAreaModifier.registry:
        # registration tip string => menuitem help string
        try:
            help = registration.tip
        except AttributeError:
            help = None
        # registration discussion => menuitem discussion
        try:
            discussion = registration.discussion
        except AttributeError:
            discussion = None
        menuitem = aamodmenu.addItem(
            oofmenu.OOFMenuItem(utils.space2underscore(registration.name()),
                                callback=activeareamod.modify,
                                params=[
            whoville.WhoParameter('microstructure',
                                  ooflib.common.microstructure.microStructures,
                                  tip=parameter.emptyTipString)
            ] + registration.params,
                                help=help,
                                discussion=discussion))
        menuitem.data = registration
Ejemplo n.º 23
0
def buildSelectionModMenu():
    selmodmenu.clearMenu()
    selmodmenu.addItem(
        oofmenu.OOFMenuItem('Undo',
                            params=[
                                whoville.WhoParameter(
                                    'microstructure',
                                    microstructure.microStructures,
                                    tip=parameter.emptyTipString)
                            ],
                            callback=pixelselectionmod.undo,
                            help="Undo the latest selection.",
                            discussion=xmlmenudump.loadFile(
                                'DISCUSSIONS/common/menu/undo_pixsel.xml')))

    selmodmenu.addItem(
        oofmenu.OOFMenuItem('Redo',
                            params=[
                                whoville.WhoParameter(
                                    'microstructure',
                                    microstructure.microStructures,
                                    tip=parameter.emptyTipString)
                            ],
                            callback=pixelselectionmod.redo,
                            help="Redo the latest undone selection.",
                            discussion=xmlmenudump.loadFile(
                                'DISCUSSIONS/common/menu/redo_pixsel.xml')))

    selmodmenu.addItem(
        oofmenu.OOFMenuItem(
            'Clear',
            params=[
                whoville.WhoParameter('microstructure',
                                      microstructure.microStructures,
                                      tip=parameter.emptyTipString)
            ],
            callback=pixelselectionmod.clear,
            help="Clear the current selection.",
            discussion="<para>Clear the current selection.</para>"))

    for registration in pixelselectionmod.SelectionModifier.registry:
        # Help string
        try:
            help = registration.tip
        except AttributeError:
            help = None
        # Discussion
        try:
            discussion = registration.discussion
        except AttributeError:
            discussion = None
        menuitem = selmodmenu.addItem(
            oofmenu.OOFMenuItem(
                utils.space2underscore(registration.name()),
                callback=pixelselectionmod.doSelectionMod,
                threadable=oofmenu.THREADABLE,
                params=[
                    whoville.WhoParameter('microstructure',
                                          microstructure.microStructures,
                                          tip=parameter.emptyTipString)
                ] + registration.params,
                help=help,
                discussion=discussion))
        menuitem.data = registration
Ejemplo n.º 24
0
def makeMenu(menu, modifier, selection_name):
    menu.clearMenu()

    objname = selection_name[:-9]  # 'node', 'segment', or 'element'

    undo_item = menu.addItem(
        oofmenu.OOFMenuItem(
            "Undo",
            callback=_undo,
            params=[
                whoville.WhoParameter("skeleton",
                                      whoville.getClass('Skeleton'),
                                      tip=parameter.emptyTipString)
            ],
            help="Undo the latest Skeleton %s selection operation." % objname,
            discussion=xmlmenudump.loadFile(
                'DISCUSSIONS/engine/menu/%s_undo.xml' % objname)))
    undo_item.data = selection_name

    redo_item = menu.addItem(oofmenu.OOFMenuItem(
        "Redo", callback=_redo,
              params = [
        whoville.WhoParameter("skeleton",
                              whoville.getClass('Skeleton'),
                              tip=parameter.emptyTipString)],
        help="Redo the latest undone Skeleton %s selection operation."\
        % objname,
        discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/%s_redo.xml'
                                        % objname)
        ))
    redo_item.data = selection_name

    clear_item = menu.addItem(
        oofmenu.OOFMenuItem(
            "Clear",
            callback=_clear,
            params=[
                whoville.WhoParameter("skeleton",
                                      whoville.getClass('Skeleton'),
                                      tip=parameter.emptyTipString)
            ],
            help="Clear the current Skeleton %s selection." % objname,
            discussion="<para>Unselect all %ss in the &skel;.</para>" %
            objname))
    clear_item.data = selection_name

    invert_item = menu.addItem(
        oofmenu.OOFMenuItem(
            "Invert",
            callback=_invert,
            params=[
                whoville.WhoParameter("skeleton",
                                      whoville.getClass('Skeleton'),
                                      tip=parameter.emptyTipString)
            ],
            help="Invert the current Skeleton %s selection." % objname,
            discussion="""<para>
        Select the unselected %ss, and unselect the selected %ss in the &skel;.
        </para>""" % (objname, objname)))
    invert_item.data = selection_name

    for r in modifier.registry:
        # For help
        try:
            help = r.tip
        except AttributeError:
            help = None
        # For discussion
        try:
            discussion = r.discussion
        except AttributeError:
            discussion = None
        menuitem = menu.addItem(
            oofmenu.OOFMenuItem(
                utils.space2underscore(r.name()),
                callback=skeletonselectionmod.modify,
                params=[
                    whoville.WhoParameter("skeleton",
                                          whoville.getClass('Skeleton'),
                                          tip=parameter.emptyTipString)
                ] + r.params,
                help=help,
                discussion=discussion))
        menuitem.data = r