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)
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)
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)
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)
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)))
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)
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)))
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)))
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)