def process_draw(self, gc: wx.GraphicsContext): gc.SetBrush(self.background_brush) gc.DrawRectangle(self.left, self.top, self.right, self.bottom) gc.SetBrush(self.lacking_brush) gc.SetPen(self.lacking_pen) gc.DrawLines([(self.start_x, self.start_y), (self.end_x, self.end_y)]) for idx, value in enumerate(self.values): amount = self.value_to_position(value) tx = amount * (self.end_x - self.start_x) + self.start_x ty = amount * (self.end_y - self.start_y) + self.start_y gc.SetBrush(self.selected_brush) gc.SetPen(self.selected_pen) gc.DrawLines([(self.start_x, self.start_y), (tx, ty)]) gc.DrawEllipse(tx - BLIP_RADIUS / 2, ty - BLIP_RADIUS / 2, BLIP_RADIUS, BLIP_RADIUS) if self.moving and self.seeker == idx: gc.SetBrush(self.moving_brush) gc.DrawEllipse( tx - MOVE_RADIUS / 2, ty - MOVE_RADIUS / 2, MOVE_RADIUS, MOVE_RADIUS, ) if self.seeker != -1: try: gc.DrawText( f"{self.values[self.seeker]:.2f}", self.start_x, self.start_y, ) except IndexError: pass
def process_draw(self, gc: wx.GraphicsContext): if self.p1 is not None and self.p2 is not None: x0 = min(self.p1.real, self.p2.real) y0 = min(self.p1.imag, self.p2.imag) x1 = max(self.p1.real, self.p2.real) y1 = max(self.p1.imag, self.p2.imag) if self.scene.context.elements.default_stroke is None: self.pen.SetColour(wx.BLUE) else: self.pen.SetColour( wx.Colour( swizzlecolor( self.scene.context.elements.default_stroke))) gc.SetPen(self.pen) if self.scene.context.elements.default_fill is None: gc.SetBrush(wx.TRANSPARENT_BRUSH) else: gc.SetBrush( wx.Brush( wx.Colour( swizzlecolor( self.scene.context.elements.default_fill)), wx.BRUSHSTYLE_SOLID, )) ellipse = Circle((x1 + x0) / 2.0, (y1 + y0) / 2.0, abs(self.p1 - self.p2) / 2) t = Path(ellipse) bbox = t.bbox() if bbox is not None: gc.DrawEllipse(bbox[0], bbox[1], bbox[2] - bbox[0], bbox[3] - bbox[1])
def draw_brush(self, gc: wx.GraphicsContext): gc.SetBrush(self.brush_fill) gc.DrawEllipse( self.pos.real - self.tool_size / 2.0, self.pos.imag - self.tool_size / 2.0, self.tool_size, self.tool_size, )
def process_draw(self, gc: wx.GraphicsContext): if self.scene.context.elements.default_stroke is None: self.pen.SetColour(wx.BLUE) else: self.pen.SetColour( wx.Colour( swizzlecolor(self.scene.context.elements.default_stroke))) gc.SetPen(self.pen) gc.SetBrush(wx.RED_BRUSH) gc.DrawEllipse(self.track_object[0], self.track_object[1], 5000, 5000) if self.last_position: gc.DrawEllipse(self.last_position[0], self.last_position[1], 5000, 5000) if self.series is not None and len(self.series) > 1: gc.SetPen(self.pen) gc.StrokeLines(self.series)
def draw_point(self, gc: wx.GraphicsContext, point: Vec2, radius: float): """ Drawing a single point. Args: gc: Graphics context to modify. point: Point to be drawn. radius: Radius of the point. """ gc.DrawEllipse(*(point - Vec2.repeat(radius / 2)), radius, radius)
def draw_point(self, gc: wx.GraphicsContext, point: Vec2, radius: float): """ Drawing a single point. Args: self: the Designer Window to initialize. gc (wx.GraphixContext): Graphics context to modify. point (Vect2): Point to be drawn. radius (float): radius for the point. """ gc.DrawEllipse(*(point - Vec2.repeat(radius / 2)), radius, radius)
def do_paint(self, gc: wx.GraphicsContext): self.bezier.do_paint(gc, self.reaction.fill_color, self.selected) # draw centroid color = theme[ 'handle_color'] if self.selected else self.reaction.fill_color pen = wx.Pen(color) brush = wx.Brush(color) gc.SetPen(pen) gc.SetBrush(brush) radius = settings['reaction_radius'] * cstate.scale center = self.bezier.centroid * cstate.scale - Vec2.repeat(radius) gc.DrawEllipse(center.x, center.y, radius * 2, radius * 2)
def paint_handle(gc: wx.GraphicsContext, base: Vec2, handle: Vec2, hovering: bool): """Paint the handle as given by its base and tip positions, highlighting it if hovering.""" c = get_theme('highlighted_handle_color') if hovering else get_theme('handle_color') brush = wx.Brush(c) pen = gc.CreatePen(wx.GraphicsPenInfo(c)) gc.SetPen(pen) # Draw handle lines gc.StrokeLine(*base, *handle) # Draw handle circles gc.SetBrush(brush) gc.DrawEllipse(handle.x - HANDLE_RADIUS, handle.y - HANDLE_RADIUS, 2 * HANDLE_RADIUS, 2 * HANDLE_RADIUS)
def process_draw(self, gc: wx.GraphicsContext): if self.p1 is not None and self.p2 is not None: x0 = min(self.p1.real, self.p2.real) y0 = min(self.p1.imag, self.p2.imag) x1 = max(self.p1.real, self.p2.real) y1 = max(self.p1.imag, self.p2.imag) if self.scene.context.elements.default_stroke is None: self.pen.SetColour(wx.BLUE) else: self.pen.SetColour(wx.Colour(swizzlecolor(self.scene.context.elements.default_stroke))) gc.SetPen(self.pen) if self.scene.context.elements.default_fill is None: gc.SetBrush(wx.TRANSPARENT_BRUSH) else: gc.SetBrush( wx.Brush( wx.Colour(swizzlecolor(self.scene.context.elements.default_fill)), wx.BRUSHSTYLE_SOLID, ) ) gc.DrawEllipse(x0, y0, x1 - x0, y1 - y0)
def do_paint(self, gc: wx.GraphicsContext): """Paint the handle as given by its base and tip positions, highlighting it if hovering.""" assert self.data.base is not None c = theme['highlighted_handle_color'] if self.hovering else theme[ 'handle_color'] brush = wx.Brush(c) pen = gc.CreatePen(wx.GraphicsPenInfo(c)) sbase = self.data.base * cstate.scale stip = self.data.tip * cstate.scale gc.SetPen(pen) # Draw handle lines gc.StrokeLine(*sbase, *stip) # Draw handle circles gc.SetBrush(brush) gc.DrawEllipse(stip.x - BezierHandle.HANDLE_RADIUS, stip.y - BezierHandle.HANDLE_RADIUS, 2 * BezierHandle.HANDLE_RADIUS, 2 * BezierHandle.HANDLE_RADIUS)