예제 #1
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_rectangle(x + w / 8, y + h / 8, w - w / 4, h / 3)
예제 #2
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_text(x + w / 3 - 10, y + h * 3 / 5, 'R2D', 16)
예제 #3
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_text(x + w / 6, y + h / 2, 'SetVar', 9)
예제 #4
0
 def paint(self,
           painter: SimPainter,
           x: float = 0,
           y: float = 0,
           scale: float = 1):
     SimTmp.paint_base(painter, x, y, self.width, self.height)
     painter.draw_text(x, y + self.height + self.font, self.name, self.font)
예제 #5
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_text(x + w / 6, y + h * 1 / 2, 'Const',
                       int(min(h * 2 / 3, w * 1 / 5)))
예제 #6
0
 def paint(self,
           painter: SimPainter,
           x: float = 0,
           y: float = 0,
           scale: float = 1):
     painter.draw_rectangle(x + 1, y + 1, self.width - 2, self.height - 2)
     painter.draw_text(x + self.width / 3, y + self.height / 2,
                       self.variable, self.font)
예제 #7
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_text(x + w / 10, y + h / 2 + h / 5, "Hi!",
                       int(min(h * 2 / 3, w * 2 / 3)))
예제 #8
0
 def paint(self,
           painter: SimPainter,
           x: float = 0,
           y: float = 0,
           scale: float = 1):
     painter.draw_rectangle(x + 1, y + 1, self.width - 2, self.height - 2)
     painter.draw_text(x + self.width / 3, y + self.height * 1 / 2,
                       str(self.value),
                       int(min(self.height * 2 / 3, self.font)))
예제 #9
0
 def paint_full(self,
                painter: SimPainter,
                x_indent: float = 0,
                y_indent: float = 0,
                scale: float = 1):
     painter.clear()
     for element in self.present_elements.values():
         element.paint(painter, self.x, self.y, scale)
     for connection in self.present_connections:
         connection.paint(painter, self.x, self.y, scale)
예제 #10
0
 def paint(self,
           painter: SimPainter,
           x_indent: float = 0,
           y_indent: float = 0,
           scale: float = 1):
     SimSinWave.paint_base(painter, self.x + x_indent, self.y + y_indent,
                           self.width, self.height)
     painter.draw_text(self.x + x_indent,
                       self.y + y_indent + self.height + self.font,
                       self.name, self.font)
예제 #11
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)
예제 #12
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)
예제 #13
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)
    def paint(self,
              painter: SimPainter,
              x: float = 0,
              y: float = 0,
              scale: float = 1):
        painter.draw_rectangle(x + 1, y + 1, self.width - 2, self.height - 2)
        painter.draw_text(x + self.width / 2 - 25, y + self.height * 3 / 5,
                          '1/s^2', self.font)

        painter.draw_text(x + self.u_socket.x_in_parent + 14,
                          y + self.u_socket.y_in_parent + 10, 'u', self.font)

        painter.draw_text(x + self.x_socket.x_in_parent - 14,
                          y + self.x_socket.y_in_parent + 10, 'x', self.font)

        painter.draw_text(x + self.dx_socket.x_in_parent - 14,
                          y + self.dx_socket.y_in_parent + 10, 'dx', self.font)
예제 #15
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)
 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)
예제 #17
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)
예제 #18
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)
예제 #19
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)
예제 #20
0
 def paint(self,
           painter: SimPainter,
           x: float = 0,
           y: float = 0,
           scale: float = 1):
     painter.draw_rectangle(x + 1, y + 1, self.width - 2, self.height - 2)
예제 #21
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)
예제 #22
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)
예제 #23
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)