コード例 #1
0
ファイル: batch.py プロジェクト: nivertech/cuda-course
def main():
    c = Conn('localhost',4000)

    l = Listener()
    l.connection = c.socket
    l.daemon = True
    l.start()
    
#    c.async(False)
    c.command('async 0')
    c.command('screenshot')
    c.command('steps 25000')

    import surfaces
    for (surf_num,surf_name) in enumerate(surfaces.get()):
        print (surf_name)
        time.sleep(1)
        if surf_num != 1:
            continue
        c.command('surf ' + str(surf_num))
        batch_1(c)

    conn.serverquit()
コード例 #2
0
def main():
    c = Conn('localhost', 4000)

    l = Listener()
    l.connection = c.socket
    l.daemon = True
    l.start()

    #    c.async(False)
    c.command('async 0')
    c.command('screenshot')
    c.command('steps 25000')

    import surfaces
    for (surf_num, surf_name) in enumerate(surfaces.get()):
        print(surf_name)
        time.sleep(1)
        if surf_num != 1:
            continue
        c.command('surf ' + str(surf_num))
        batch_1(c)

    conn.serverquit()
コード例 #3
0
ファイル: control.py プロジェクト: nivertech/cuda-course
    def __init__(self, connection):
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.connect("delete_event", self.close_application)
        window.set_border_width(10)
        window.set_property("resizable",False)
        window.set_property("allow_grow",True)
        window.set_geometry_hints( min_width = self.XSIZE, min_height = self.YSIZE,
                                   max_width = self.XSIZE, max_height = self.YSIZE)

        self.window = window
    
        labels_and_ranges = [("start.x", (-10, 10, 0, 0.01)),
                             ("start.y", (-10, 10, 0, 0.01)),
                             ("start.z", (-10, 10, 0, 0.01)),
                             ("angle.x", (-200, 200, 0, 0.01)),
                             ("angle.y", (-200, 200, 0, 0.01)),
                             ("angle.z", (-200, 200, 0, 0.01)),
                             ("scale", (-10, 10, 0.1, 0.0001)),
                             ("distance", (-100, 100, 10, 0.01)),
                             ("dirvec.x", (-10, 10, 0, 0.01)),
                             ("dirvec.y", (-10, 10, 0, 0.01)),
                             ("dirvec.z", (-10, 10, 0, 0.01)),
                             ("steps", (0, 50000, 500, 1)),
                             ("bisect", (0, 100, 10, 1))
                             ]

        # Create a table
        table = gtk.Table(len(labels_and_ranges)+1+3+3*20, 2, True)
        window.add(table)

        for (i,(label_txt,(r_low, r_high, r_def, step_inc))) in enumerate(labels_and_ranges):
            page_size = 0.1
            adj = gtk.Adjustment(r_def, r_low, r_high, step_inc, (r_high-r_low) / 3000.0)
            scale = gtk.HScale(adj)

            adj.connect("value_changed", self.update_value, label_txt)

            label = gtk.Label()
            label.set_text(label_txt)

            table.attach(label, 0, 1, i, i+1, gtk.SHRINK|gtk.FILL, gtk.FILL, 0, 0 )
            table.attach(scale, 1, 2, i, i+1, gtk.EXPAND|gtk.SHRINK|gtk.FILL, gtk.FILL, 0, 0 )

            label.show()
            scale.show()

        # Combo for surfaces
        pos = len(labels_and_ranges)+2
        
        combobox = gtk.combo_box_new_text()
        slist = surfaces.get()
        for el in slist:
            combobox.append_text(el)
            
        combobox.connect('changed', self.surface_combobox_changed)
        combobox.set_active(4)
        combobox.show()
        table.attach( combobox, 0, 2, pos-2, pos-1, gtk.EXPAND|gtk.SHRINK|gtk.FILL, gtk.FILL, 0, 0 )

        print pos

        # text boxes for arbitrary surface
        for i in range(3):
            pos += 1
            print pos
            text = gtk.Entry(max=300)
            text.set_text("+1 0 -128 0 +2688 0 -21504 0 +84480  0 -180224 0  +212992 0  -131072 0  +32768 0 0")
            text.set_editable(True)
            text.show()
            text.param = "arb_poly." + ["x","y","z"][i]
            table.attach( text, 0, 2, pos-2, pos-1, gtk.EXPAND|gtk.SHRINK|gtk.FILL, gtk.FILL, 0, 0 )

            # setup callback
            text.connect("activate", self.arb_poly_entry_activate, text)

        # screenshot button
        pos += 1
        screenshot = gtk.Button("screenshot!")
        screenshot.connect( "clicked", self.do_screenshot )
        table.attach( screenshot, 0, 1, pos-2, pos-1, 0, 0, 0 )
        
        screenshot.show()
        
        # show
        table.show()
        window.show()
        import gobject
        gobject.idle_add(self.on_idle)

        window.move(1030, 50)
