Package _Framework :: Module Resource :: Class StackingResource
[hide private]
[frames] | no frames]

Class StackingResource

source code

object --+    
         |    
  Resource --+
             |
            StackingResource

A stacking resource is a special kind of resource that can preempt the current owner. Resources are assigned to clients in order of arrival, this is, a new client attempting to grab will produce the former owner to be released. However, when the current owner released ownership will be passed back to the last owner.

This, clients are organised in a stack, where grabbing puts the client at the top, and releasing removes from wherever the client is in the stack. Because ownership can change even a client does not release, a client should not use the resource based on the result of the grab() method but instead use whatever indirect API the concrete resource provides to assign ownership.

Clients of a stacking resource can be prioritised to prevent preemption from a client with less priority. (For example, a modal dialog should not loose focus because of a normal window appearing.)

Instance Methods [hide private]
 
__init__(self, on_grab_callback=None, on_release_callback=None, *a, **k)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
grab(self, client, priority=None) source code
 
release(self, client) source code
 
release_stacked(self)
Releases all objects that are stacked but do not own the resource.
source code
 
release_if(self, predicate)
Releases all objects that satisfy a predicate.
source code
 
release_all(self)
Releases all stacked clients.
source code
 
_add_client(self, client, priority) source code
 
_remove_client(self, client) source code
 
_actual_owner(self) source code
 
get_owner(self) source code
 
on_grab(self, client) source code
 
on_release(self, client) source code

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

Class Variables [hide private]
  default_priority = 0
Properties [hide private]
  stack_clients
  max_priority
  stack_size

Inherited from Resource: owner

Inherited from object: __class__

Method Details [hide private]

__init__(self, on_grab_callback=None, on_release_callback=None, *a, **k)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

grab(self, client, priority=None)

source code 
Overrides: Resource.grab

release(self, client)

source code 
Overrides: Resource.release

get_owner(self)

source code 
Overrides: Resource.get_owner

Property Details [hide private]

stack_clients

Get Method:
unreachable.stack_clients(self)

max_priority

Get Method:
unreachable.max_priority(self)

stack_size

Get Method:
unreachable.stack_size(self)