mxcubecore.HardwareObjects.mockup.ShapeHistoryMockup#

Contains the classes

  • ShapeHistory

  • Shape

  • Point

  • Line

  • CanvasGrid

ShapeHistory keeps track of the current shapes the user has created. The shapes handled are any that inherits the Shape base class. There are currently two shapes implemented Point and Line.

Point is the graphical representation of a centred position. A point can be stored and managed by the ShapeHistory. the Line object represents a line between two Point objects.

Classes

Line(drawing, start_qub_p, end_qub_p, ...)

Point(drawing, centred_position, screen_pos)

Shape()

Base class for shapes.

ShapeHistoryMockup(name)

Keeps track of the current shapes the user has created.

class mxcubecore.HardwareObjects.mockup.ShapeHistoryMockup.Line(drawing, start_qub_p, end_qub_p, start_cpos, end_cpos)[source]#

Bases: Shape

get_centred_positions()[source]#
Returns:

The centred position(s) associated with the shape.

Return type:

List of CentredPosition objects.

get_hit(x, y)[source]#
Returns:

True if the shape was hit by the mouse.

get_qub_objects()[source]#
Returns:

A list of qub objects.

hide()[source]#

Hides the shape.

highlight()[source]#

Highlights the shape

move(new_positions)[source]#

Moves the shape to the position <new_position>

show()[source]#

Shows the shape.

unhighlight()[source]#

Removes highlighting.

class mxcubecore.HardwareObjects.mockup.ShapeHistoryMockup.Point(drawing, centred_position, screen_pos)[source]#

Bases: Shape

draw(screen_pos)[source]#

Draws a qub point in the sample video.

get_centred_positions()[source]#
Returns:

The centred position(s) associated with the shape.

Return type:

List of CentredPosition objects.

hide()[source]#

Hides the shape.

highlight()[source]#

Highlights the shape

move(new_positions)[source]#

Moves the shape to the position <new_position>

show()[source]#

Shows the shape.

unhighlight()[source]#

Removes highlighting.

class mxcubecore.HardwareObjects.mockup.ShapeHistoryMockup.Shape[source]#

Bases: object

Base class for shapes.

draw()[source]#

Draws the shape on its drawing.

get_centred_positions()[source]#
Returns:

The centred position(s) associated with the shape.

Return type:

List of CentredPosition objects.

get_drawing()[source]#
Returns:

The drawing on which the shape is drawn.

Return type:

QDrawing

get_hit(x, y)[source]#
Returns:

True if the shape was hit by the mouse.

get_qub_objects()[source]#
Returns:

A list of qub objects.

hide()[source]#

Hides the shape.

highlight()[source]#

Highlights the shape

move(new_positions)[source]#

Moves the shape to the position <new_position>

show()[source]#

Shows the shape.

unhighlight()[source]#

Removes highlighting.

class mxcubecore.HardwareObjects.mockup.ShapeHistoryMockup.ShapeHistoryMockup(name)[source]#

Bases: HardwareObject

Keeps track of the current shapes the user has created. The shapes handled are any that inherits the Shape base class.

add_shape(shape)[source]#

Adds the shape <shape> to the list of handled objects.

Parameters:

shape (Shape object.) – Shape to add.

clear_all()[source]#

Clear the shape history, remove all contents.

delete_shape(shape)[source]#

Removes the shape <shape> from the list of handled shapes.

Parameters:

shape (Shape object.) – The shape to remove

get_drawing()[source]#
Returns:

Returns the drawing of the shapes.

Return type:

QubDrawing

get_points()[source]#
Returns:

All points currently handled

get_qimage(image, canvas, zoom=1)[source]#

Gets the QImage from a parent widget.

Parameters:
  • image (QWidget) – The QWidget that contains the image to extract

  • canvas (QCanvas) – The QCanvas obejct to add as overlay

  • zoom (int.) – Zoom level

Returns:

The QImage contained in the parent widget.

Return type:

QImage

get_shapes()[source]#
Returns:

All the shapes currently handled.

get_snapshot(qub_objects)[source]#

Get a snapshot of the video stream and overlay the objects in qub_objects.

Parameters:

qub_objects (QCanvas) – The QCanvas object to add on top of the video.

Returns:

The snapshot

Return type:

QImage

move_shape(shape, new_positions)[source]#

Moves the shape <shape> to the position <new_position>

Parameters:
  • shape (Shape) – The shape to move

  • new_position (<int, int>) – A tuple (X, Y)

set_drawing(drawing)[source]#

Sets the drawing the Shape objects that are managed are drawn on.

Parameters:

drawing (QubDrawing (used by Qub)) – The drawing that the shapes are drawn on.

Returns:

None