Exemplo n.º 1
0
    def draw(self, canvas):
    
        x, y = canvas.pos_to_pixel(self.x, self.y)

        light_color = self.light_color        
        dark_color  = self.dark_color

        dark_grey   = wx.Colour(60, 60, 60)
        light_grey  = wx.Colour(100, 100, 100)
    
        if self.valid and not self.deleted:
            canvas.dc.SetBrush(wx.Brush(dark_color))
            if self.dragging or self.hover:
                x0 = x - math.cos(self.angle)*10
                x1 = x + math.cos(self.angle)*10
                y0 = y + math.sin(self.angle)*10
                y1 = y - math.sin(self.angle)*10
                if self._offset_free:
                    canvas.dc.SetPen(wx.Pen(light_color, 8))
                    canvas.dc.DrawLine(x0, y0, x1, y1)
                    canvas.dc.SetPen(wx.Pen(dark_color, 4))
                    canvas.dc.DrawLine(x0, y0, x1, y1)
                else:
                    canvas.dc.SetPen(wx.Pen(light_grey,8 ))
                    canvas.dc.DrawLine(x0, y0, x1, y1)
                    canvas.dc.SetPen(wx.Pen(dark_grey, 4))
                    canvas.dc.DrawLine(x0, y0, x1, y1)                
        
        Point.draw(self, canvas)
Exemplo n.º 2
0
    def draw(self, canvas):
        x, y = canvas.pos_to_pixel(self.x, self.y)
        
        light_color = self.light_color        
        dark_color  = self.dark_color
        
        dark_grey   = wx.Colour(60, 60, 60)
        light_grey  = wx.Colour(100, 100, 100)

            
        if self.valid and not self.deleted:
            
            # If the point is being dragged, draw small
            # arrows to show in which ways it is free
            if self.dragging or self.hover:
                if self._x_free:
                    canvas.dc.SetPen(wx.Pen(light_color, 8))
                else:
                    canvas.dc.SetPen(wx.Pen(light_grey, 8))
                canvas.dc.DrawLine(x-10, y, x+10, y)
                
                if self._y_free:
                    canvas.dc.SetPen(wx.Pen(light_color, 8))
                else:
                    canvas.dc.SetPen(wx.Pen(light_grey, 8))
                canvas.dc.DrawLine(x, y-10, x, y+10)
                    
                if self._x_free:
                    canvas.dc.SetPen(wx.Pen(dark_color, 4))
                else:
                    canvas.dc.SetPen(wx.Pen(dark_grey, 4))
                canvas.dc.DrawLine(x-10, y, x+10, y)
                
                if self._y_free:
                    canvas.dc.SetPen(wx.Pen(dark_color, 4))
                else:
                    canvas.dc.SetPen(wx.Pen(dark_grey, 4))
                canvas.dc.DrawLine(x, y-10, x, y+10)
        
        Point.draw(self, canvas)