Potku  1.0.0
Class Documentation
 All Classes Namespaces Functions
Modules.Selection.Selector Class Reference

Public Member Functions

def __init__
 
def count
 
def is_empty
 
def get_at
 
def get_selected
 
def add_point
 
def undo_point
 
def purge
 
def remove_selected
 
def remove_all
 
def distance
 
def draw
 
def end_open_selection
 
def select
 
def reset_select
 
def reset_colors
 
def get_colors
 
def grey_out_except
 
def auto_save
 
def load
 
def update_axes_limits
 
def transpose
 

Public Attributes

 element_colormap
 
 settings
 
 measurement_name
 
 directory
 
 selection_file
 
 selections
 
 new_selection_is_allowed
 
 is_transposed
 
 looseness
 
 axes
 
 axes_limits
 
 selected_id
 
 draw_legend
 
 masses
 

Detailed Description

Selector objects handles all selections within measurement.

Constructor & Destructor Documentation

def Modules.Selection.Selector.__init__ (   self,
  directory,
  measurement_name,
  masses,
  element_colormap,
  settings 
)
Inits Selector.

Inits Selector object.

Args:
    filepath: String representing filepath of measurement data (ascii file).
    masses: Reference to element masses object of main program.
    element_colormap: Default colors for new element selections.
    settings: Measurement's settings to which selector belongs. 
      (for selection dialog)

Member Function Documentation

def Modules.Selection.Selector.add_point (   self,
  point,
  canvas 
)
Adds a new point.

Adds a new point to last selection. If new selection is allowed, create
a new selection to which point is added. If point is in close proximity
of first point in (last) Selection, then close selection and allow new 
selection to be made.

Args:
    point: Point (x, y) to be added to selection.
    canvas: matplotlib's FigureCanvas where selections are drawn.
    
Return:
    1: When point closes open selection and allows new selection to 
be made.
    0: When point was added to open selection.
    -1: When new selection is not allowed and there are no selections.
def Modules.Selection.Selector.auto_save (   self)
Save all selections into a file.
def Modules.Selection.Selector.count (   self)
Get count of selections.

Return:
    Returns the count of selections in selector object.
def Modules.Selection.Selector.distance (   self,
  p0,
  p1 
)
Distance between points

Calculates and returns distance between two points.

Args:
    p0: Point A
    p1: Point B

Return:
    Distance (float) between two points.
def Modules.Selection.Selector.draw (   self)
Draw selections.

Issue draw to all selections in selector.
def Modules.Selection.Selector.end_open_selection (   self,
  canvas 
)
End last open selection.

Ends last open selection. If selection is open, it will show dialog to 
select element information and draws into canvas before opening the dialog.

Args:
    canvas: Matplotlib's FigureCanvas

Return:
    1: If selection closed
    0: Otherwise
def Modules.Selection.Selector.get_at (   self,
  index 
)
Get selection at index.

Args:
    index: Integer of index we want to get from selections.
    
Return:
    Returns Selection at said index. If index is out of range, returns None.
def Modules.Selection.Selector.get_colors (   self)
Get colors of each selection in selector.

Return:
    Returns dictionary of all element selections and their colors.
def Modules.Selection.Selector.get_selected (   self)
Get currently selected selection.

Return:
    Returns Selection of selected Selection on matplotlib graph. If none 
    selected, returns None.
def Modules.Selection.Selector.grey_out_except (   self,
  selected_id 
)
Grey out all selections except selected one.

Sets all selections' colors to grey except selected, which is set to red.

Args:
    selected_id: Integer of selected selection id 
def Modules.Selection.Selector.is_empty (   self)
Check if no selections.

Return:
    Returns True if no selections.
def Modules.Selection.Selector.load (   self,
  filename 
)
Load selections from a file.

Removes all current selections and loads selections from given filename.

Args:
    filename: String representing (full) path to selection file.
def Modules.Selection.Selector.purge (   self)
Purges (removes) all open selections and allows new selection to be made.
def Modules.Selection.Selector.remove_all (   self)
Remove all selections in selector.
def Modules.Selection.Selector.remove_selected (   self)
Remove selected selection.

Removes selected selection if one is selected. Otherwise do nothing.
def Modules.Selection.Selector.reset_colors (   self)
Reset selection colors.

Reset all selections' colors to their default values.
def Modules.Selection.Selector.reset_select (   self)
Reset selection to None.

Resets current selection to None and resets colors of all selections
to their default values. 
def Modules.Selection.Selector.select (   self,
  point,
  highlight = True 
)
Select a selection based on point.

Args:
    point: Point (x, y) which is clicked on the graph to select selection.
    highlight: Boolean to determine whether to highlight just this 
       selection.
    
Return:
    1: If point is within selection.
    0: If point is not within selection.
def Modules.Selection.Selector.transpose (   self,
  is_transposed 
)
Transpose graph axes.

Args:
    is_transposed: Boolean representing whether axes are transposed.
def Modules.Selection.Selector.undo_point (   self)
Undo last point in open (last) selection.

Undo last point in open (last) selection. If there are no selections, 
do nothing.
def Modules.Selection.Selector.update_axes_limits (   self)
Update selector's axes limits based on all points in all selections.

The documentation for this class was generated from the following file: