예제 #1
0
 def paint_base(painter: SimPainter,
                x: float = 0,
                y: float = 0,
                w: float = 32,
                h: float = 32):
     # общее рисование
     painter.set_pen_width(1)
     painter.draw_rectangle(x + 1, y + 1, w - 2, h - 2)
     painter.set_pen_width(3)
     painter.draw_line(x + w / 2, y + h / 5, x + w / 2, y + h * 4 / 5)
     painter.draw_line(x + w / 5, y + h / 2, x + w * 4 / 5, y + h / 2)
예제 #2
0
 def paint_base(painter: SimPainter,
                x: float = 0,
                y: float = 0,
                w: float = 32,
                h: float = 32):
     painter.set_pen_width(1)
     painter.draw_rectangle(x + 1, y + 1, w - 2, h - 2)
     painter.draw_line(x + w / 5, y + h / 2, x + w * 4 / 5, y + h / 2)
     painter.draw_line(x + w / 5, y + h / 7, x + w / 5, y + h * 6 / 7)
     painter.set_pen_width(2)
     painter.draw_line(x + w / 5, y + h * 4 / 5, x + w * 4 / 5, y + h / 5)
예제 #3
0
    def paint(self,
              painter: SimPainter,
              x: float = 0,
              y: float = 0,
              scale: float = 1):
        x1 = x + self.x + self.size * point1_multiplier[self.position][0]
        y1 = y + self.y + self.size * point1_multiplier[self.position][1]
        x2 = x + self.x + self.size * point2_multiplier[self.position][0]
        y2 = y + self.y + self.size * point2_multiplier[self.position][1]
        x3 = x + self.x + self.size * point3_multiplier[self.position][0]
        y3 = y + self.y + self.size * point3_multiplier[self.position][1]

        painter.draw_line(x1, y1, x3, y3)
        painter.draw_line(x1, y1, x2, y2)
예제 #4
0
 def paint_base(painter: SimPainter,
                x: float = 0,
                y: float = 0,
                w: float = 32,
                h: float = 32):
     painter.draw_rectangle(x + 1, y + 1, w - 2, h - 2)
     painter.draw_line(x + 5, y + h / 2, x + w - 5, y + h / 2)
     painter.draw_line(x + w / 5, y + 5, x + w / 5, y + h - 5)
     painter.set_pen_width(2)
     painter.draw_curve(x + w / 5, y + h / 2, x + 1.5 * w / 5, y + 5,
                        x + 2.5 * w / 5, y + 5, x + 3 * w / 5, y + h / 2)
     painter.draw_curve(x + 3 * w / 5, y + h / 2, x + 3.5 * w / 5,
                        y + h - 10, x + 4.5 * w / 5, y + h - 10, x + w - 2,
                        y + h / 2)
예제 #5
0
 def paint(self,
           painter: SimPainter,
           x: float = 0,
           y: float = 0,
           scale: float = 1):
     painter.set_pen_width(1)
     painter.draw_rectangle(x + 1, y + 1, self.width - 2, self.height - 2)
     painter.draw_rectangle(x + 1, y + 1, self.width - 2, self.height - 2)
     painter.draw_line(x + self.width / 5, y + self.height / 2,
                       x + self.width * 4 / 5, y + self.height / 2)
     painter.draw_line(x + self.width / 5, y + self.height / 7,
                       x + self.width / 5, y + self.height * 6 / 7)
     painter.set_pen_width(2)
     painter.draw_line(x + self.width / 5, y + self.height * 4 / 5,
                       x + self.width * 4 / 5, y + self.height / 5)
예제 #6
0
    def paint(self, painter: SimPainter, x_indent: float = 0, y_indent: float = 0, scale: float = 1):
        painter.set_pen_width(3)

        # start arrow
        if self.output_socket is not None:
            painter.set_pen_colour(0, 255, 0)
            #self.x = self.output_socket.x
            #self.y = self.output_socket.y
            self.start_box.x = self.output_socket.x
            self.start_box.y = self.output_socket.y
            #self.x, self.y = self.output_socket.x, self.output_socket.y
        else:
            painter.set_pen_colour(255, 0, 0)

        x1 = x_indent + self.start_box.x
        y1 = y_indent + self.start_box.y
        #painter.draw_circle(x1 + 5, y1 + 5, 3)
        painter.draw_line(x1, y1 + 2, x1 + 6, y1 + 5)
        painter.draw_line(x1, y1 + 8, x1 + 6, y1 + 5)

        # end arrow
        if self.input_socket is not None:
            painter.set_pen_colour(0, 255, 0)
            #self.width = self.input_socket.x
            #self.height = self.input_socket.y

            self.end_box.x = self.input_socket.x
            self.end_box.y = self.input_socket.y
            #self.width, self.height = self.input_socket.x, self.input_socket.y
        else:
            painter.set_pen_colour(255, 0, 0)

        x2 = x_indent + self.end_box.x
        y2 = y_indent + self.end_box.y
        #painter.draw_circle(x2 + 5, y2 + 5, 3)
        painter.draw_line(x2, y2 + 2, x2 + 6, y2 + 5)
        painter.draw_line(x2, y2 + 8, x2 + 6, y2 + 5)

        # line
        painter.set_pen_width(1)
        painter.set_pen_colour(0, 0, 0)
        painter.draw_line(x1 + 4, y1 + 4, x2 + 4, y2 + 4)