コード例 #4
0
ファイル: control.py プロジェクト: nivertech/cuda-course
    def __init__(self, connection):
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.connect("delete_event", self.close_application)
        window.set_border_width(10)
        window.set_property("resizable", False)
        window.set_property("allow_grow", True)
        window.set_geometry_hints(min_width=self.XSIZE,
                                  min_height=self.YSIZE,
                                  max_width=self.XSIZE,
                                  max_height=self.YSIZE)

        self.window = window

        labels_and_ranges = [("start.x", (-10, 10, 0, 0.01)),
                             ("start.y", (-10, 10, 0, 0.01)),
                             ("start.z", (-10, 10, 0, 0.01)),
                             ("angle.x", (-200, 200, 0, 0.01)),
                             ("angle.y", (-200, 200, 0, 0.01)),
                             ("angle.z", (-200, 200, 0, 0.01)),
                             ("scale", (-10, 10, 0.1, 0.0001)),
                             ("distance", (-100, 100, 10, 0.01)),
                             ("dirvec.x", (-10, 10, 0, 0.01)),
                             ("dirvec.y", (-10, 10, 0, 0.01)),
                             ("dirvec.z", (-10, 10, 0, 0.01)),
                             ("steps", (0, 50000, 500, 1)),
                             ("bisect", (0, 100, 10, 1))]

        # Create a table
        table = gtk.Table(len(labels_and_ranges) + 1 + 3 + 3 * 20, 2, True)
        window.add(table)

        for (i, (label_txt, (r_low, r_high, r_def,
                             step_inc))) in enumerate(labels_and_ranges):
            page_size = 0.1
            adj = gtk.Adjustment(r_def, r_low, r_high, step_inc,
                                 (r_high - r_low) / 3000.0)
            scale = gtk.HScale(adj)

            adj.connect("value_changed", self.update_value, label_txt)

            label = gtk.Label()
            label.set_text(label_txt)

            table.attach(label, 0, 1, i, i + 1, gtk.SHRINK | gtk.FILL,
                         gtk.FILL, 0, 0)
            table.attach(scale, 1, 2, i, i + 1,
                         gtk.EXPAND | gtk.SHRINK | gtk.FILL, gtk.FILL, 0, 0)

            label.show()
            scale.show()

        # Combo for surfaces
        pos = len(labels_and_ranges) + 2

        combobox = gtk.combo_box_new_text()
        slist = surfaces.get()
        for el in slist:
            combobox.append_text(el)

        combobox.connect('changed', self.surface_combobox_changed)
        combobox.set_active(4)
        combobox.show()
        table.attach(combobox, 0, 2, pos - 2, pos - 1,
                     gtk.EXPAND | gtk.SHRINK | gtk.FILL, gtk.FILL, 0, 0)

        print pos

        # text boxes for arbitrary surface
        for i in range(3):
            pos += 1
            print pos
            text = gtk.Entry(max=300)
            text.set_text(
                "+1 0 -128 0 +2688 0 -21504 0 +84480  0 -180224 0  +212992 0  -131072 0  +32768 0 0"
            )
            text.set_editable(True)
            text.show()
            text.param = "arb_poly." + ["x", "y", "z"][i]
            table.attach(text, 0, 2, pos - 2, pos - 1,
                         gtk.EXPAND | gtk.SHRINK | gtk.FILL, gtk.FILL, 0, 0)

            # setup callback
            text.connect("activate", self.arb_poly_entry_activate, text)

        # screenshot button
        pos += 1
        screenshot = gtk.Button("screenshot!")
        screenshot.connect("clicked", self.do_screenshot)
        table.attach(screenshot, 0, 1, pos - 2, pos - 1, 0, 0, 0)

        screenshot.show()

        # show
        table.show()
        window.show()
        import gobject
        gobject.idle_add(self.on_idle)

        window.move(1030, 50)