diff --git a/src/miniogl/LineShape.py b/src/miniogl/LineShape.py index 46b2f11..9ba8437 100644 --- a/src/miniogl/LineShape.py +++ b/src/miniogl/LineShape.py @@ -10,10 +10,12 @@ from logging import getLogger from wx import BLACK_BRUSH +from wx import RED_BRUSH +from wx import WHITE_BRUSH from wx import BLACK_PEN -from wx import DC from wx import RED_PEN -from wx import WHITE_BRUSH + +from wx import DC from miniogl.Common import Common from miniogl.Common import CommonLine @@ -244,17 +246,16 @@ def Draw(self, dc: DC, withChildren: bool = True): if self._selected: dc.SetPen(RED_PEN) if self._spline: - dc.SetPen(self.pen) dc.DrawSpline(line) else: - dc.SetPen(self.pen) dc.DrawLines(line) + for control in self._controls: control.Draw(dc) if self._selected: self._srcAnchor.Draw(dc) self._dstAnchor.Draw(dc) - dc.SetPen(BLACK_PEN) + if self._drawArrow: u, v = line[-2], line[-1] self.DrawArrow(dc, u, v) @@ -262,6 +263,8 @@ def Draw(self, dc: DC, withChildren: bool = True): # LineShape.clsLogger.debug(f'Call DrawChildren()') self.DrawChildren(dc) + dc.SetPen(BLACK_PEN) + def DrawBorder(self, dc): """ Draw the border of the shape, for fast rendering. @@ -307,10 +310,17 @@ def DrawArrow(self, dc: DC, u: Tuple[int, int], v: Tuple[int, int]): ] if self.fillArrow is True: - dc.SetBrush(BLACK_BRUSH) + if self._selected is True: + dc.SetBrush(RED_BRUSH) + else: + dc.SetBrush(BLACK_BRUSH) else: dc.SetBrush(WHITE_BRUSH) + if self._selected is True: + dc.SetPen(RED_PEN) + else: + dc.SetPen(BLACK_PEN) dc.DrawPolygon(points) dc.SetBrush(WHITE_BRUSH) diff --git a/src/ogl/OglAssociation.py b/src/ogl/OglAssociation.py index d542438..16b4ef2 100644 --- a/src/ogl/OglAssociation.py +++ b/src/ogl/OglAssociation.py @@ -14,13 +14,15 @@ from math import cos from math import sin -from wx import BLACK_BRUSH from wx import BLACK_PEN +from wx import RED_PEN +from wx import BLACK_BRUSH +from wx import RED_BRUSH +from wx import WHITE_BRUSH from wx import DC from wx import FONTFAMILY_DEFAULT from wx import FONTSTYLE_NORMAL from wx import FONTWEIGHT_NORMAL -from wx import WHITE_BRUSH from wx import Font @@ -172,9 +174,17 @@ def drawDiamond(self, dc: DC, filled: bool = False): points: DiamondPoints = OglAssociation.calculateDiamondPoints(lineSegments=line) # self.oglAssociationLogger.debug(f'{points:}') - dc.SetPen(BLACK_PEN) + if self._selected is True: + dc.SetPen(RED_PEN) + else: + dc.SetPen(BLACK_PEN) + if filled: - dc.SetBrush(BLACK_BRUSH) + if self._selected is True: + dc.SetBrush(RED_BRUSH) + else: + dc.SetBrush(BLACK_BRUSH) + else: dc.SetBrush(WHITE_BRUSH) dc.DrawPolygon(points) diff --git a/src/ogl/OglInterface.py b/src/ogl/OglInterface.py index d49d653..d9cf73a 100644 --- a/src/ogl/OglInterface.py +++ b/src/ogl/OglInterface.py @@ -81,6 +81,7 @@ def Draw(self, dc: DC, withChildren: bool = True): """ self.updateLabels() if self._visible: + line = self.segments if self._selected: dc.SetPen(RED_PEN) @@ -99,7 +100,6 @@ def Draw(self, dc: DC, withChildren: bool = True): if self._selected: self._srcAnchor.Draw(dc) self._dstAnchor.Draw(dc) - dc.SetPen(BLACK_PEN) if self._drawArrow: u, v = line[-2], line[-1] @@ -108,5 +108,7 @@ def Draw(self, dc: DC, withChildren: bool = True): if withChildren is True: self.DrawChildren(dc) + dc.SetPen(BLACK_PEN) + def __repr__(self): return f'OglInterface - {super().__repr__()}' diff --git a/src/ogl/_version.py b/src/ogl/_version.py index bce5982..575236d 100644 --- a/src/ogl/_version.py +++ b/src/ogl/_version.py @@ -1 +1 @@ -__version__ = '3.6.1' +__version__ = '3.6.2'