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_text(x + w / 10, y + h * 3 / 5, '1/s^2', 12)
Пример #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_text(x + w / 3, y + h * 4 / 5, '*', 25)
Пример #3
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)
     for i, sign in enumerate(self.signs):
         painter.draw_text(x + self.inputs[i].x_in_parent + 14,
                           y + self.inputs[i].y_in_parent + 10, sign,
                           self.font)
Пример #4
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)
Пример #5
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)
Пример #6
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)
Пример #7
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)
Пример #8
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)
Пример #9
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_text(x + self.width / 2 - 10, y + self.height / 2 + 10, 'sin', 15)
Пример #10
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_text(x + w / 2 - 10, y + h / 2 + 10, 'sin', 15)