(self, seqp, workarea, config)
return seq
Convert sequence from percents to coordinates taking into account config spacing.
Convert sequence from percents to coordinates taking into account config spacing.
Convert sequence from percents to coordinates taking into account config spacing .
def _seqp_to_seq(self, seqp, workarea, config):
        """ Convert sequence from percents to coordinates taking into account config spacing. """
        seq = Seq(
            x1=int(round(workarea.x + (workarea.width * seqp.x1))),
            x2=int(round(workarea.x + (workarea.width * seqp.x2))),
            y1=int(round(workarea.y + (workarea.height * seqp.y1))),
            y2=int(round(workarea.y + (workarea.height * seqp.y2))),
            w=int(round(workarea.width * seqp.w)),
            h=int(round(workarea.height * seqp.h)),
        )
        if config['spacing']:
            halfspace = int(config['spacing'] / 2)
            if seqp.x1 != 0.0: seq = seq._replace(x1=seq.x1+halfspace, w=seq.w-halfspace)
            if seqp.y1 != 0.0: seq = seq._replace(y1=seq.y1+halfspace, h=seq.h-halfspace)
            if seqp.x2 != 1.0: seq = seq._replace(x2=seq.x2-halfspace, w=seq.w-halfspace)
            if seqp.y2 != 1.0: seq = seq._replace(y2=seq.y2-halfspace, h=seq.h-halfspace)
        return seq
def _seqp_to_seq ( self , seqp , workarea , config ) : seq = Seq ( x1 = int ( round ( workarea . x + ( workarea . width * seqp . x1 ) ) ) , x2 = int ( round ( workarea . x + ( workarea . width * seqp . x2 ) ) ) , y1 = int ( round ( workarea . y + ( workarea . height * seqp . y1 ) ) ) , y2 = int ( round ( workarea . y + ( workarea . height * seqp . y2 ) ) ) , w = int ( round ( workarea . width * seqp . w ) ) , h = int ( round ( workarea . height * seqp . h ) ) , ) if config [ 'spacing' ] : halfspace = int ( config [ 'spacing' ] / 2 ) if seqp . x1 != 0.0 : seq = seq . _replace ( x1 = seq . x1 + halfspace , w = seq . w - halfspace ) if seqp . y1 != 0.0 : seq = seq . _replace ( y1 = seq . y1 + halfspace , h = seq . h - halfspace ) if seqp . x2 != 1.0 : seq = seq . _replace ( x2 = seq . x2 - halfspace , w = seq . w - halfspace ) if seqp . y2 != 1.0 : seq = seq . _replace ( y2 = seq . y2 - halfspace , h = seq . h - halfspace ) return seq