Package csb :: Package io :: Module plots :: Class Backend

[frames] | no frames]

# Class Backend

source code

            object --+
                     |
    threading._Verbose --+
                         |
          threading.Thread --+
                             |
                            Backend

Known Subclasses:
  - WxBackendImpl

Abstract class defining the behavior of all Chart GUI backends.

Each backend is a 'daemon' that runs in a new thread and handles all GUI requests from any Chart instance. A backend service must behave as a singleton - only one service of a given kind may exist at a given point in time. Chart clients will request GUI operations on specific figures, the Backend therefore must keep track of all windows opened, as well as the figure-to-window mapping.

Nested Classes
| __metaclass__ Metaclass for defining Abstract Base Classes (ABCs).

Instance Methods

__del__(self) | source code

__init__(self) This constructor should always be called with keyword arguments. | source code

add(self, figure) Add a new figure. | source code

client_disposed(self, client) Fired when a client is being deleted. | source code

destroy(self, figure, wait=False) Destroy existing figure. | source code

hide(self, figure) Hide existing figure. | source code

invoke(self, callable, *args) Invoke an asynchronous GUI operation (in a thread-safe way) | source code

resize(self, figure) Resize existing figure. | source code

run(self) Main service method, automatically called by `start`. | source code

show(self, figure) Show existing figure. | source code

start(self) Start the Backend service. | source code

stop(self) Stop the Backend service. | source code

Inherited from `threading.Thread`: `__repr__`, `getName`, `isAlive`, `isDaemon`, `is_alive`, `join`, `setDaemon`, `setName` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods

Backend

get(backend, started=True) Backend factory, ensures one instance per subclass. | source code

bool

query(backend) Returns: True if a service of type `backend` is running | source code

Class Variables
| __abstractmethods__ = ``frozenset([``'``_add``'``,` `'``_destroy``'``,` `'``_exit``'``,` `...``

Properties
bool | running True if the service had been started and is currently running
bool | started True if the service had been started
Inherited from `threading.Thread`: `daemon`, `ident`, `name` Inherited from `object`: `__class__`

Method Details

### __init__(self)
(Constructor)

source code

This constructor should always be called with keyword arguments. Arguments are:

*group* should be None; reserved for future extension when a ThreadGroup class is implemented.

*target* is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

*name* is the thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number.

*args* is the argument tuple for the target invocation. Defaults to ().

*kwargs* is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

Overrides: object.__init__
  (inherited documentation)

### client_disposed(self, client)

source code

Fired when a client is being deleted. Will stop the service if no active clients are remaining.

### destroy(self, figure, wait=False)

source code

Destroy existing figure. If `wait` is True, make sure the asynchronous figure deletion is complete before returning from the method.

### get(backend, started=True)
Static Method

source code

Backend factory, ensures one instance per subclass.

Parameters:
  - `backend` (type) - one of the Backend subclasses
  - `started` (bool) - if True, ensure that the service is running
Returns: Backend
  an instance of the backend. The returned service instance may need to be started.

### query(backend)
Static Method

source code

Parameters:
  - `backend` (type) - one of the Backend subclasses
Returns: bool
  True if a service of type `backend` is running

### run(self)

source code

Main service method, automatically called by `start`.

Overrides: threading.Thread.run

### start(self)

source code

Start the Backend service. This method can be called only once.

Overrides: threading.Thread.start

### stop(self)

source code

Stop the Backend service. The Backend object can be safely disposed afterwards.

Class Variable Details

### __abstractmethods__

Value:

      frozenset(['_add',
                 '_destroy',
                 '_exit',
                 '_hide',
                 '_initapp',
                 '_invoke',
                 '_mainloop',
                 '_resize',
      ...

Property Details

### running

True if the service had been started and is currently running

Get Method:
  unreachable.running(self) - True if the service had been started and is currently running
Type:
  bool

### started

True if the service had been started

Get Method:
  unreachable.started(self) - True if the service had been started
Type:
  bool