Changeset 10

Show
Ignore:
Timestamp:
12/05/07 20:14:44 (1 year ago)
Author:
skit
Message:

* Modification des imports du module Pyxoo.Plugin.plugin dans les modules Pyxoo.Command.command et Pyxoo.Command.FrontController?
* Ajout de l'import de la classe Pyxoo.Log.stringifier.PyxooStringifier? dans les modules Pyxoo.Model.locator et Pyxoo.View.locator
* Ajout de la méthode releaseChannelDispatcher dans la classe ChannelBroadcaster?
* Ajout des fichiers AUTHORS et LICENCE à la racine du projet.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/Pyxoo/Commands/command.py

    r7 r10  
    2323 
    2424from Pyxoo.Log.stringifier import PyxooStringifier 
    25 try: 
    26     from Pyxoo.Plugin.plugin import Plugin 
    27 except(ImportError): 
    28     pass 
     25 
    2926 
    3027class Command:     
     
    3936class AbstractCommand(Command): 
    4037    __owner = None 
    41     def __init__(self): 
    42         raise NotImplementedError("AbstractCommand is an abstract class. It must be extented.") 
    4338         
    4439    def execute(self, event=None): 
     
    5348    def setOwner(self, owner): 
    5449        """setOwner(Plugin):void""" 
     50        from Pyxoo.Plugin.plugin import Plugin 
    5551        if not isinstance(owner, Plugin): 
    5652            raise TypeError("owner param must be a Plugin object") 
  • trunk/src/Pyxoo/Commands/frontcontroller.py

    r7 r10  
    2424from Pyxoo.Commands.locator import CommandLocator 
    2525from Pyxoo.Events.broadcaster import EventBroadcaster 
    26 #from Pyxoo.Plugin import plugin 
    27 import Pyxoo.Plugin 
    2826from Pyxoo.Utils import Type 
    2927from Pyxoo.Commands.command import AbstractCommand 
     
    4543            self.__eventBroadcaster = EventBroadcaster(owner) 
    4644        else: 
    47             self.__owner = Pyxoo.Plugin.plugin.NullPlugin() 
     45            from Pyxoo.Plugin.plugin import NullPlugin 
     46            self.__owner = NullPlugin() 
    4847            self.__eventBroadcaster = EventBroadcaster.getInstance() 
    4948        self.__eventBroadcaster.addListener(self) 
  • trunk/src/Pyxoo/Events/channel.py

    r7 r10  
    114114            self.__channels[eventChannel] = eventBroadcaster 
    115115            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     
    117127    def addListener(self, listener, eventChannel=None): 
    118128        """addListener(instance, EventChannel):boolean 
  • trunk/src/Pyxoo/Model/locator.py

    r7 r10  
    2525from Pyxoo.Model.model import Model 
    2626from Pyxoo.Plugin.plugin import Plugin, NullPlugin 
     27from Pyxoo.Log.stringifier import PyxooStringifier 
    2728 
    2829class ModelLocator(Locator, object): 
  • trunk/src/Pyxoo/View/locator.py

    r7 r10  
    2525from Pyxoo.View.view import View 
    2626from Pyxoo.Plugin import plugin 
    27  
     27from Pyxoo.Log.stringifier import PyxooStringifier 
    2828 
    2929class ViewLocator(Locator, object): 
  • trunk/test/events/TestChannelBroadcaster.py

    r7 r10  
    8585        self.assertTrue(self.instance.hasChannelDispatcher(self.channel2) ) 
    8686         
     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 ))