Ejemplo n.º 1
0
def main():
    # kills the program when you hit Cntl+C from the command line
    # doesn't save the current state as presumably there's been an error
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)


    import sys
    # Someone is launching this directly
    # Create the QApplication
    app = QApplication(sys.argv)
    #The Main window
    #g = GeometryHandle()
    #g.add('main', color=(0, 0, 0), line_thickness=0.0)
    #g.get_grid('name')
    #g.set_color('name')
    #g.set_grid('name')
    #g.set_grid('name')
    parent = app
    red = (255, 0, 0)
    blue = (0, 0, 255)
    green = (0, 255, 0)
    purple = (255, 0, 255)
    d = {
        'caero1' : AltGeometry(parent, 'caero', color=green, line_width=3, opacity=0.2),
        'caero2' : AltGeometry(parent, 'caero', color=purple, line_width=4, opacity=0.3),
        'caero' : AltGeometry(parent, 'caero', color=blue, line_width=2, opacity=0.1, bar_scale=1.0),
        'main' : AltGeometry(parent, 'main', color=red, line_width=1, opacity=0.0, bar_scale=1.0),
    }
    main_window = EditGeometryProperties(d, win_parent=None)
    main_window.show()
    # Enter the main loop
    app.exec_()
Ejemplo n.º 2
0
    def duplicate_alternate_vtk_grid(self,
                                     name,
                                     name_duplicate_from,
                                     color=None,
                                     line_width=5,
                                     opacity=1.0,
                                     point_size=1,
                                     bar_scale=0.0,
                                     is_visible=True,
                                     follower_nodes=None,
                                     is_pickable=False):
        """Fake copies the VTK actor"""
        if name_duplicate_from == 'main':
            grid_copy_from = self.grid
            representation = 'toggle'
        else:
            grid_copy_from = self.alt_grids[name_duplicate_from]
            props = self.geometry_properties[name_duplicate_from]
            representation = props.representation

        self.alt_grids[name] = Grid()
        geom = AltGeometry(self,
                           name,
                           color=color,
                           line_width=line_width,
                           point_size=point_size,
                           bar_scale=bar_scale,
                           opacity=opacity,
                           representation=representation,
                           is_visible=is_visible,
                           is_pickable=is_pickable)
        self.geometry_properties[name] = geom
        if follower_nodes is not None:
            self.follower_nodes[name] = follower_nodes
Ejemplo n.º 3
0
 def create_alternate_vtk_grid(self,
                               name,
                               color=None,
                               line_width=None,
                               opacity=None,
                               point_size=None,
                               bar_scale=None,
                               representation=None,
                               is_visible=True,
                               follower_nodes=None,
                               is_pickable=False):
     """Fake creates an AltGeometry object"""
     self.alt_grids[name] = Grid()
     geom = AltGeometry(self,
                        name,
                        color=color,
                        line_width=line_width,
                        point_size=point_size,
                        bar_scale=bar_scale,
                        opacity=opacity,
                        representation=representation,
                        is_visible=is_visible,
                        is_pickable=is_pickable)
     self.geometry_properties[name] = geom
     if follower_nodes is not None:
         self.follower_nodes[name] = follower_nodes
Ejemplo n.º 4
0
def main():  # pragma: no cover
    """gui independent way to test the program"""
    # kills the program when you hit Cntl+C from the command line
    # doesn't save the current state as presumably there's been an error
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    import sys
    # Someone is launching this directly
    # Create the QApplication
    app = QApplication(sys.argv)
    parent = app
    red = (255, 0, 0)
    blue = (0, 0, 255)
    green = (0, 255, 0)
    purple = (255, 0, 255)
    d = {
        'font_size':
        8,
        'caero1':
        AltGeometry(parent, 'caero', color=green, line_width=3, opacity=0.2),
        'caero2':
        AltGeometry(parent, 'caero', color=purple, line_width=4, opacity=0.3),
        'caero':
        AltGeometry(parent,
                    'caero',
                    color=blue,
                    line_width=2,
                    opacity=0.1,
                    bar_scale=1.0),
        'main':
        AltGeometry(parent,
                    'main',
                    color=red,
                    line_width=1,
                    opacity=0.0,
                    bar_scale=1.0),
    }
    main_window = EditGeometryProperties(d, win_parent=None)
    main_window.show()
    # Enter the main loop
    app.exec_()
Ejemplo n.º 5
0
def main():
    # kills the program when you hit Cntl+C from the command line
    # doesn't save the current state as presumably there's been an error
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    import sys
    # Someone is launching this directly
    # Create the QApplication
    app = QtGui.QApplication(sys.argv)
    #The Main window
    #g = GeometryHandle()
    #g.add('main', color=(0, 0, 0), line_thickness=0.0)
    #g.get_grid('name')
    #g.set_color('name')
    #g.set_grid('name')
    #g.set_grid('name')
    parent = app
    green = (0, 255, 0)

    point_properties = AltGeometry(parent,
                                   'point_properties',
                                   color=green,
                                   point_size=5,
                                   opacity=1.0)

    points = {
        1: ['LERoot', 0, 'R', 1.0, 2.0, 3.0],
        2: ['LETip', 42, 'S', 2.0, 3.0, 4.0],
    }
    coords = {
        0: ['R'],
        2: ['C'],
        42: ['S'],
    }
    d = {
        'point_properties': point_properties,
        'points': points,
        'active_point': 2,
        'coords': coords,
    }
    main_window = BreakSurfaceMenu(d, win_parent=None)
    main_window.show()
    # Enter the main loop
    app.exec_()
Ejemplo n.º 6
0
def main():  # pragma: no cover
    """gui independent way to test the program"""
    # kills the program when you hit Cntl+C from the command line
    # doesn't save the current state as presumably there's been an error
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    import sys
    # Someone is launching this directly
    # Create the QApplication
    app = QApplication(sys.argv)
    parent = app
    red = (255, 0, 0)
    blue = (0, 0, 255)
    green = (0, 255, 0)
    purple = (255, 0, 255)

    # representation
    # * main - main mesh
    # * toggle - change with main mesh
    # * wire - always wireframe
    # * point - always points
    # * wire+point - point (vertex) and wireframe allowed
    # * surface - always surface
    # * bar - this can use bar scale
    data = {
        'font_size':
        8,
        'toggle':
        AltGeometry(parent,
                    'toggle',
                    color=green,
                    line_width=3,
                    opacity=0.2,
                    representation='toggle'),
        'wire':
        AltGeometry(parent,
                    'wire',
                    color=purple,
                    line_width=4,
                    opacity=0.3,
                    representation='wire'),
        'wire+point':
        AltGeometry(parent,
                    'wire+point',
                    color=blue,
                    line_width=2,
                    opacity=0.1,
                    bar_scale=1.0,
                    representation='wire+point'),
        'main':
        AltGeometry(parent,
                    'main',
                    color=red,
                    line_width=1,
                    opacity=0.0,
                    representation='main'),
        'point':
        AltGeometry(parent,
                    'point',
                    color=blue,
                    opacity=0.1,
                    representation='point'),
        'surface':
        AltGeometry(parent,
                    'surface',
                    color=blue,
                    opacity=0.1,
                    representation='surface'),
    }
    main_window = EditGeometryProperties(data, win_parent=None)
    main_window.show()
    # Enter the main loop
    app.exec_()