qubx :: toolspace :: Layer :: Class Layer
[hide private]
[frames] | no frames]

Class Layer

source code

object --+
         |
        Layer
Known Subclasses:

A floating, transparent, clickable area in a ToolSpace.

Instance Methods [hide private]
 
__init__(self, x=0, y=0, w=10, h=10, cBG=('toolspace.layer.bg', (0.12, 0.12, 0.12, 0.85)), border=0, cBorder=('toolspace.layer.border', (0.5, 0.5, 0.5, 0.5)), w_min=1, h_min=1)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
set_space(self, space) source code
 
set_x(self, x) source code
 
set_y(self, y) source code
 
set_w(self, w) source code
 
set_h(self, h) source code
 
set_w_min(self, w) source code
 
set_h_min(self, h) source code
 
pt_in_rect(self, x, y)
Returns True if x,y is inside this layer.
source code
 
invalidate(self, sub=None)
Requests repaint.
source code
 
__reposition(self, space_w, space_h, appearance, resurface=True) source code
 
render(self, space_w, space_h, appearance)
Repaints (and repositions) surface, if needed.
source code
 
render_to(self, context, space_w, space_h, appearance)
Paints directly into a cairo context, as for copy/print.
source code
 
add_sublayer(self, sub)
Adds a SubLayer (label or control).
source code
 
remove_sublayer(self, sub) source code
 
clear_sublayers(self)
Removes all sublayers.
source code
 
draw(self, context)
Override this method to draw on the layer itself.
source code
 
on_show(self)
Override this method to do something when the layer is added to a ToolSpace.
source code
 
on_hide(self)
Override this method to do something when the layer is removed from a ToolSpace.
source code
 
mouse_enter(self)
Override this method to do something when the mouse enters the layer.
source code
 
mouse_exit(self)
Override this method to do something when the mouse leaves the layer.
source code
 
button_press(self, x, y, event)
Override this method to handle mouse-down.
source code
 
find_sub(self, x, y)
Returns the SubLayer at local coordinates (x, y), or None.
source code
 
sub_press(self, x, y, event)
If there is a SubLayer at (x,y), passes it the event and returns False.
source code
 
button_release(self, x, y, event)
Override this method to handle mouse-up.
source code
 
sub_release(self, x, y, event)
If there is a SubLayer at (x,y), passes it the event and returns False.
source code
 
set_sub_hover(self, sub_hover, x=0, y=0, event=None) source code
 
motion_notify(self, x, y, event)
Override this method to handle mouse motion.
source code
 
scroll(self, x, y, event, offset)
Override this event to handle the mouse scroll wheel.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  x
actual x coord, in pixels
  y
actualy coord, in pixels
  w
actual width, in pixels
  h
actual height, in pixels
  w_min
minimum requested width in ems, if rq_w is negative
  h_min
minimum requested height in ems, if rq_h is negative
  OnInvalidate
WeakEvent(Layer) called when it needs repainting
  appearance
TS_Appearance of the ToolSpace
  border
width of border in pixels
  cBG
background COLORREF
  cBorder
border COLORREF
  invalid
True if surface needs to be repainted
  rq_h
requested height, in units of appearance.emsize; negative to specify distance from bottom
  rq_w
requested width, in units of appearance.emsize; negative to specify distance from right edge
  rq_x
requested x coord, in units of appearance.emsize
  rq_y
requested y coord, in units of appearance.emsize
  subs
list of SubLayer
  surface
cairo image surface for double buffering
Properties [hide private]
  space
  sub_hover

Inherited from object: __class__

Method Details [hide private]

__init__(self, x=0, y=0, w=10, h=10, cBG=('toolspace.layer.bg', (0.12, 0.12, 0.12, 0.85)), border=0, cBorder=('toolspace.layer.border', (0.5, 0.5, 0.5, 0.5)), w_min=1, h_min=1)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • x - x >= 0: number of 'M' widths from the ToolSpace's left edge; x < 0: number of ... ToolSpace's right edge
  • y - y >= 0: number of 'M' widths from the ToolSpace's top edge; y < 0: number of ... ToolSpace's bottom edge
  • w - w >= 0: number of 'M' widths across; w < 0: number of 'M's between Layer's right and ToolSpace's right
  • h - h >= 0: number of 'M' widths tall; h < 0: number of 'M's between Layer's bottom and ToolSpace's bottom
  • cBG - COLORREF of background
  • border - width in pixels of border
  • cBorder - COLORREF of border
  • w_min - minimum number of 'M' widths across, if w is negative
  • h_min - minimum number of 'M' widths tall, if h is negative
Overrides: object.__init__

button_press(self, x, y, event)

source code 

Override this method to handle mouse-down. If not handled, return True.

sub_press(self, x, y, event)

source code 

If there is a SubLayer at (x,y), passes it the event and returns False. (True if there's no sub)

button_release(self, x, y, event)

source code 

Override this method to handle mouse-up. If not handled, return True

sub_release(self, x, y, event)

source code 

If there is a SubLayer at (x,y), passes it the event and returns False. (True if there's no sub)


Instance Variable Details [hide private]

x

actual x coord, in pixels
Get Method:
unreachable(self)
Set Method:
unreachable(self, x)

y

actualy coord, in pixels
Get Method:
unreachable(self)
Set Method:
unreachable(self, x)

w

actual width, in pixels
Get Method:
unreachable(self)
Set Method:
unreachable(self, x)

h

actual height, in pixels
Get Method:
unreachable(self)
Set Method:
unreachable(self, x)

w_min

minimum requested width in ems, if rq_w is negative
Get Method:
unreachable(self)
Set Method:
unreachable(self, x)

h_min

minimum requested height in ems, if rq_h is negative
Get Method:
unreachable(self)
Set Method:
unreachable(self, x)

Property Details [hide private]

space

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

sub_hover

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