Package qubx :: Module plot :: Class RulerPlot
[hide private]
[frames] | no frames]

Class RulerPlot

source code

        object --+                
                 |                
        ??.GObject --+            
                     |            
            gtk.Object --+        
                         |        
        object --+       |        
                 |       |        
gobject.GInterface --+   |        
                     |   |        
  atk.ImplementorIface --+        
                         |        
        object --+       |        
                 |       |        
gobject.GInterface --+   |        
                     |   |        
         gtk.Buildable --+        
                         |        
                gtk.Widget --+    
                             |    
               gtk.DrawingArea --+
                                 |
                                RulerPlot
Known Subclasses:

Base class for math-style 2D plots.

Instance Methods [hide private]
 
__init__(self, margin=10, rule_xpix=20, rule_ypix=20, rule_xformat='%.3g', rule_yformat=<function <lambda> at 0xdbc1374>, user_xpix=0, user_ypix=0, fgColor=(0, 0, 0), bgColor=(1, 1, 1), drawPoint=False, dataColor=(1, 0, 0), dataColor2=(1, 0.5, 0.5))
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_setBgColor(self, color) source code
 
_setFgColor(self, color) source code
 
_setDataColor(self, color) source code
 
_setDataColor2(self, color) source code
 
_setDrawPoint(self, x) source code
 
_setPointColor(self, color) source code
 
_setPopup(self, x) source code
 
_setShowHint(self, x) source code
 
_setHint(self, x) source code
 
redraw_canvas(self, invalid=0, immediately=False)
Requests various levels of repaint, or does it immediately.
source code
 
_resetPoint(self) source code
 
_setupAxes(self) source code
 
resize_event(self, widget, rect) source code
 
_onXChanged(self, xAxis) source code
 
_onYChanged(self, yAxis) source code
 
button_press(self, widget, event) source code
 
button_release(self, widget, event) source code
 
motion_notify(self, widget, event) source code
 
leave_notify(self, widget, event) source code
 
__updateHintCoords(self, x, y, e) source code
 
transform(self, context, x0, y0, x1, y1, xx0, yy0, xx1, yy1, xPix, yPix)
Translates and scales the cairo context so the rectangle between x0,y0 and x1,y1 is addressed from xx0,yy0 to xx1,yy1.
source code
 
_expose(self, widget, event) source code
 
draw_to_drawable(self, drawable, px0=0, py0=0, width=0, height=0)
Draws everything to drawable with origin px0,py0, resizing if you specify width and height.
source code
 
draw_to_context(self, context, width, height, fat=1.0, unit_width=0.0, reallyDrawPoint=False)
Draws everything to a cairo context with width and height.
source code
 
cairo_create(self, drawable, x0, y0, x1, y1, blank=True)
Returns a cairo context with blanked background and right-handed coordinate system.
source code
 
set_line_width(self, context, perPix, points)
Part of the printing line-width kluge.
source code
 
_drawXrule(self, context, x0, x1, w, h, xPix, yPix) source code
 
_drawYrule(self, context, y0, y1, w, h, xPix, yPix) source code
 
_drawHrule(self, context, minor, major, topline, baseline, fontHeight, a, b, xPix, yPix, format) source code
 
_overlayXrule(self, context, w, h, x0, x1) source code
 
_overlayYrule(self, context, w, h, y0, y1) source code
 
_overlayHrule(self, context, topline, baseline, fontHeight, a, b, xPix, yPix, format, point) source code

Inherited from gtk.DrawingArea: size

