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

Class ModesComponent

source code

                         object --+                    
                                  |                    
      Disconnectable.Disconnectable --+                
                                      |                
  Disconnectable.CompoundDisconnectable --+            
                                          |            
                    SubjectSlot.SlotManager --+        
                                              |        
                             object --+       |        
                                      |       |        
          Disconnectable.Disconnectable --+   |        
                                          |   |        
                        SubjectSlot.Subject --+        
                                              |        
ControlSurfaceComponent.ControlSurfaceComponent --+    
                                                  |    
                CompoundComponent.CompoundComponent --+
                                                      |
                                                     ModesComponent


A ModesComponent handles the selection of different modes of the
component. It improves the ModeSelectorComponent in several ways:

- A mode is an object with two methods for entering and exiting
  the mode.  You do not need to know about all the modes
  registered.

- Any object convertible by 'tomode' can be passed as mode.

- Modes are identified by strings.

- The component will dynamically generate methods of the form:

      set_[mode-name]_button(button)

  for setting the mode button.  Thanks to this, you can pass the mode
  buttons in a layer.

The modes component behaves like a stack.  Several modes can be
active at the same time, but the component will make sure that
only the one at the top (aka 'selected_mode') will be entered at a
given time.  This allows you to implement modes that can be
'cancelled' or 'mode latch' (i.e. go to the previous mode under
certain conditions).

Nested Classes [hide private]

Inherited from SubjectSlot.Subject: __metaclass__

Instance Methods [hide private]
 
__init__(self, *a, **k)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
disconnect(self) source code
 
set_shift_button(self, button) source code
 
_do_enter_mode(self, name) source code
 
_do_leave_mode(self, name) source code
 
_get_selected_mode(self)
Mode that is currently the top of the mode stack.
source code
 
_set_selected_mode(self, mode) source code
 
selected_groups(self) source code
 
active_modes(self) source code
 
push_mode(self, mode)
Selects the current 'mode', leaving the rest of the modes in the mode stack.
source code
 
pop_mode(self, mode)
Takes 'mode' away from the mode stack.
source code
 
pop_groups(self, groups)
Pops every mode in groups.
source code
 
pop_unselected_modes(self)
Pops from the mode stack all the modes that are not the currently selected one.
source code
 
on_enabled_changed(self) source code
 
update(self) source code
 
add_mode(self, name, mode_or_component, toggle_value=False, groups=set(), behaviour=None)
Adds a mode of the given name into the component.
source code
 
_get_mode_behaviour(self, name) source code
 
get_mode(self, name) source code
 
get_mode_groups(self, name) source code
 
set_toggle_button(self, button) source code
 
set_mode_button(self, name, button) source code
 
get_mode_button(self, name) source code
 
_update_buttons(self, selected) source code
 
_on_mode_button_value(self, name, value, sender) source code
 
_on_toggle_value(self, value) source code
 
_cycle_mode(self, delta) source code

Inherited from CompoundComponent.CompoundComponent: has_component, register_component, register_components, set_allow_update, set_enabled, update_all

Inherited from ControlSurfaceComponent.ControlSurfaceComponent: application, is_enabled, on_scene_list_changed, on_selected_scene_changed, on_selected_track_changed, on_track_list_changed, song

Inherited from SubjectSlot.SlotManager: register_slot, register_slot_manager

Inherited from Disconnectable.CompoundDisconnectable: disconnect_disconnectable, find_disconnectable, has_disconnectable, register_disconnectable, unregister_disconnectable

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

Class Variables [hide private]
  __subject_events__ = 'selected_mode',
  momentary_toggle = False
  default_behaviour = LatchingBehaviour()
  selected_mode = property(_get_selected_mode, _set_selected_mode)

Inherited from ControlSurfaceComponent.ControlSurfaceComponent: canonical_parent, is_private, layer, name

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *a, **k)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

disconnect(self)

source code 
Overrides: Disconnectable.Disconnectable.disconnect

_get_selected_mode(self)

source code 

Mode that is currently the top of the mode stack. Setting the selected mode explictly will also cleanup the mode stack.

selected_groups(self)

source code 
Decorators:
  • @property

active_modes(self)

source code 
Decorators:
  • @property

pop_mode(self, mode)

source code 

Takes 'mode' away from the mode stack. If the mode was the currently selected one, the last pushed mode will be selected.

on_enabled_changed(self)

source code 
Overrides: ControlSurfaceComponent.ControlSurfaceComponent.on_enabled_changed

update(self)

source code 
Overrides: ControlSurfaceComponent.ControlSurfaceComponent.update

add_mode(self, name, mode_or_component, toggle_value=False, groups=set(), behaviour=None)

source code 

Adds a mode of the given name into the component.  The mode
object should be a Mode or ControlSurfaceComponent instance.

The 'toggle_value' is the light value the toggle_botton will
be set to when the component is on this mode.

If 'group' is not None, the mode will be put in the group
identified by the passed object.  When several modes are grouped:

  * All the buttons in the group will light up when any of the
    modes withing the group is selected.

  * Any of the group buttons will cancel the current mode when
    the current mode belongs to the group.

_on_toggle_value(self, value)

source code 
Decorators:
  • @subject_slot('value')