def dac_thread(): global OBJ ps = PointStream() ps.objects.append(OBJ) ps.showBlankingPath = False ps.showTrackingPath = False ps.blankingSamplePts = 10 ps.trackingSamplePts = 10 while True: try: d = dac.DAC(dac.find_first_dac()) d.play_stream(ps) except KeyboardInterrupt: sys.exit() except Exception as e: import sys, traceback print '\n---------------------' print 'Exception: %s' % e print '- - - - - - - - - - -' traceback.print_tb(sys.exc_info()[2]) print "\n"
def dac_thread(): global SQUARE global SQUARE_X, SQUARE_Y global SQUARE_R, SQUARE_G, SQUARE_B global SQUARE_SIZE_MIN ps = PointStream() SQUARE = Square(0, 0, SQUARE_R, SQUARE_G, SQUARE_B, radius = SQUARE_SIZE_MIN) ps.objects.append(SQUARE) while True: try: d = dac.DAC(dac.find_first_dac()) d.play_stream(ps) except KeyboardInterrupt: sys.exit() except Exception as e: import sys, traceback print '\n---------------------' print 'Exception: %s' % e print '- - - - - - - - - - -' traceback.print_tb(sys.exc_info()[2]) print "\n"
def dac_process(): global ps ps = PointStream() #ps.showBlanking = True #ps.showTracking = True ps.blankingSamplePts = 7 ps.trackingSamplePts = 7 thread.start_new_thread(dac_thread, ()) time.sleep(0.50) thread.start_new_thread(copy_struct_thread, ()) while True: time.sleep(100000)
def dac_thread(): global SINEW global WAVE_PERIODS ps = PointStream() #ps.showTracking = True #ps.showBlanking = True ps.trackingSamplePts = 50 ps.blankingSamplePts = 50 SINEW = SineWave(0, 0, COLOR_R/LASER_POWER_DENOM, COLOR_G/LASER_POWER_DENOM, COLOR_B/LASER_POWER_DENOM) SINEW.numPeriods = WAVE_PERIODS SINEW.width = WAVE_WIDTH SINEW.sineAmp = WAVE_AMPLITUDE_MAGNITUDE SINEW.x = ORIGIN_X SINEW.y = ORIGIN_Y #SQUARE.x = SQUARE_X #SQUARE.y = SQUARE_Y ps.objects.append(SINEW) while True: try: d = dac.DAC(dac.find_first_dac()) d.play_stream(ps) except KeyboardInterrupt: sys.exit() except Exception as e: import sys, traceback print '\n---------------------' print 'Exception: %s' % e print '- - - - - - - - - - -' traceback.print_tb(sys.exc_info()[2]) print "\n" pass
def main(): global obj global ps cwd = os.path.dirname(__file__) fname = "gml/hello.gml" if len(sys.argv) > 1: fname = sys.argv[1] fname = os.path.join(cwd, fname) obj = Graffiti(filename=fname) ps = PointStream() thread.start_new_thread(dac_thread, ()) time.sleep(1.0) #thread.start_new_thread(spin_thread, ()) while True: time.sleep(100000)
def main(): global objs global ps # XXX: Insecure!! modname = 'disapprove' if len(sys.argv) > 1: modname = sys.argv[1] exec "from objs.%s import OBJECTS" % modname exec "from objs.%s import MULT_X, MULT_Y" % modname exec "from objs.%s import ADD_X, ADD_Y" % modname for i in range(len(OBJECTS)): #obj in OBJECTS: coords = OBJECTS[i] # Normalize/fix coordinate system for j in range(len(coords)): c = coords[j] x = math.floor(float(c['x']) * MULT_X) + ADD_X y = math.floor(float(c['y']) * MULT_Y) + ADD_Y coords[j] = { 'x': x, 'y': y } OBJECTS[i] = coords objs.append(SvgPath(coords=coords)) ps = PointStream() #ps.showBlanking = True #ps.showTracking = True ps.blankingSamplePts = 7 ps.trackingSamplePts = 7 thread.start_new_thread(dac_thread, ()) time.sleep(1.0) #thread.start_new_thread(spin_thread, ()) while True: time.sleep(100000)
def dac_thread(): global l ps = PointStream() #ps.showTracking = True #ps.showBlanking = True ps.trackingSamplePts = 5 ps.blankingSamplePts = 50 l = Tunnel(0, 0, COLOR_R/LASER_POWER_DENOM, COLOR_G/LASER_POWER_DENOM, COLOR_B/LASER_POWER_DENOM) l.x = ORIGIN_X l.y = ORIGIN_Y #SQUARE.x = SQUARE_X #SQUARE.y = SQUARE_Y ps.objects.append(l) while True: try: d = dac.DAC(dac.find_first_dac()) d.play_stream(ps) except KeyboardInterrupt: sys.exit() except Exception as e: import sys, traceback print '\n---------------------' print 'Exception: %s' % e print '- - - - - - - - - - -' traceback.print_tb(sys.exc_info()[2]) print "\n"
def produce(self): r, g, b = (0, 0, 0) r = 0 if not self.r else int(self.r / LASER_POWER_DENOM) g = 0 if not self.g or LASER_POWER_DENOM > 4 else self.g b = 0 if not self.b else int(self.b / LASER_POWER_DENOM) p = (self.x, self.y, r, g, b) for i in range(POINT_NUM_SAMPLE_PTS): yield p self.drawn = True PS = PointStream() PS.trackingSamplePts = TRACKING_SAMPLE_PTS PS.blankingSamplePts = BLANKING_SAMPLE_PTS def dac_thread(): global PS while True: try: d = dac.DAC(dac.find_first_dac()) d.play_stream(PS) except KeyboardInterrupt: sys.exit() except Exception as e: