.. 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
Inheritance diagram for class Shape:
| |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 not ``None``, 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. .. seealso:: :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.