Source code for pluginsmanager.observer.updates_observer

# Copyright 2017 SrMouraSilva
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from abc import ABCMeta, abstractmethod


[docs]class UpdatesObserver(metaclass=ABCMeta): """ The :class:`.UpdatesObserver` is an abstract class definition for treatment of changes in some class model. Your methods are called when occurs any change in :class:`.Bank`, :class:`.Pedalboard`, :class:`.Effect`, etc. To do this, it is necessary that the :class:`.UpdatesObserver` objects be registered in some manager, so that it reports the changes. An example of a manager is :class:`.BanksManager`. """
[docs] def __init__(self): self.manager = None
def __enter__(self): if self.manager is not None: self.manager.enter_scope(self) def __exit__(self, type, value, traceback): if self.manager is not None: self.manager.exit_scope()
[docs] @abstractmethod def on_bank_updated(self, bank, update_type, index, origin, **kwargs): """ Called when changes occurs in any :class:`.Bank` :param Bank bank: Bank changed. :param UpdateType update_type: Change type :param int index: Bank index (or old index if update_type == UpdateType.DELETED) :param BanksManager origin: BanksManager that the bank is (or has) contained :param Bank: Contains the old bank occurs a `UpdateType.UPDATED` """ pass
[docs] @abstractmethod def on_pedalboard_updated(self, pedalboard, update_type, index, origin, **kwargs): """ Called when changes occurs in any :class:`.Pedalboard` :param Pedalboard pedalboard: Pedalboard changed :param UpdateType update_type: Change type :param int index: Pedalboard index (or old index if update_type == UpdateType.DELETED) :param Bank origin: Bank that the pedalboard is (or has) contained :param Pedalboard old: Contains the old pedalboard when occurs a `UpdateType.UPDATED` """ pass
[docs] @abstractmethod def on_effect_updated(self, effect, update_type, index, origin, **kwargs): """ Called when changes occurs in any :class:`.Effect` :param Effect effect: Effect changed :param UpdateType update_type: Change type :param int index: Effect index (or old index if update_type == UpdateType.DELETED) :param Pedalboard origin: Pedalboard that the effect is (or has) contained """ pass
[docs] @abstractmethod def on_effect_status_toggled(self, effect, **kwargs): """ Called when any :class:`.Effect` status is toggled :param Effect effect: Effect when status has been toggled """ pass
[docs] @abstractmethod def on_param_value_changed(self, param, **kwargs): """ Called when a param value change :param Param param: Param with value changed """ pass
[docs] @abstractmethod def on_connection_updated(self, connection, update_type, pedalboard, **kwargs): """ Called when changes occurs in any :class:`pluginsmanager.model.connection.Connection` of Pedalboard (adding, updating or removing connections) :param pluginsmanager.model.connection.Connection connection: Connection changed :param UpdateType update_type: Change type :param Pedalboard pedalboard: Pedalboard that the connection is (or has) contained """ pass
[docs] def on_custom_change(self, identifier, *args, **kwargs): """ Called in specific changes that do not fit the other methods. See :class:`.CustomChange` for more details. Also, called when any changes not officially supported by the PluginsManager library are made. Developers can implement libraries on PluginsManager to control different equipment. For example, you can implement a host that will communicate with a GT100 or Zoom G3 boss pedal. If the device has any features not officially supported by the PluginsManager library, this method is useful. For example: Zoom G3 pedalboards have level. If someone changes the level value, this method can be used to communicate this information to all other observers. :param identifier: Unique identifier to informs that which informs the type of change in which it is being informed """ pass