(self, position, operator, scale)
| 429 | draw_rectangle_border(outer_rectangle, thickness = 1, color = self.info_border_color) |
| 430 | |
| 431 | def draw_operator_info_box(self, position, operator, scale): |
| 432 | text_size = 100 * scale |
| 433 | padding = 8 * scale |
| 434 | line_height = 25 * scale |
| 435 | box_width = 350 * scale |
| 436 | |
| 437 | header_label = Label() |
| 438 | header_label.text = operator.name + "(...)" |
| 439 | header_label.color = self.text_color |
| 440 | header_label.text_size = text_size |
| 441 | header_label.font_id = 1 |
| 442 | header_width = header_label.get_draw_dimensions()[0] |
| 443 | |
| 444 | box_width = max(500 * scale, header_width) |
| 445 | |
| 446 | |
| 447 | description_label = Label() |
| 448 | description_label.text = operator.description |
| 449 | description_label.color = self.text_color |
| 450 | description_label.max_lines = 15 |
| 451 | description_label.text_size = text_size |
| 452 | description_label.font_id = 0 |
| 453 | description_label.line_height = line_height |
| 454 | description_label.width = box_width |
| 455 | description_dimensions = description_label.get_draw_dimensions() |
| 456 | |
| 457 | input_labels = [] |
| 458 | inputs_height = 0 |
| 459 | for input in operator.inputs: |
| 460 | input_name_label = Label() |
| 461 | input_name_label.text = input.name + " - " + input.type |
| 462 | input_name_label.color = self.text_color |
| 463 | input_name_label.text_size = text_size * 0.97 |
| 464 | input_name_label.font_id = 1 |
| 465 | |
| 466 | input_description_label = Label() |
| 467 | input_description_label.text = input.description |
| 468 | input_description_label.text_size = text_size * 0.92 |
| 469 | input_description_label.color = self.text_color |
| 470 | input_description_label.max_lines = 5 |
| 471 | input_description_label.line_height = line_height |
| 472 | input_description_label.width = box_width - padding |
| 473 | input_description_label.font_id = 0 |
| 474 | input_description_height = input_description_label.get_draw_dimensions()[1] |
| 475 | |
| 476 | input_labels.append((input_name_label, input_description_label, input_description_height)) |
| 477 | inputs_height += line_height * 1.3 + input_description_height |
| 478 | |
| 479 | box_width += 3 * padding |
| 480 | box_height = 3 * padding + description_dimensions[1] + inputs_height + line_height |
| 481 | |
| 482 | outer_rectangle = Rectangle(position[0], position[1], box_width, box_height) |
| 483 | draw_rectangle(outer_rectangle, color = self.info_background_color) |
| 484 | |
| 485 | header_position = [ |
| 486 | outer_rectangle.left + padding, |
| 487 | outer_rectangle.top - padding - line_height / 4 * 3 ] |
| 488 | header_label.draw(header_position) |
no test coverage detected