1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.ogl.basic
.. highlight:: python
.. _wx.lib.ogl.basic.Shape:
==========================================================================================================================================
|phoenix_title| **wx.lib.ogl.basic.Shape**
==========================================================================================================================================
The :class:`Shape` is the base class for OGL shapes.
The :class:`Shape` is the top-level, abstract object that all other objects
are derived from. All common functionality is represented by :class:`Shape`
members, and overridden members that appear in derived classes and have
behaviour as documented for :class:`Shape`, are not documented separately.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>Shape</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.ogl.basic.Shape_inheritance.png" alt="Inheritance diagram of Shape" usemap="#dummy" class="inheritance"/></center>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.ogl.basic.Shape.html" title="wx.lib.ogl.basic.Shape" alt="" coords="41,83,208,112"/> <area shape="rect" id="node2" href="wx.lib.ogl.basic.ShapeEvtHandler.html" title="wx.lib.ogl.basic.ShapeEvtHandler" alt="" coords="5,5,244,35"/> </map>
</p>
</div>
|
|sub_classes| Known Subclasses
==============================
:class:`wx.lib.ogl.basic.EllipseShape`, :class:`wx.lib.ogl.basic.PolygonShape`, :class:`wx.lib.ogl.basic.RectangleShape`, :class:`wx.lib.ogl.lines.LineShape`
|
|super_classes| Known Superclasses
==================================
:class:`wx.lib.ogl.basic.ShapeEvtHandler`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.ogl.basic.Shape.__init__` Default class constructor.
:meth:`~wx.lib.ogl.basic.Shape.AddLine` Add a line between this shape and the given other shape, at the
:meth:`~wx.lib.ogl.basic.Shape.AddRegion` Add a region to the shape.
:meth:`~wx.lib.ogl.basic.Shape.AddText` Add a line of text to the shape's default text region.
:meth:`~wx.lib.ogl.basic.Shape.AddToCanvas` Add the shape to the canvas's shape list.
:meth:`~wx.lib.ogl.basic.Shape.AncestorSelected` `True` if the shape's ancestor is currently selected.
:meth:`~wx.lib.ogl.basic.Shape.ApplyAttachmentOrdering` Apply the line ordering in linesToSort to the shape, to reorder
:meth:`~wx.lib.ogl.basic.Shape.AssignNewIds` Assign new ids to this image and its children.
:meth:`~wx.lib.ogl.basic.Shape.Attach` Set the shape's internal canvas pointer to point to the given canvas.
:meth:`~wx.lib.ogl.basic.Shape.AttachmentIsValid` `True` if attachment is a valid attachment point.
:meth:`~wx.lib.ogl.basic.Shape.AttachmentSortTest` Return TRUE if pt1 is less than or equal to pt2, in the sense
:meth:`~wx.lib.ogl.basic.Shape.CalcSimpleAttachment` Assuming the attachment lies along a vertical or horizontal line,
:meth:`~wx.lib.ogl.basic.Shape.ClearAttachments` Clear internal custom attachment point shapes (of class
:meth:`~wx.lib.ogl.basic.Shape.ClearRegions` Clear the ShapeRegions from the shape.
:meth:`~wx.lib.ogl.basic.Shape.ClearText` Clear the text from the specified text region.
:meth:`~wx.lib.ogl.basic.Shape.Delete` Fully disconnect this shape from parents, children, the
:meth:`~wx.lib.ogl.basic.Shape.DeleteControlPoints` Delete the control points (or handles) for the shape.
:meth:`~wx.lib.ogl.basic.Shape.Detach` Disassociates the shape from its canvas.
:meth:`~wx.lib.ogl.basic.Shape.Draggable` Is shape draggable?
:meth:`~wx.lib.ogl.basic.Shape.Draw` Draw the whole shape and any lines attached to it.
:meth:`~wx.lib.ogl.basic.Shape.DrawContents` Draw the internal graphic of the shape (such as text).
:meth:`~wx.lib.ogl.basic.Shape.DrawLinks` Draws any lines linked to this shape.
:meth:`~wx.lib.ogl.basic.Shape.Erase` Erase the shape.
:meth:`~wx.lib.ogl.basic.Shape.EraseContents` Erase the shape contents, that is, the area within the shape's
:meth:`~wx.lib.ogl.basic.Shape.EraseLinks` Erase links attached to this shape, but do not repair damage
:meth:`~wx.lib.ogl.basic.Shape.FindRegion` Find the actual image ('this' if non-composite) and region id
:meth:`~wx.lib.ogl.basic.Shape.FindRegionNames` Get a list of all region names for this image (composite or simple).
:meth:`~wx.lib.ogl.basic.Shape.Flash` Flash the shape.
:meth:`~wx.lib.ogl.basic.Shape.FormatText` Reformat the given text region; defaults to formatting the
:meth:`~wx.lib.ogl.basic.Shape.GetAttachmentLineCount` Get the number of lines at this attachment position.
:meth:`~wx.lib.ogl.basic.Shape.GetAttachmentMode` Get the attachment mode.
:meth:`~wx.lib.ogl.basic.Shape.GetAttachmentPosition` Get the position at which the given attachment point should be drawn.
:meth:`~wx.lib.ogl.basic.Shape.GetAttachmentPositionEdge` Only get the attachment position at the _edge_ of the shape,
:meth:`~wx.lib.ogl.basic.Shape.GetBackgroundBrush` Return brush of the right colour for the background.
:meth:`~wx.lib.ogl.basic.Shape.GetBackgroundPen` Return pen of the right colour for the background.
:meth:`~wx.lib.ogl.basic.Shape.GetBoundingBoxMax` Get the maximum bounding box for the shape, taking into account
:meth:`~wx.lib.ogl.basic.Shape.GetBoundingBoxMin` Get the minimum bounding box for the shape, that defines the area
:meth:`~wx.lib.ogl.basic.Shape.GetBranchingAttachmentInfo` Get information about where branching connections go.
:meth:`~wx.lib.ogl.basic.Shape.GetBranchingAttachmentPoint` Get branching attachment point.
:meth:`~wx.lib.ogl.basic.Shape.GetBranchingAttachmentRoot` Get the root point at the given attachment.
:meth:`~wx.lib.ogl.basic.Shape.GetBranchStyle` Get the branch style.
:meth:`~wx.lib.ogl.basic.Shape.GetBrush` Get the brush used for filling the shape.
:meth:`~wx.lib.ogl.basic.Shape.GetCanvas` Get the internal canvas.
:meth:`~wx.lib.ogl.basic.Shape.GetCentreResize` `True` if the shape is to be resized from the centre (the centre stands
:meth:`~wx.lib.ogl.basic.Shape.GetChildren` Get the list of children for this shape.
:meth:`~wx.lib.ogl.basic.Shape.GetClassName`
:meth:`~wx.lib.ogl.basic.Shape.GetDisableLabel` `True` if the default region will not be shown, `False` otherwise.
:meth:`~wx.lib.ogl.basic.Shape.GetDrawHandles` Get the list of drawhandles.
:meth:`~wx.lib.ogl.basic.Shape.GetEventHandler` Get the event handler for this shape.
:meth:`~wx.lib.ogl.basic.Shape.GetFixedHeight` `True` if the shape cannot be resized in the vertical plane.
:meth:`~wx.lib.ogl.basic.Shape.GetFixedSize` Return flags indicating whether the shape is of fixed size in
:meth:`~wx.lib.ogl.basic.Shape.GetFixedWidth` `True` if the shape cannot be resized in the horizontal plane.
:meth:`~wx.lib.ogl.basic.Shape.GetFont` Get the font for the specified text region.
:meth:`~wx.lib.ogl.basic.Shape.GetFormatMode` Get the format mode.
:meth:`~wx.lib.ogl.basic.Shape.GetId` Get the integer identifier for this shape.
:meth:`~wx.lib.ogl.basic.Shape.GetLinePosition` Get the zero-based position of line in the list of lines
:meth:`~wx.lib.ogl.basic.Shape.GetLines` Return the list of lines connected to this shape.
:meth:`~wx.lib.ogl.basic.Shape.GetMaintainAspectRatio` `True` if shape keeps aspect ratio during resize.
:meth:`~wx.lib.ogl.basic.Shape.GetNumberOfAttachments` Get the number of attachment points for this shape.
:meth:`~wx.lib.ogl.basic.Shape.GetNumberOfTextRegions` Get the number of text regions for this shape.
:meth:`~wx.lib.ogl.basic.Shape.GetParent` Get the parent of this shape, if it is part of a composite.
:meth:`~wx.lib.ogl.basic.Shape.GetPen` Get the pen used for drawing the shape's outline.
:meth:`~wx.lib.ogl.basic.Shape.GetPerimeterPoint` Get the point at which the line from (x1, y1) to (x2, y2) hits
:meth:`~wx.lib.ogl.basic.Shape.GetRegionId` Get the region's identifier by name.
:meth:`~wx.lib.ogl.basic.Shape.GetRegionName` Get the region's name.
:meth:`~wx.lib.ogl.basic.Shape.GetRegions` Get the list of ShapeRegions.
:meth:`~wx.lib.ogl.basic.Shape.GetRotation` Return the angle of rotation in radians.
:meth:`~wx.lib.ogl.basic.Shape.GetSensitivityFilter` Get the sensitivity filter, a bitlist of values.
:meth:`~wx.lib.ogl.basic.Shape.GetShadowMode` Get the current shadow mode setting.
:meth:`~wx.lib.ogl.basic.Shape.GetSpaceAttachments` Get whether lines should be spaced out evenly at the point they
:meth:`~wx.lib.ogl.basic.Shape.GetTextColour` Get the colour for the specified text region.
:meth:`~wx.lib.ogl.basic.Shape.GetTopAncestor` Return the top-most ancestor of this shape (the root of
:meth:`~wx.lib.ogl.basic.Shape.GetX` Get the x position of the centre of the shape.
:meth:`~wx.lib.ogl.basic.Shape.GetY` Get the y position of the centre of the shape.
:meth:`~wx.lib.ogl.basic.Shape.HasDescendant` Is image a descendant of this composite.
:meth:`~wx.lib.ogl.basic.Shape.HitTest` Given a point on a canvas, returns `True` if the point was on the
:meth:`~wx.lib.ogl.basic.Shape.InsertInCanvas` Insert the shape at the front of the shape list of canvas.
:meth:`~wx.lib.ogl.basic.Shape.IsHighlighted` `True` if the shape is highlighted. Shape highlighting is unimplemented.
:meth:`~wx.lib.ogl.basic.Shape.IsShown` `True` if the shape is in a visible state, `False` otherwise.
:meth:`~wx.lib.ogl.basic.Shape.LogicalToPhysicalAttachment` Rotate the standard attachment point from logical
:meth:`~wx.lib.ogl.basic.Shape.MakeControlPoints` Make a list of control points (draggable handles) appropriate to
:meth:`~wx.lib.ogl.basic.Shape.MakeMandatoryControlPoints` Make the mandatory control points.
:meth:`~wx.lib.ogl.basic.Shape.Move` Move the shape to the given position.
:meth:`~wx.lib.ogl.basic.Shape.MoveLineToNewAttachment` Move the given line (which must already be attached to the shape)
:meth:`~wx.lib.ogl.basic.Shape.MoveLinks` Redraw all the lines attached to the shape.
:meth:`~wx.lib.ogl.basic.Shape.NameRegions` Make unique names for all the regions in a shape or composite shape.
:meth:`~wx.lib.ogl.basic.Shape.OnBeginDragLeft` The begin drag left handler.
:meth:`~wx.lib.ogl.basic.Shape.OnBeginDragRight` The begin drag right handler.
:meth:`~wx.lib.ogl.basic.Shape.OnChangeAttachment` Change attachment handler.
:meth:`~wx.lib.ogl.basic.Shape.OnDragLeft` The drag left handler.
:meth:`~wx.lib.ogl.basic.Shape.OnDragRight` The drag right handler.
:meth:`~wx.lib.ogl.basic.Shape.OnDraw` not implemented???
:meth:`~wx.lib.ogl.basic.Shape.OnDrawBranches` The draw branches handler.
:meth:`~wx.lib.ogl.basic.Shape.OnDrawBranchesAttachment` The draw branches attachment handler.
:meth:`~wx.lib.ogl.basic.Shape.OnDrawContents` The draw contents handler.
:meth:`~wx.lib.ogl.basic.Shape.OnDrawControlPoints` The draw control points handler.
:meth:`~wx.lib.ogl.basic.Shape.OnDrawOutline` The draw outline handler.
:meth:`~wx.lib.ogl.basic.Shape.OnEndDragLeft` The end drag left handler.
:meth:`~wx.lib.ogl.basic.Shape.OnEndDragRight` The end drag right handler.
:meth:`~wx.lib.ogl.basic.Shape.OnErase` The erase handler.
:meth:`~wx.lib.ogl.basic.Shape.OnEraseContents` The erase contents handler.
:meth:`~wx.lib.ogl.basic.Shape.OnEraseControlPoints` The erase control points handler.
:meth:`~wx.lib.ogl.basic.Shape.OnHighlight` not implemented???
:meth:`~wx.lib.ogl.basic.Shape.OnLeftClick` The left click handler.
:meth:`~wx.lib.ogl.basic.Shape.OnMoveLinks` The move links handler.
:meth:`~wx.lib.ogl.basic.Shape.OnMovePre` The pre move handler.
:meth:`~wx.lib.ogl.basic.Shape.OnRightClick` The right click handler.
:meth:`~wx.lib.ogl.basic.Shape.OnSize` not implemented???
:meth:`~wx.lib.ogl.basic.Shape.OnSizingBeginDragLeft` The sizing begin drag left handler.
:meth:`~wx.lib.ogl.basic.Shape.OnSizingDragLeft` The sizing drag left handler.
:meth:`~wx.lib.ogl.basic.Shape.OnSizingEndDragLeft` The sizing end drag left handler.
:meth:`~wx.lib.ogl.basic.Shape.PhysicalToLogicalAttachment` Rotate the standard attachment point from physical
:meth:`~wx.lib.ogl.basic.Shape.Recentre` Recentre (or other formatting) all the text regions for this shape.
:meth:`~wx.lib.ogl.basic.Shape.Recompute` Recomputes any constraints associated with the shape.
:meth:`~wx.lib.ogl.basic.Shape.RemoveFromCanvas` Remove the shape from the canvas.
:meth:`~wx.lib.ogl.basic.Shape.RemoveLine` Remove the given line from the shape's list of attached lines.
:meth:`~wx.lib.ogl.basic.Shape.ResetControlPoints` Reset the positions of the control points (for instance when the
:meth:`~wx.lib.ogl.basic.Shape.ResetMandatoryControlPoints` Reset the mandatory control points.
:meth:`~wx.lib.ogl.basic.Shape.Rotate` Rotate about the given axis by the given amount in radians.
:meth:`~wx.lib.ogl.basic.Shape.Select` Select or deselect the given shape, drawing or erasing control points
:meth:`~wx.lib.ogl.basic.Shape.Selected` `True` if the shape is currently selected.
:meth:`~wx.lib.ogl.basic.Shape.SetAttachmentMode` Set the attachment mode.
:meth:`~wx.lib.ogl.basic.Shape.SetAttachmentSize` Set the attachment size.
:meth:`~wx.lib.ogl.basic.Shape.SetBrush` Set the brush for filling the shape's shape.
:meth:`~wx.lib.ogl.basic.Shape.SetCanvas` Set the canvas, identical to Shape.Attach.
:meth:`~wx.lib.ogl.basic.Shape.SetCentreResize` Specify whether the shape is to be resized from the centre (the
:meth:`~wx.lib.ogl.basic.Shape.SetDefaultRegionSize` Set the default region to be consistent with the shape size.
:meth:`~wx.lib.ogl.basic.Shape.SetDisableLabel` Set flag to `True` to stop the default region being shown.
:meth:`~wx.lib.ogl.basic.Shape.SetDraggable` Set the shape to be draggable or not draggable.
:meth:`~wx.lib.ogl.basic.Shape.SetDrawHandles` Set the drawHandles flag for this shape and all descendants.
:meth:`~wx.lib.ogl.basic.Shape.SetEventHandler` Set the event handler for this shape.
:meth:`~wx.lib.ogl.basic.Shape.SetFixedSize` Set the shape to be fixed size.
:meth:`~wx.lib.ogl.basic.Shape.SetFont` Set the font for the specified text region.
:meth:`~wx.lib.ogl.basic.Shape.SetFormatMode` Set the format mode of the region.
:meth:`~wx.lib.ogl.basic.Shape.SetHighlight` Set the highlight for a shape. Shape highlighting is unimplemented.
:meth:`~wx.lib.ogl.basic.Shape.SetId` Set the integer identifier for this shape.
:meth:`~wx.lib.ogl.basic.Shape.SetMaintainAspectRatio` Set whether a shape that resizes should not change the aspect ratio
:meth:`~wx.lib.ogl.basic.Shape.SetParent` Set the parent
:meth:`~wx.lib.ogl.basic.Shape.SetPen` Set the pen for drawing the shape's outline.
:meth:`~wx.lib.ogl.basic.Shape.SetRegionName` Set the name for this region.
:meth:`~wx.lib.ogl.basic.Shape.SetRotation` Set rotation
:meth:`~wx.lib.ogl.basic.Shape.SetSensitivityFilter` Set the shape to be sensitive or insensitive to specific mouse
:meth:`~wx.lib.ogl.basic.Shape.SetShadowMode` Set the shadow mode (whether a shadow is drawn or not).
:meth:`~wx.lib.ogl.basic.Shape.SetShape` Set shape ???
:meth:`~wx.lib.ogl.basic.Shape.SetSize` Set the shape's size.
:meth:`~wx.lib.ogl.basic.Shape.SetSpaceAttachments` Indicate whether lines should be spaced out evenly at the point
:meth:`~wx.lib.ogl.basic.Shape.SetTextColour` Set the colour for the specified text region.
:meth:`~wx.lib.ogl.basic.Shape.SetX` Set the x position of the shape.
:meth:`~wx.lib.ogl.basic.Shape.SetY` Set the y position of the shape.
:meth:`~wx.lib.ogl.basic.Shape.Show` Set a flag indicating whether the shape should be drawn.
:meth:`~wx.lib.ogl.basic.Shape.SortLines` Reorder the lines coming into the node image at this attachment
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: Shape(ShapeEvtHandler)
The :class:`Shape` is the base class for OGL shapes.
The :class:`Shape` is the top-level, abstract object that all other objects
are derived from. All common functionality is represented by :class:`Shape`
members, and overridden members that appear in derived classes and have
behaviour as documented for :class:`Shape`, are not documented separately.
.. method:: __init__(self, canvas = None)
Default class constructor.
:param `canvas`: an instance of :class:`~lib.ogl.Canvas`
.. method:: AddLine(self, line, other, attachFrom = 0, attachTo = 0, positionFrom = -1, positionTo = -1)
Add a line between this shape and the given other shape, at the
specified attachment points.
:param `line`: the line an instance of :class:`~lib.ogl.LineShape`
:param `other`: the other shape, an instance of :class:`Shape`
:param `attachFrom`: the attachment from point ???
:param `attachTo`: the attachment to point ???
:param `positionFrom`: the from position
:param `positionTo`: the to position
:note: The position in the list of lines at each end can also be
specified, so that the line will be drawn at a particular point on
its attachment point.
.. method:: AddRegion(self, region)
Add a region to the shape.
.. method:: AddText(self, string)
Add a line of text to the shape's default text region.
.. method:: AddToCanvas(self, theCanvas, addAfter = None)
Add the shape to the canvas's shape list.
:param `theCanvas`: an instance of :class:`~lib.ogl.Canvas`
:param `addAfter`: if non-NULL, will add the shape after this shape
.. method:: AncestorSelected(self)
`True` if the shape's ancestor is currently selected.
.. method:: ApplyAttachmentOrdering(self, linesToSort)
Apply the line ordering in linesToSort to the shape, to reorder
the way lines are attached.
.. method:: AssignNewIds(self)
Assign new ids to this image and its children.
.. method:: Attach(self, can)
Set the shape's internal canvas pointer to point to the given canvas.
.. method:: AttachmentIsValid(self, attachment)
`True` if attachment is a valid attachment point.
.. method:: AttachmentSortTest(self, attachmentPoint, pt1, pt2)
Return TRUE if pt1 is less than or equal to pt2, in the sense
that one point comes before another on an edge of the shape.
attachment is the attachment point (side) in question.
This function is used in Shape.MoveLineToNewAttachment to determine
the new line ordering.
.. method:: CalcSimpleAttachment(self, pt1, pt2, nth, noArcs, line)
Assuming the attachment lies along a vertical or horizontal line,
calculate the position on that point.
:param `pt1`: The first point of the line representing the edge of
the shape
:param `pt2`: The second point of the line representing the edge of
the shape
:param `nth`: The position on the edge (for example there may be 6
lines at this attachment point, and this may be the 2nd line.
:param `noArcs`: The number of lines at this edge.
:param `line`: The line shape.
:note: This function expects the line to be either vertical or horizontal,
and determines which.
.. method:: ClearAttachments(self)
Clear internal custom attachment point shapes (of class
:class:`~lib.ogl.AttachmentPoint`)
.. method:: ClearRegions(self)
Clear the ShapeRegions from the shape.
.. method:: ClearText(self, regionId = 0)
Clear the text from the specified text region.
:param `regionId`: the region identifier
.. method:: Delete(self)
Fully disconnect this shape from parents, children, the
canvas, etc.
.. method:: DeleteControlPoints(self, dc = None)
Delete the control points (or handles) for the shape.
Does not redraw the shape.
.. method:: Detach(self)
Disassociates the shape from its canvas.
.. method:: Draggable(self)
Is shape draggable?
:returns: `True` if the shape may be dragged by the user.
.. method:: Draw(self, dc)
Draw the whole shape and any lines attached to it.
Do not override this function: override OnDraw, which is called
by this function.
.. method:: DrawContents(self, dc)
Draw the internal graphic of the shape (such as text).
Do not override this function: override OnDrawContents, which
is called by this function.
.. method:: DrawLinks(self, dc, attachment = -1, recurse = False)
Draws any lines linked to this shape.
:param `dc`: the device context
:param `attachment`: ???
:param `recurse`: if `True` recurse through the children
.. method:: Erase(self, dc)
Erase the shape.
Does not repair damage caused to other shapes.
.. method:: EraseContents(self, dc)
Erase the shape contents, that is, the area within the shape's
minimum bounding box.
.. method:: EraseLinks(self, dc, attachment = -1, recurse = False)
Erase links attached to this shape, but do not repair damage
caused to other shapes.
:param `dc`: the device context
:param `attachment`: ???
:param `recurse`: if `True` recurse through the children
.. method:: FindRegion(self, name)
Find the actual image ('this' if non-composite) and region id
for the given region name.
:param str `name`: the region name
.. method:: FindRegionNames(self)
Get a list of all region names for this image (composite or simple).
.. method:: Flash(self)
Flash the shape.
.. method:: FormatText(self, dc, s, i = 0)
Reformat the given text region; defaults to formatting the
default region.
:param `dc`: the device contexr
:param str `s`: the text string
:param int `i`: the region identifier
.. method:: GetAttachmentLineCount(self, attachment)
Get the number of lines at this attachment position.
:param `attachment`: ???
:returns: the count of lines at this position
.. method:: GetAttachmentMode(self)
Get the attachment mode.
See :meth:`Shape.SetAttachmentMode`
.. method:: GetAttachmentPosition(self, attachment, nth = 0, no_arcs = 1, line = None)
Get the position at which the given attachment point should be drawn.
:param `attachment`: the attachment ???
:param `nth`: get nth attachment ???
:param `no_arcs`: ???
:param `line`: ???
If attachment isn't found among the attachment points of the shape,
returns None.
.. method:: GetAttachmentPositionEdge(self, attachment, nth = 0, no_arcs = 1, line = None)
Only get the attachment position at the _edge_ of the shape,
ignoring branching mode. This is used e.g. to indicate the edge of
interest, not the point on the attachment branch.
:param `attachment`: the attachment ???
:param `nth`: get nth attachment ???
:param `no_arcs`: ???
:param `line`: ???
.. method:: GetBackgroundBrush(self)
Return brush of the right colour for the background.
.. method:: GetBackgroundPen(self)
Return pen of the right colour for the background.
.. method:: GetBoundingBoxMax(self)
Get the maximum bounding box for the shape, taking into account
external features such as shadows.
.. method:: GetBoundingBoxMin(self)
Get the minimum bounding box for the shape, that defines the area
available for drawing the contents (such as text).
Must be overridden.
.. method:: GetBranchingAttachmentInfo(self, attachment)
Get information about where branching connections go.
:param `attachment`: ???
:returns: `False` if there are no lines at this attachment.
.. method:: GetBranchingAttachmentPoint(self, attachment, n)
Get branching attachment point.
:param `attachment`: ???
:param `n`: ???
.. method:: GetBranchingAttachmentRoot(self, attachment)
Get the root point at the given attachment.
:param `attachment`: ???
.. method:: GetBranchStyle(self)
Get the branch style.
.. method:: GetBrush(self)
Get the brush used for filling the shape.
.. method:: GetCanvas(self)
Get the internal canvas.
.. method:: GetCentreResize(self)
`True` if the shape is to be resized from the centre (the centre stands
still), or `False` if from the corner or side being dragged (the other
corner or side stands still)
.. method:: GetChildren(self)
Get the list of children for this shape.
.. method:: GetClassName(self)
.. method:: GetDisableLabel(self)
`True` if the default region will not be shown, `False` otherwise.
.. method:: GetDrawHandles(self)
Get the list of drawhandles.
.. method:: GetEventHandler(self)
Get the event handler for this shape.
.. method:: GetFixedHeight(self)
`True` if the shape cannot be resized in the vertical plane.
.. method:: GetFixedSize(self)
Return flags indicating whether the shape is of fixed size in
either direction.
.. method:: GetFixedWidth(self)
`True` if the shape cannot be resized in the horizontal plane.
.. method:: GetFont(self, regionId = 0)
Get the font for the specified text region.
:param `regionId`: the region identifier
.. method:: GetFormatMode(self, regionId = 0)
Get the format mode.
:param `regionId`: the region identifier, default=0
.. method:: GetId(self)
Get the integer identifier for this shape.
.. method:: GetLinePosition(self, line)
Get the zero-based position of line in the list of lines
for this shape.
:param `line`: line to find position for
.. method:: GetLines(self)
Return the list of lines connected to this shape.
.. method:: GetMaintainAspectRatio(self)
`True` if shape keeps aspect ratio during resize.
.. method:: GetNumberOfAttachments(self)
Get the number of attachment points for this shape.
.. method:: GetNumberOfTextRegions(self)
Get the number of text regions for this shape.
.. method:: GetParent(self)
Get the parent of this shape, if it is part of a composite.
.. method:: GetPen(self)
Get the pen used for drawing the shape's outline.
.. method:: GetPerimeterPoint(self, x1, y1, x2, y2)
Get the point at which the line from (x1, y1) to (x2, y2) hits
the shape.
:param `x1`: the x1 position
:param `y1`: the y1 position
:param `x2`: the x2 position
:param `y2`: the y2 position
:returns: `False` if the line doesn't hit the perimeter.
.. method:: GetRegionId(self, name)
Get the region's identifier by name.
:param str `name`: the regions name
:note: This is not unique for within an entire composite, but is unique
for the image.
.. method:: GetRegionName(self, regionId = 0)
Get the region's name.
:param `regionId`: the region identifier
:note: A region's name can be used to uniquely determine a region within
an entire composite image hierarchy. See also
:meth:`~lib.ogl.Shape.SetRegionName`.
.. method:: GetRegions(self)
Get the list of ShapeRegions.
.. method:: GetRotation(self)
Return the angle of rotation in radians.
.. method:: GetSensitivityFilter(self)
Get the sensitivity filter, a bitlist of values.
See :meth:`Shape.SetSensitivityFilter`
.. method:: GetShadowMode(self)
Get the current shadow mode setting.
.. method:: GetSpaceAttachments(self)
Get whether lines should be spaced out evenly at the point they
touch the node (True), or whether they should join at a single point
(False).
.. method:: GetTextColour(self, regionId = 0)
Get the colour for the specified text region.
:param `regionId`: the region identifier
.. method:: GetTopAncestor(self)
Return the top-most ancestor of this shape (the root of
the composite).
.. method:: GetX(self)
Get the x position of the centre of the shape.
.. method:: GetY(self)
Get the y position of the centre of the shape.
.. method:: HasDescendant(self, image)
Is image a descendant of this composite.
:param `image`: the image, is this a shape???
:returns: `True` if it is a descendant
.. method:: HitTest(self, x, y)
Given a point on a canvas, returns `True` if the point was on the
shape, and returns the nearest attachment point and distance from
the given point and target.
:param `x`: the x position
:param `y`: the y position
.. method:: InsertInCanvas(self, theCanvas)
Insert the shape at the front of the shape list of canvas.
:param `theCanvas`: an instance of :class:`~lib.ogl.Canvas`
.. method:: IsHighlighted(self)
`True` if the shape is highlighted. Shape highlighting is unimplemented.
.. method:: IsShown(self)
`True` if the shape is in a visible state, `False` otherwise.
:note: That this has nothing to do with whether the window is hidden
or the shape has scrolled off the canvas; it refers to the internal
visibility flag.
.. method:: LogicalToPhysicalAttachment(self, logicalAttachment)
Rotate the standard attachment point from logical
to physical (0 is always North).
:param `logicalAttachment`: ???
.. method:: MakeControlPoints(self)
Make a list of control points (draggable handles) appropriate to
the shape.
.. method:: MakeMandatoryControlPoints(self)
Make the mandatory control points.
For example, the control point on a dividing line should appear even
if the divided rectangle shape's handles should not appear (because
it is the child of a composite, and children are not resizable).
.. method:: Move(self, dc, x, y, display = True)
Move the shape to the given position.
:param `dc`: the device context
:param `x`: the x position
:param `y`: the y position
:param `display`: if `True` redraw
.. method:: MoveLineToNewAttachment(self, dc, to_move, x, y)
Move the given line (which must already be attached to the shape)
to a different attachment point on the shape, or a different order
on the same attachment.
Calls Shape.AttachmentSortTest and then
ShapeEvtHandler.OnChangeAttachment.
.. method:: MoveLinks(self, dc)
Redraw all the lines attached to the shape.
.. method:: NameRegions(self, parentName="")
Make unique names for all the regions in a shape or composite shape.
:param str `parentName`: a prefix for the region names
.. method:: OnBeginDragLeft(self, x, y, keys = 0, attachment = 0)
The begin drag left handler.
.. method:: OnBeginDragRight(self, x, y, keys = 0, attachment = 0)
The begin drag right handler.
.. method:: OnChangeAttachment(self, attachment, line, ordering)
Change attachment handler.
.. method:: OnDragLeft(self, draw, x, y, keys = 0, attachment = 0)
The drag left handler.
.. method:: OnDragRight(self, draw, x, y, keys = 0, attachment = 0)
The drag right handler.
.. method:: OnDraw(self, dc)
not implemented???
.. method:: OnDrawBranches(self, dc, erase = False)
The draw branches handler.
.. method:: OnDrawBranchesAttachment(self, dc, attachment, erase = False)
The draw branches attachment handler.
.. method:: OnDrawContents(self, dc)
The draw contents handler.
.. method:: OnDrawControlPoints(self, dc)
The draw control points handler.
.. method:: OnDrawOutline(self, dc, x, y, w, h)
The draw outline handler.
.. method:: OnEndDragLeft(self, x, y, keys = 0, attachment = 0)
The end drag left handler.
.. method:: OnEndDragRight(self, x, y, keys = 0, attachment = 0)
The end drag right handler.
.. method:: OnErase(self, dc)
The erase handler.
.. method:: OnEraseContents(self, dc)
The erase contents handler.
.. method:: OnEraseControlPoints(self, dc)
The erase control points handler.
.. method:: OnHighlight(self, dc)
not implemented???
.. method:: OnLeftClick(self, x, y, keys = 0, attachment = 0)
The left click handler.
.. method:: OnMoveLinks(self, dc)
The move links handler.
.. method:: OnMovePre(self, dc, x, y, old_x, old_y, display = True)
The pre move handler.
.. method:: OnRightClick(self, x, y, keys = 0, attachment = 0)
The right click handler.
.. method:: OnSize(self, x, y)
not implemented???
.. method:: OnSizingBeginDragLeft(self, pt, x, y, keys = 0, attachment = 0)
The sizing begin drag left handler.
.. method:: OnSizingDragLeft(self, pt, draw, x, y, keys = 0, attachment = 0)
The sizing drag left handler.
.. method:: OnSizingEndDragLeft(self, pt, x, y, keys = 0, attachment = 0)
The sizing end drag left handler.
.. method:: PhysicalToLogicalAttachment(self, physicalAttachment)
Rotate the standard attachment point from physical
(0 is always North) to logical (0 -> 1 if rotated by 90 degrees)
:param `physicalAttachment`: ???
.. method:: Recentre(self, dc)
Recentre (or other formatting) all the text regions for this shape.
.. method:: Recompute(self)
Recomputes any constraints associated with the shape.
Normally applicable to CompositeShapes only, but harmless for
other classes of Shape.
.. method:: RemoveFromCanvas(self, theCanvas)
Remove the shape from the canvas.
:param `theCanvas`: an instance of :class:`~lib.ogl.Canvas`
.. method:: RemoveLine(self, line)
Remove the given line from the shape's list of attached lines.
:param `line`: an instance of :class:`~lib.ogl.LineShape`
.. method:: ResetControlPoints(self)
Reset the positions of the control points (for instance when the
shape's shape has changed).
.. method:: ResetMandatoryControlPoints(self)
Reset the mandatory control points.
.. method:: Rotate(self, x, y, theta)
Rotate about the given axis by the given amount in radians.
:param `x`: the x position
:param `y`: the y position
:param `theta`: the theta
.. method:: Select(self, select, dc = None)
Select or deselect the given shape, drawing or erasing control points
(handles) as necessary.
:param `select`: `True` to select
:param `dc`: the device context
.. method:: Selected(self)
`True` if the shape is currently selected.
.. method:: SetAttachmentMode(self, mode)
Set the attachment mode.
:param `mode`: if `True` attachment points will be significant when
drawing lines to and from this shape. If `False` lines will be drawn
as if to the centre of the shape.
.. method:: SetAttachmentSize(self, w, h)
Set the attachment size.
:param `w`: width
:param `h`: height
.. method:: SetBrush(self, the_brush)
Set the brush for filling the shape's shape.
.. method:: SetCanvas(self, theCanvas)
Set the canvas, identical to Shape.Attach.
:param `theCanvas`: an instance of :class:`~lib.ogl.Canvas`
.. method:: SetCentreResize(self, cr)
Specify whether the shape is to be resized from the centre (the
centre stands still) or from the corner or side being dragged (the
other corner or side stands still).
.. method:: SetDefaultRegionSize(self)
Set the default region to be consistent with the shape size.
.. method:: SetDisableLabel(self, flag)
Set flag to `True` to stop the default region being shown.
.. method:: SetDraggable(self, drag, recursive = False)
Set the shape to be draggable or not draggable.
:param `drag`: if `True` make shape draggable
:param `recursive`: if `True` recurse through children
.. method:: SetDrawHandles(self, drawH)
Set the drawHandles flag for this shape and all descendants.
:param `drawH`: if `True` (the default), any handles (control points)
will be drawn. Otherwise, the handles will not be drawn.
.. method:: SetEventHandler(self, handler)
Set the event handler for this shape.
:param `handler`: an instance of :class:`ShapeEvtHandler`
.. method:: SetFixedSize(self, x, y)
Set the shape to be fixed size.
:param `x`: the width
:param `y`: the height
.. method:: SetFont(self, the_font, regionId = 0)
Set the font for the specified text region.
:param `the_font`: an instance of :class:`wx.Font` ???
:param `regionId`: the region identifier
.. method:: SetFormatMode(self, mode, regionId = 0)
Set the format mode of the region.
:param `mode`: can be a bit list of the following
============================== ==============================
Format mode Description
============================== ==============================
`FORMAT_NONE` No formatting
`FORMAT_CENTRE_HORIZ` Horizontal centring
`FORMAT_CENTRE_VERT` Vertical centring
============================== ==============================
:param `regionId`: the region identifier, default=0
.. method:: SetHighlight(self, hi, recurse = False)
Set the highlight for a shape. Shape highlighting is unimplemented.
.. method:: SetId(self, i)
Set the integer identifier for this shape.
.. method:: SetMaintainAspectRatio(self, ar)
Set whether a shape that resizes should not change the aspect ratio
(width and height should be in the original proportion).
.. method:: SetParent(self, p)
Set the parent
:param `p`: the parent
.. method:: SetPen(self, the_pen)
Set the pen for drawing the shape's outline.
.. method:: SetRegionName(self, name, regionId = 0)
Set the name for this region.
:param str `name`: the name to set
:param `regionId`: the region identifier
:note: The name for a region is unique within the scope of the whole
composite, whereas a region id is unique only for a single image.
.. method:: SetRotation(self, rotation)
Set rotation
:param int `rotation`: rotation
.. method:: SetSensitivityFilter(self, sens = OP_ALL, recursive = False)
Set the shape to be sensitive or insensitive to specific mouse
operations.
:param `sens`: is a bitlist of the following:
========================== ===================
Mouse operation Description
========================== ===================
`OP_CLICK_LEFT` left clicked
`OP_CLICK_RIGHT` right clicked
`OP_DRAG_LEFT` left drag
`OP_DRAG_RIGHT` right drag
`OP_ALL` all of the above
========================== ===================
:param `recursive`: if `True` recurse through children
.. method:: SetShadowMode(self, mode, redraw = False)
Set the shadow mode (whether a shadow is drawn or not).
:param `mode`: can be one of the following:
=============================== ===========================
Shadow mode Description
=============================== ===========================
`SHADOW_NONE` No shadow (the default)
`SHADOW_LEFT` Shadow on the left side
`SHADOW_RIGHT` Shadow on the right side
=============================== ===========================
.. method:: SetShape(self, sh)
Set shape ???
:param `sh`: an instance of :class:`Shape`
.. method:: SetSize(self, x, y, recursive = True)
Set the shape's size.
:param `x`: the x position
:param `y`: the y position
:param `recursive`: not used
.. method:: SetSpaceAttachments(self, sp)
Indicate whether lines should be spaced out evenly at the point
they touch the node.
:param `sp`: if `True` space out evently, else they should join at a
single point.
.. method:: SetTextColour(self, the_colour, regionId = 0)
Set the colour for the specified text region.
:param str `the_colour`: a valid colour name,
see :class:`wx.ColourDatabase`
:param `regionId`: the region identifier
.. method:: SetX(self, x)
Set the x position of the shape.
:param `x`: the x position
.. method:: SetY(self, y)
Set the y position of the shape.
:param `y`: the y position
.. method:: Show(self, show)
Set a flag indicating whether the shape should be drawn.
.. method:: SortLines(self, attachment, linesToSort)
Reorder the lines coming into the node image at this attachment
position, in the order in which they appear in linesToSort.
Any remaining lines not in the list will be added to the end.
|