def dragFixedStaff(self, *pos): if self.contentIdxLocked: self.dragStaff.origin = self.rossecorp(Point(*pos)) self.content[self.contentIdx] = self.dragStaff.getPoints() self.dragStaff = None self.contentIdx = -1 self.contentIdxLocked = False elif self.content and 0<=self.contentIdx<len(self.content) and type(self.content[self.contentIdx]) is list: cnt = Contour() cnt.points = self.content[self.contentIdx] cnt.setInstruct(cnt.getInstruct()) self.dragStaff = cnt self.content[self.contentIdx] = None self.contentIdxLocked = True
def writefile(self, fpath): with open(fpath,'w+') as f: f.write(self.contour.getInstruct()) f.write('\n') for c in self.content: if type(c) is str: f.write("# "+c) else: cnt = Contour() cnt.points = c cnt.origin = c[0] f.write(cnt.getInstruct()) f.write('\n') f.write('$ fixed components end and drag ones begin\n') for b in self.buff: f.write(b[1]) f.write(b[0].getInstruct(False)) f.write('\n')