From dd5917cd45778120557df809ba040ade4427f8fb Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Tue, 27 Sep 2022 19:13:44 -0400 Subject: [PATCH] read/write disks --- src/painter.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/painter.py b/src/painter.py index f9bf433..09257d8 100644 --- a/src/painter.py +++ b/src/painter.py @@ -450,6 +450,8 @@ class Painter(Widget): for particle in self.particles: if type(particle)==Cross: ff.write("{:d};".format(CROSS_INDEX)) + elif type(particle)==Disk: + ff.write("{:d};".format(DISK_INDEX)) ff.write("{:05.2f},{:05.2f};{:3.1f},{:3.1f},{:3.1f}\n".format(particle.elements[0].pos.x,particle.elements[0].pos.y,particle.color[0],particle.color[1],particle.color[2])) ff.close() @@ -527,6 +529,8 @@ class Painter(Widget): continue if particle_type==CROSS_INDEX: candidate=Cross(pos.x,pos.y,color=color) + elif particle_type==DISK_INDEX + candidate=Disk(pos.x,pos.y,color=color) else: print("warning: ignoring line "+str(i)+" in file '"+file+"': unrecognized particle type: '"+entries[0]+"'",file=sys.stderr) continue @@ -579,5 +583,6 @@ class Painter(Widget): # global variables (used like precompiler variables) CROSS_INDEX=1 +DISK_INDEX=2