Inherited from gtk.Widget: activate, add_accelerator, add_events, add_mnemonic_label, can_activate_accel, child_focus, child_notify, class_path, create_pango_context, create_pango_layout, destroy, do_button_press_event, do_button_release_event, do_can_activate_accel, do_client_event, do_composited_changed, do_configure_event, do_delete_event, do_destroy_event, do_direction_changed, do_drag_begin, do_drag_data_delete, do_drag_data_get, do_drag_data_received, do_drag_drop, do_drag_end, do_drag_leave, do_drag_motion, do_enter_notify_event, do_event, do_expose_event, do_focus, do_focus_in_event, do_focus_out_event, do_get_accessible, do_grab_broken_event, do_grab_focus, do_grab_notify, do_hide, do_hide_all, do_hierarchy_changed, do_key_press_event, do_key_release_event, do_leave_notify_event, do_map, do_map_event, do_mnemonic_activate, do_motion_notify_event, do_no_expose_event, do_parent_set, do_popup_menu, do_property_notify_event, do_proximity_in_event, do_proximity_out_event, do_realize, do_screen_changed, do_scroll_event, do_selection_clear_event, do_selection_get, do_selection_notify_event, do_selection_received, do_selection_request_event, do_show, do_show_all, do_show_help, do_size_allocate, do_size_request, do_state_changed, do_style_set, do_unmap, do_unmap_event, do_unrealize, do_visibility_notify_event, do_window_state_event, drag_begin, drag_check_threshold, drag_dest_add_image_targets, drag_dest_add_text_targets, drag_dest_add_uri_targets, drag_dest_find_target, drag_dest_get_target_list, drag_dest_get_track_motion, drag_dest_set, drag_dest_set_proxy, drag_dest_set_target_list, drag_dest_set_track_motion, drag_dest_unset, drag_get_data, drag_highlight, drag_source_add_image_targets, drag_source_add_text_targets, drag_source_add_uri_targets, drag_source_get_target_list, drag_source_set, drag_source_set_icon, drag_source_set_icon_name, drag_source_set_icon_pixbuf, drag_source_set_icon_stock, drag_source_set_target_list, drag_source_unset, drag_unhighlight, draw, ensure_style, error_bell, event, freeze_child_notify, get_accessible, get_action, get_activate_signal, get_allocation, get_ancestor, get_app_paintable, get_can_default, get_can_focus, get_child_requisition, get_child_visible, get_clipboard, get_colormap, get_composite_name, get_direction, get_display, get_double_buffered, get_events, get_extension_events, get_has_tooltip, get_has_window, get_modifier_style, get_name, get_no_show_all, get_pango_context, get_parent, get_parent_window, get_pointer, get_receives_default, get_root_window, get_screen, get_sensitive, get_settings, get_size_request, get_snapshot, get_state, get_style, get_tooltip_markup, get_tooltip_text, get_tooltip_window, get_toplevel, get_visible, get_visual, get_window, grab_add, grab_default, grab_focus, grab_remove, has_default, has_focus, has_grab, has_screen, hide, hide_all, hide_on_delete, input_shape_combine_mask, intersect, is_ancestor, is_composited, is_drawable, is_focus, is_sensitive, is_toplevel, keynav_failed, list_accel_closures, list_mnemonic_labels, map, menu_get_for_attach_widget, mnemonic_activate, modify_base, modify_bg, modify_cursor, modify_fg, modify_font, modify_style, modify_text, path, queue_clear, queue_clear_area, queue_draw, queue_draw_area, queue_resize, queue_resize_no_redraw, rc_get_style, realize, region_intersect, remove_accelerator, remove_mnemonic_label, render_icon, reparent, reset_rc_styles, reset_shapes, selection_add_target, selection_add_targets, selection_clear_targets, selection_convert, selection_owner_set, selection_remove_all, send_expose, set_accel_path, set_activate_signal, set_app_paintable, set_can_default, set_can_focus, set_child_visible, set_colormap, set_composite_name, set_direction, set_double_buffered, set_events, set_extension_events, set_has_tooltip, set_has_window, set_name, set_no_show_all, set_parent, set_parent_window, set_receives_default, set_redraw_on_allocate, set_scroll_adjustments, set_sensitive, set_set_scroll_adjustments_signal, set_size_request, set_state, set_style, set_tooltip_markup, set_tooltip_text, set_tooltip_window, set_uposition, set_usize, set_visible, set_window, shape_combine_mask, show, show_all, show_now, size_allocate, size_request, style_get_property, thaw_child_notify, translate_coordinates, trigger_tooltip_query, unmap, unparent, unrealize

Inherited from gtk.Object: do_destroy, flags, remove_data, remove_no_notify, set_flags, unset_flags

Inherited from unreachable.GObject: __cmp__, __copy__, __deepcopy__, __delattr__, __gdoc__, __gobject_init__, __hash__, __new__, __repr__, __setattr__, chain, connect, connect_after, connect_object, connect_object_after, disconnect, disconnect_by_func, emit, emit_stop_by_name, freeze_notify, get_data, get_properties, get_property, handler_block, handler_block_by_func, handler_disconnect, handler_is_connected, handler_unblock, handler_unblock_by_func, notify, props, set_data, set_properties, set_property, stop_emission, thaw_notify, weak_ref

Inherited from atk.ImplementorIface: ref_accessible

Inherited from gtk.Buildable: add_child, construct_child, do_add_child, do_construct_child, do_get_internal_child, do_parser_finished, do_set_name, get_internal_child, parser_finished

Inherited from object: __format__, __getattribute__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from gtk.DrawingArea: __gtype__

Instance Variables [hide private]
  margin
  bgColor
  fgColor
  dataColor
  dataColor2
  drawPoint
  pointColor
cross-hairs color
  popup
gtk.Menu on right-click, default None
  OnDblClick
WeakEvent(x, y, e) double-click at plot coords x,y; event e
  OnDrag
WeakEvent(x, y, e) mouse-move when down
  OnOverlay
WeakEvent(RulerPlot, cr, xPix, yPix) draw overtop the main plot, using cairo context cr in plot coords; xPix, yPix are the dimensions of a pixel in plot coords
  OnPlot
WeakEvent(RulerPlot, gtk.Drawable) draw the main plot contents
  OnPopup
