コード例 #1
0
ファイル: gui.py プロジェクト: hushell/kod
class SimVizGUI(SimViz):
    def __init__(self, parent, layout=1):
        self.cwd = os.getcwd()
        self.p = Parameters(interface="GUI")
        self.parent = parent
        self.initialize()

        self.GUI = AutoSimVizGUI()

        if layout == 1:
            # only one column of input parameters:
            self.GUI.make_prmGUI(self.parent, self.p, sort_widgets=0, height=300, pane=0)
        else:
            # widgets sorted in columns:
            self.GUI.make_prmGUI(self.parent, self.p, sort_widgets=1, height=300, pane=1)
        help = """
Interface to a squeeze film solver
"""

        self.GUI.make_buttonGUI(
            self.parent, buttons=[("Simulate", self.simulate), ("Visualize", self.visualize)], logo=None, help=help
        )  # help=None to avoid help button

        self.accl, self.defm, self.load = self.GUI.make_curveplotGUI(self.parent, 3, placement="right")

    def visualize(self):
        self.GUI.load_curveplot("..SIMULATION.curve_3", self.accl, curvename="Acceleration")
        self.GUI.load_curveplot("..SIMULATION.curve_1", self.defm, curvename="Displacement")
        self.GUI.load_curveplot("..SIMULATION.curve_2", self.load, curvename="Pressure")
コード例 #2
0
ファイル: simviz1cpGUI_unit.py プロジェクト: RainW7/SamPy
class SimVizGUI(SimViz):
    def __init__(self, parent, layout='sort'):
        self.cwd = os.getcwd()        
        self.p = Parameters(interface='GUI')
        self.master = parent
        self.initialize()

        self.GUI = AutoSimVizGUI()

        if layout == 'sort':
            # widgets sorted in columns:
            self.GUI.make_prmGUI(self.master, self.p,
                                 sort_widgets=1,
                                 height=300, pane=1)
        else:
            # only one column of input parameters:
            self.GUI.make_prmGUI(self.master, self.p,
                                 sort_widgets=0,
                                 height=300, pane=0)

        help = """\
Simulate: run oscillator code for solving the
differential equation for the spring system.

Visualize: run Gnuplot to make plots in PNG and PostScript
format and on the screen (optional). Plots are stored
in the subdirectory with name equal to 'case'.
"""
        self.GUI.make_buttonGUI(self.master,
            buttons=[('Simulate', self.simulate),
                     ('Visualize', self.visualize)],
            logo=os.path.join(os.environ['scripting'],
                 'src','misc','figs','simviz2.xfig.t.gif'),
            help=None)
コード例 #3
0
ファイル: gui.py プロジェクト: EJHortala/books-2
class SimVizGUI(SimViz):
    def __init__(self, parent, layout=1):
        self.cwd = os.getcwd()
        self.p = Parameters(interface='GUI')
        self.parent = parent
        self.initialize()

        self.GUI = AutoSimVizGUI()

        if layout == 1:
            # only one column of input parameters:
            self.GUI.make_prmGUI(self.parent,
                                 self.p,
                                 sort_widgets=0,
                                 height=300,
                                 pane=0)
        else:
            # widgets sorted in columns:
            self.GUI.make_prmGUI(self.parent,
                                 self.p,
                                 sort_widgets=1,
                                 height=300,
                                 pane=1)
        help = '''
Interface to a squeeze film solver
'''

        self.GUI.make_buttonGUI(self.parent,
                                buttons=[('Simulate', self.simulate),
                                         ('Visualize', self.visualize)],
                                logo=None,
                                help=help)  # help=None to avoid help button

        self.accl, self.defm, self.load = \
                  self.GUI.make_curveplotGUI(self.parent, 3,
                                             placement='right')

    def visualize(self):
        self.GUI.load_curveplot('..SIMULATION.curve_3',
                                self.accl,
                                curvename='Acceleration')
        self.GUI.load_curveplot('..SIMULATION.curve_1',
                                self.defm,
                                curvename='Displacement')
        self.GUI.load_curveplot('..SIMULATION.curve_2',
                                self.load,
                                curvename='Pressure')