예제 #1
0
 def csrenameCB(self, gtkobj):
     meshobj = self.toolbox.current_mesh
     csname = meshobj.selectedCSName()
     menuitem = meshmenu.csmenu.Rename
     newnameparam = menuitem.get_arg('name')
     newnameparam.value = csname
     if parameterwidgets.getParameterValues(
         newnameparam, title="Rename cross section " + csname):
         menuitem.callWithDefaults(mesh=meshobj.path(), cross_section=csname)
예제 #2
0
 def csrenameCB(self, gtkobj):
     meshobj = self.toolbox.current_mesh
     csname = meshobj.selectedCSName()
     menuitem = meshmenu.csmenu.Rename
     newnameparam = menuitem.get_arg('name')
     newnameparam.value = csname
     if parameterwidgets.getParameterValues(
         newnameparam, title="Rename cross section " + csname):
         menuitem.callWithDefaults(mesh=meshobj.path(), cross_section=csname)
예제 #3
0
 def cseditCB(self, gtkobj):
     meshobj = self.toolbox.current_mesh
     csname = meshobj.selectedCSName()
     menuitem = meshmenu.csmenu.Edit
     csparam = menuitem.get_arg('cross_section')
     csparam.value = meshobj.selectedCS()
     if parameterwidgets.getParameterValues(csparam,
                                            title='Edit cross section ' +
                                            csname):
         menuitem.callWithDefaults(mesh=meshobj.path(), name=csname)
예제 #4
0
 def cseditCB(self, gtkobj):
     meshobj = self.toolbox.current_mesh
     csname = meshobj.selectedCSName()
     menuitem = meshmenu.csmenu.Edit
     csparam = menuitem.get_arg('cross_section')
     csparam.value = meshobj.selectedCS()
     if parameterwidgets.getParameterValues(
         csparam,
         title='Edit cross section ' + csname):
         menuitem.callWithDefaults(mesh=meshobj.path(), name=csname)
예제 #5
0
    def fieldinitbuttonCB(self, *args): # gtk callback, initialize field
        fld, bc = self.selectedFieldOrBC()
        if fld is not None:
            menuitem = meshmenu.Set_Field_Initializer
            # We can't simply use
            # parameter.getParameters(menuitem.get_arg('initializer'))
            # here, because the menu item's parameter accepts members
            # of the FieldInit base class, but we need to create a
            # widget for the appropriate derived class
            # (ScalarFieldInit, et al).  It's the derived classes that
            # are the registered classes.
            param = parameter.RegisteredParameter(
                'initializer', fieldinit.fieldInitDict[fld.classname()])

            # Set the parameter value to the current initializer of
            # the appropriate field in the current mesh (context) --
            # this is the value that the initializer widget will start
            # with.  If it doesn't get set here, it will just have the
            # most recently-set one, which may be for a different
            # mesh.
            param.value = self.currentMeshContext().get_initializer(fld)

            init = parameterwidgets.getParameterValues(
                param, title = 'Initialize field ' + fld.name(), scope=self)

            if init is not None:
                menuitem.callWithDefaults(mesh=self.currentFullMeshName(),
                                          field=fld,
                                          initializer=init[0])
        if bc is not None:
            menuitem = meshmenu.Boundary_Conditions.Set_BC_Initializer
            iparam = menuitem.get_arg('initializer')
            iparam.set(bc.get_initializer())
            bcparam = menuitem.get_arg('bc')
            bcparam.set(bc.name())
            # Make a bc parameter widget and put it in the local
            # widgetscope so that the initializer RCF can find it.
            bcwidget = bcparam.makeWidget()
            self.addWidget(bcwidget)
            if parameterwidgets.getParameters(
                iparam,
                scope=self,
                title='Initialize BC ' + bc.name()):
                menuitem.callWithDefaults(mesh=self.currentFullMeshName())
            self.removeWidget(bcwidget)
            bcwidget.destroy()
예제 #6
0
    def fieldinitbuttonCB(self, *args): # gtk callback, initialize field
        fld, bc = self.selectedFieldOrBC()
        if fld is not None:
            menuitem = meshmenu.Set_Field_Initializer
            # We can't simply use
            # parameter.getParameters(menuitem.get_arg('initializer'))
            # here, because the menu item's parameter accepts members
            # of the FieldInit base class, but we need to create a
            # widget for the appropriate derived class
            # (ScalarFieldInit, et al).  It's the derived classes that
            # are the registered classes.
            param = parameter.RegisteredParameter(
                'initializer', fieldinit.fieldInitDict[fld.classname()])

            # Set the parameter value to the current initializer of
            # the appropriate field in the current mesh (context) --
            # this is the value that the initializer widget will start
            # with.  If it doesn't get set here, it will just have the
            # most recently-set one, which may be for a different
            # mesh.
            param.value = self.currentMeshContext().get_initializer(fld)

            init = parameterwidgets.getParameterValues(
                param, title = 'Initialize field ' + fld.name(), scope=self)

            if init is not None:
                menuitem.callWithDefaults(mesh=self.currentFullMeshName(),
                                          field=fld,
                                          initializer=init[0])
        if bc is not None:
            menuitem = meshmenu.Boundary_Conditions.Set_BC_Initializer
            iparam = menuitem.get_arg('initializer')
            iparam.set(bc.get_initializer())
            bcparam = menuitem.get_arg('bc')
            bcparam.set(bc.name())
            # Make a bc parameter widget and put it in the local
            # widgetscope so that the initializer RCF can find it.
            bcwidget = bcparam.makeWidget()
            self.addWidget(bcwidget)
            if parameterwidgets.getParameters(
                iparam,
                scope=self,
                title='Initialize BC ' + bc.name()):
                menuitem.callWithDefaults(mesh=self.currentFullMeshName())
            self.removeWidget(bcwidget)
            bcwidget.destroy()