def interrupt(self):
        if self.skip_updates:
            #print "skip recursive interrupt"
            return
        
        self.skip_updates = True
        
        fract4dc.interrupt(self.site)

        n = 0
        # wait for stream from worker to flush
        while self.running:
            n += 1
            gtk.main_iteration(True)

        self.skip_updates = False
Beispiel #2
0
    def interrupt(self):
        if self.skip_updates:
            # print "skip recursive interrupt"
            return

        self.skip_updates = True

        fract4dc.interrupt(self.site)

        n = 0
        # wait for stream from worker to flush
        while self.running:
            n += 1
            gtk.main_iteration(True)

        self.skip_updates = False
Beispiel #3
0
    def testFDSite(self):
        xsize = 64
        ysize = int(xsize * 3.0/4.0)
        im = image.T(xsize,ysize)
        (rfd,wfd) = os.pipe()
        site = fract4dc.fdsite_create(wfd)

        file = self.compileColorMandel()

        for x in range(2):
            handle = fract4dc.pf_load(file)
            pfunc = fract4dc.pf_create(handle)
            fract4dc.pf_init(pfunc,pos_params,self.color_mandel_params)
            cmap = fract4dc.cmap_create(
                [(0.0,0,0,0,255),
                 (1/256.0,255,255,255,255),
                 (1.0, 255, 255, 255, 255)])

            fract4dc.calc(
                params=[0.0, 0.0, 0.0, 0.0,
                 4.0,
                 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                antialias=0,
                maxiter=100,
                yflip=0,
                nthreads=1,
                pfo=pfunc,
                cmap=cmap,
                auto_deepen=0,
                periodicity=1,
                render_type=0,
                image=im._img,
                site=site,
                asynchronous=True)

            nrecved = 0
            while True:
                if nrecved == x:
                    #print "hit message count"
                    fract4dc.interrupt(site)
                
                nb = 2*4
                bytes = os.read(rfd,nb)
                if len(bytes) < nb:
                    self.fail("bad message with length %s, value %s" % (len(bytes), bytes))
                    break

                (t,size) = struct.unpack("2i",bytes)
                #print "read %d, len %d" % (t,size)

                # read the rest of the message
                bytes = os.read(rfd,size)
                if len(bytes) < size:
                    self.fail("bad message")
                    break
                
                msg = messages.parse(t, bytes)
                #print "msg: %s" % msg.show()
                if msg.name == "Status" and msg.status == 0:
                    #done
                    #print "done"
                    break
                
                nrecved += 1
Beispiel #4
0
    def testFDSite(self):
        xsize = 64
        ysize = int(xsize * 3.0 / 4.0)
        im = image.T(xsize, ysize)
        (rfd, wfd) = os.pipe()
        site = fract4dc.fdsite_create(wfd)

        file = self.compileColorMandel()

        for x in range(2):
            handle = fract4dc.pf_load(file)
            pfunc = fract4dc.pf_create(handle)
            fract4dc.pf_init(pfunc, pos_params, self.color_mandel_params)
            cmap = fract4dc.cmap_create([(0.0, 0, 0, 0, 255),
                                         (1 / 256.0, 255, 255, 255, 255),
                                         (1.0, 255, 255, 255, 255)])

            fract4dc.calc(
                params=[0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
                antialias=0,
                maxiter=100,
                yflip=0,
                nthreads=1,
                pfo=pfunc,
                cmap=cmap,
                auto_deepen=0,
                periodicity=1,
                render_type=0,
                image=im._img,
                site=site,
                asynchronous=True)

            nrecved = 0
            while True:
                if nrecved == x:
                    # print "hit message count"
                    fract4dc.interrupt(site)

                nb = 2 * 4
                bytes = os.read(rfd, nb)
                if len(bytes) < nb:
                    self.fail("bad message with length %s, value %s" %
                              (len(bytes), bytes))
                    break

                (t, size) = struct.unpack("2i", bytes)
                # print "read %d, len %d" % (t,size)

                # read the rest of the message
                bytes = os.read(rfd, size)
                if len(bytes) < size:
                    self.fail("bad message")
                    break

                msg = messages.parse(t, bytes)
                # print "msg: %s" % msg.show()
                if msg.name == "Status" and msg.status == 0:
                    # done
                    # print "done"
                    break

                nrecved += 1