Package elisa :: Package core :: Package bus :: Module bus_message
[hide private]
[frames] | no frames]

Source Code for Module elisa.core.bus.bus_message

  1  # Elisa - Home multimedia server 
  2  # Copyright (C) 2006-2008 Fluendo, S.A. (www.fluendo.com). 
  3  # All rights reserved. 
  4  # 
  5  # This file is available under one of two license agreements. 
  6  # 
  7  # This file is licensed under the GPL version 3. 
  8  # See "LICENSE.GPL" in the root of this distribution including a special 
  9  # exception to use Elisa with Fluendo's plugins. 
 10  # 
 11  # The GPL part of Elisa is also available under a commercial licensing 
 12  # agreement from Fluendo. 
 13  # See "LICENSE.Elisa" in the root directory of this distribution package 
 14  # for details on that license. 
 15   
 16  """ 
 17  This module declares the different kinds of Messages travelling on the bus 
 18  """ 
 19   
 20  # FIXME: Messages cannot be declared in one place specially not in the core: 
 21  # they need to become Components so that any plugin can declare messages 
 22  # and use theirs and those of others. 
 23   
 24   
 25  __maintainer__ = 'Philippe Normand <philippe@fluendo.com>' 
 26   
 27   
 28  from elisa.extern import enum 
 29   
 30   
31 -class Message(object):
32 """ 33 Message base class. Each Message type should inherit from this. 34 """
35
36 -class ComponentsLoaded(Message):
37 """ 38 Sent when all components have been instantiated 39 """
40
41 -class MediaLocation(Message):
42 """ 43 Sent when a new device has been found 44 45 @cvar action: One of L{MediaLocation.ActionType} enum values 46 @cvar name: Name of the device 47 @type name: string 48 @cvar fstype: Filesystem type 49 @type fstype: string 50 @cvar mount_point: Mount point 51 @type mount_point: string 52 @cvar media_types: list of media_types stored on the device 53 @type media_types: list 54 @cvar removable: whether the media location is on a device which can 55 be ejected 56 @type removable: bool 57 @cvar theme_icon: the name of the icon the theme should use for 58 that location to display 59 @type theme_icon: string 60 """ 61 62 ActionType = enum.Enum('NO_ACTION', 'LOCATION_ADDED', 'LOCATION_REMOVED', 63 'EJECT') 64 65 action = ActionType.NO_ACTION 66 name = '' 67 fstype = '' 68 mount_point = '' 69 media_types = ['audio', 'video', 'image'] 70 removable = False 71 theme_icon = None 72
73 - def __init__(self, action, name, fstype, mount_point, media_types=None, 74 removable=False, theme_icon=None):
75 self.action = action 76 self.name = name 77 self.fstype = fstype 78 self.mount_point = mount_point 79 if media_types is not None: 80 self.media_types = media_types 81 self.removable = removable 82 self.theme_icon = theme_icon
83
84 - def __repr__(self):
85 return "<MediaLocation %s %s %s>" % (self.action, self.name, 86 self.mount_point)
87
88 -class DeviceAction(MediaLocation):
89 """ 90 DOCME 91 """
92 #ActionType = enum.Enum('NO_ACTION', 'DEVICE_ADDED', 'DEVICE_REMOVED') 93
94 -class ForeignApplication(MediaLocation):
95 """ 96 DOCME 97 """
98
99 -class LocalNetworkLocation(MediaLocation):
100 """ 101 DOCME 102 """
103
104 -class InternetLocation(MediaLocation):
105 """ 106 DOCME 107 """
108
109 -class HttpResource(Message):
110 """ 111 Sent by components which need to register new HTTP Resources to the server 112 """ 113
114 - def __init__(self, path, resource):
115 self.path = path 116 self.resource = resource
117
118 -class PBReferenceable(Message):
119 """ 120 DOCME 121 """ 122
123 - def __init__(self, name, reference):
124 self.name = name 125 self.reference = reference
126
127 -class PlayerModel(Message):
128 """ 129 DOCME 130 """ 131
132 - def __init__(self, player_model):
134 135
136 -class CoherencePlugin(Message):
137 """ 138 DOCME 139 """ 140
141 - def __init__(self, name, args):
142 self.name = name 143 self.args = args
144
145 -class CoherenceDevice(Message):
146 """ 147 DOCME 148 """ 149
150 - def __init__(self, name, callback, typ):
151 self.name = name 152 self.callback = callback 153 self.typ = typ
154
155 -class LocationsList(Message):
156 """ 157 This message gets send by the component, that is taking care of the 158 location and has a list to share with others 159 """ 160
161 - def __init__(self, locations):
162 self.locations = locations
163