WeakEvent(popup) to manipulate menu items before popping
  OnPress
WeakEvent(x, y, e) mouse-down at plot coords x,y; event e
  OnRelease
WeakEvent(x, y, e) mouse-up at plot coords x, y; event e
  OnRoll
WeakEvent(x, y, e) mouse-move when up
  OnUserXDraw
WeakEvent(RulerPlot, gtk.Drawable) draw the user-drawn area under the x axis
  OnUserYDraw
WeakEvent(RulerPlot, gtk.Drawable) draw the user-drawn area left of the y axis
  xAxis
gtk.Adjustment with x bounds and crosshair location
  yAxis
gtk.Adjustment with y bounds and crosshair location
Properties [hide private]
  showHint
  hint

Inherited from gtk.Widget: allocation, name, parent, requisition, saved_state, state, style, window

Inherited from unreachable.GObject: __grefcount__

Inherited from object: __class__

Method Details [hide private]

__init__(self, margin=10, rule_xpix=20, rule_ypix=20, rule_xformat='%.3g', rule_yformat=<function <lambda> at 0xdbc1374>, user_xpix=0, user_ypix=0, fgColor=(0, 0, 0), bgColor=(1, 1, 1), drawPoint=False, dataColor=(1, 0, 0), dataColor2=(1, 0.5, 0.5))
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • margin - number of blank pixels around the edge
  • rule_xpix - height of the x-axis ruler in pixels
  • rule_ypix - width of the y-axis ruler in pixels
  • rule_xformat - format string or function for x axis labels
  • rule_yformat - format string or function for y axis labels
  • user_xpix - height of the user-drawn area below the x axis
  • user_ypix - width of the user-drawn area left of the y axis
  • fgColor - (r,g,b) color of axes and labels
  • bgColor - (r,g,b) color of background
  • drawPoint - if True, draw cross-hairs
  • dataColor - (r,g,b) color of primary data points
  • dataColor2 - (r,g,b) color of secondary data points
Overrides: object.__init__

redraw_canvas(self, invalid=0, immediately=False)

source code 

Requests various levels of repaint, or does it immediately. invalid can be any combination of

  • INVALID_NONE -- just redraw the overlay
  • INVALID_PLOT -- redraw the main plot and the overlay
  • INVALID_XRULE -- redraw the x axis ruler
  • INVALID_YRULE -- redraw the y axis ruler
  • INVALID_XUSER -- redraw the x axis user-draw area
  • INVALID_YUSER -- redraw the y axis user-draw area
  • INVALID_ALL = INVALID_PLOT | INVALID_XRULE | INVALID_YRULE | ...

transform(self, context, x0, y0, x1, y1, xx0, yy0, xx1, yy1, xPix, yPix)

source code 

Translates and scales the cairo context so the rectangle between x0,y0 and x1,y1 is addressed from xx0,yy0 to xx1,yy1. xPix and yPix are the input dimensions of one pixel. Returns the new (xPix, yPix).

Typical usage, to change screen coords into abstract coords:

>>> xPix, yPix = plot.transform(cr, 0, 0, w, h, x0, y0, x1, y1, 1.0, 1.0)  # left-handed / large y at bottom
>>> xPix, yPix = plot.transform(cr, 0, 0, w, h, x0, y1, x1, y0, 1.0, 1.0)  # right-handed / large y at top

draw_to_context(self, context, width, height, fat=1.0, unit_width=0.0, reallyDrawPoint=False)

source code 

Draws everything to a cairo context with width and height.

Parameters:
  • fat - line width scaler
  • unit_width - kluge for printing
  • reallyDrawPoint - False to suppress cross-hairs even when drawPoint==True

cairo_create(self, drawable, x0, y0, x1, y1, blank=True)

source code 

Returns a cairo context with blanked background and right-handed coordinate system.

Returns:
context, xPix, yPix, x0, y0, x1, y1.

Instance Variable Details [hide private]

margin

Get Method:
unreachable(s)

bgColor

Get Method:
unreachable(s)
Set Method:
_setBgColor(self, color)

fgColor

Get Method:
unreachable(s)
Set Method:
_setFgColor(self, color)

dataColor

Get Method:
unreachable(s)
Set Method:
_setDataColor(self, color)

dataColor2

Get Method:
unreachable(s)
Set Method:
_setDataColor2(self, color)

drawPoint

Get Method:
unreachable(s)
Set Method:
_setDrawPoint(self, x)

pointColor

cross-hairs color
Get Method:
unreachable(s)
Set Method:
_setPointColor(self, color)

popup

gtk.Menu on right-click, default None
Get Method:
unreachable(s)
Set Method:
_setPopup(self, x)

Property Details [hide private]

showHint

Get Method:
unreachable(s)
Set Method:
_setShowHint(self, x)

hint

Get Method:
unreachable(s)
Set Method:
_setHint(self, x)