Ejemplo n.º 1
0
 def draw(self, screen, color=BLUE):
     args   = self.scaleM(( 0,  0), (24, 12), (0, 24),  # triangle
                          (26, 12), 2)                  # NOT circle
     tp1, tp2, tp3, cp1, cr1 = args
     pg.draw.polygon(screen, color, (tp1, tp2, tp3), 1)
     pg.draw.circle(screen,  color, cp1, cr1, 1)
     pg.draw.circle(screen,  color, self.A.pos, 2, 1)
     pg.draw.circle(screen,  color, self.B.pos, 2, 1)
     textDraw(screen, self.scale1((5, 5)), color, self.name, quad=4)
Ejemplo n.º 2
0
 def draw(self, screen, color=BLUE):
     args = self.scaleM((15, 15), 15,                        # big circle
                        (0, 0), (15, 0), (15, 30), (0, 30),  # erase rect
                        (15, 0), (0, 0), (0, 30), (15, 30),  # draw box behind
                        (30, 15), 2)                         # little NOT circle
     c1p, c1r, e1, e2, e3, e4, l1, l2, l3, l4, c2p, c2r = args
     pg.draw.circle(screen,  color, c1p, c1r, 1)
     pg.draw.polygon(screen, BGCOLOR, (e1, e2, e3, e4), 0)
     pg.draw.lines(screen,   color, False, (l1, l2, l3, l4), 1)
     pg.draw.circle(screen,  color, c2p, c2r, 1)
     for con in (self.A, self.B, self.C):
         pg.draw.circle(screen, color, con.pos, 2, 1)
     textDraw(screen, self.scale1((5, 5)), color, self.name, quad=4)
Ejemplo n.º 3
0
 def drawWires(s, screen, color=None):
     if not color:
         color = [COLD, HOT][s.value]
     slq = s.labelQuad
     for d in s.feeds:
         dlq = d.labelQuad
         txt = "Draw wire {0}.{1}={2} @ {3} - {4}.{5}={6} @ {7}".format(
             s.parent.name, s.name, s.layer, s.pos[0], s.pos[1], d.parent.name, d.name, d.layer, d.pos[0], d.pos[1]
         )
         if max(s.layer, d.layer) <= CmdEncapsuleLayer:
             pg.draw.lines(screen, color, False, (s.pos, d.pos))
             if slq:
                 textDraw(screen, s.pos, color, s.name, quad=slq)
             if dlq:
                 textDraw(screen, d.pos, color, d.name, quad=dlq)
         d.drawWires(screen, color)  # fan out
Ejemplo n.º 4
0
    def draw(self, screen):
        if self.hidden():
            return
        font = pg.font.Font(None, 12)

        if self.encapsulated():
            bx1, bx2, bx3, bx4 = self.scaleM(( 0,  0),
                                             (20,  0),
                                             (20, 40),
                                             ( 0, 40))
            pg.draw.polygon(screen, BLUE, (bx1, bx2, bx3, bx4), 1)
            textDraw(screen, self.scale1((3, 3)), BLUE, self.name, quad=4)
        elif not self.hidden():
            if self.banner:
                textDraw(screen, self.scale1((0, 0)), GREEN, self.banner,
                         quad=1, font=textFont(24))
            gates = self.gates
            for g in gates:
                g.output.drawWires(screen)
                g.draw(screen)
Ejemplo n.º 5
0
 def draw(self, screen, color=BLUE):
     bp1, br1 = self.scaleM((3, 3), 3)  # Body to click
     pg.draw.circle(screen, color, bp1, br1, 1)
     textDraw(screen, self.pos, color, self.name, quad=2)