Changeset 10
- Timestamp:
- 12/05/07 20:14:44 (1 year ago)
- Files:
-
- trunk/AUTHORS (added)
- trunk/LICENCE (added)
- trunk/src/Pyxoo/Commands/command.py (modified) (3 diffs)
- trunk/src/Pyxoo/Commands/frontcontroller.py (modified) (2 diffs)
- trunk/src/Pyxoo/Events/channel.py (modified) (1 diff)
- trunk/src/Pyxoo/Model/locator.py (modified) (1 diff)
- trunk/src/Pyxoo/View/locator.py (modified) (1 diff)
- trunk/test/events/TestChannelBroadcaster.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/Pyxoo/Commands/command.py
r7 r10 23 23 24 24 from Pyxoo.Log.stringifier import PyxooStringifier 25 try: 26 from Pyxoo.Plugin.plugin import Plugin 27 except(ImportError): 28 pass 25 29 26 30 27 class Command: … … 39 36 class AbstractCommand(Command): 40 37 __owner = None 41 def __init__(self):42 raise NotImplementedError("AbstractCommand is an abstract class. It must be extented.")43 38 44 39 def execute(self, event=None): … … 53 48 def setOwner(self, owner): 54 49 """setOwner(Plugin):void""" 50 from Pyxoo.Plugin.plugin import Plugin 55 51 if not isinstance(owner, Plugin): 56 52 raise TypeError("owner param must be a Plugin object") trunk/src/Pyxoo/Commands/frontcontroller.py
r7 r10 24 24 from Pyxoo.Commands.locator import CommandLocator 25 25 from Pyxoo.Events.broadcaster import EventBroadcaster 26 #from Pyxoo.Plugin import plugin27 import Pyxoo.Plugin28 26 from Pyxoo.Utils import Type 29 27 from Pyxoo.Commands.command import AbstractCommand … … 45 43 self.__eventBroadcaster = EventBroadcaster(owner) 46 44 else: 47 self.__owner = Pyxoo.Plugin.plugin.NullPlugin() 45 from Pyxoo.Plugin.plugin import NullPlugin 46 self.__owner = NullPlugin() 48 47 self.__eventBroadcaster = EventBroadcaster.getInstance() 49 48 self.__eventBroadcaster.addListener(self) trunk/src/Pyxoo/Events/channel.py
r7 r10 114 114 self.__channels[eventChannel] = eventBroadcaster 115 115 return eventBroadcaster 116 116 117 def releaseChannelDispatcher(self, channel): 118 """releaseChannelDispatcher(EventChannel):boolean""" 119 if not isinstance(channel, EventChannel): 120 raise TypeError( "eventChannel param must be an EventChannel object" ) 121 if self.hasChannelDispatcher(channel): 122 self.__channels.get(channel).removeAllListeners() 123 self.__channels.__delitem__(channel) 124 return True 125 return False 126 117 127 def addListener(self, listener, eventChannel=None): 118 128 """addListener(instance, EventChannel):boolean trunk/src/Pyxoo/Model/locator.py
r7 r10 25 25 from Pyxoo.Model.model import Model 26 26 from Pyxoo.Plugin.plugin import Plugin, NullPlugin 27 from Pyxoo.Log.stringifier import PyxooStringifier 27 28 28 29 class ModelLocator(Locator, object): trunk/src/Pyxoo/View/locator.py
r7 r10 25 25 from Pyxoo.View.view import View 26 26 from Pyxoo.Plugin import plugin 27 27 from Pyxoo.Log.stringifier import PyxooStringifier 28 28 29 29 class ViewLocator(Locator, object): trunk/test/events/TestChannelBroadcaster.py
r7 r10 85 85 self.assertTrue(self.instance.hasChannelDispatcher(self.channel2) ) 86 86 87 def testReleaseChannelDispatcher(self): 88 self.instance.addEventListener( self.type, self.listener, self.channel2 ) 89 self.assertTrue(self.instance.hasChannelListener(self.type, self.channel2)) 90 self.assertTrue(self.instance.hasChannelDispatcher(self.channel2) ) 91 self.assertTrue(self.instance.releaseChannelDispatcher( self.channel2 )) 92 self.assertFalse(self.instance.hasChannelListener(self.type, self.channel2)) 93 self.assertFalse(self.instance.hasChannelDispatcher(self.channel2) ) 94 self.assertFalse(self.instance.releaseChannelDispatcher( self.channel2 ))
