Dirk Meyer wrote: > But there is get_ressource() in application. Right now it is used so > that audio player and video player know that the other one is blocking > the audio device. I guess this function would be a good starting > point. Right now only applications can block a ressource, we need to > make it possible that plugins can do, too. get_resources returns a > dict ressource name -> application of all ressources blocked. In a > perfect world get_resources returns an empty dict. So what we should > do: joystick plugin reserves the joystick ressource. Now games does > get_resources('joystick', 'video', 'audio') and the return is { > 'joystick': JoystickPluginInstance }. This means audio and video could > be reservered (but are not because not all ressources are free). Now > games has the plugin for joystick and can call a 'pause' function and > the joystick plugin releases the joystick. The next get_resources > would return an empty dict, games can start. After games is done the > games plugin calls 'resume' on the JoystickPluginInstance. > > I just moved get_resources and free_ressources out of the internal > code and accessable for everyone. So the joystick plugin should do > get_resources('joystick') in __init__ or plugin_activate. If the > return value is not empty it is an error. The plugin should have a > pause and resume function calling free_ressources and > get_resources. You can access this fuctions through the application > module: freevo.ui.application.get_resources. >
ok i took a look at the code. Here my thought about it. My idea would need some changes so I ask first if you think this would be a good idea. I would add the get_resource/free_resource to the Plugin object. To get this working I would move the resources.py from ui.aplication to the core since this is nothing that only belongs to the ui. In addition i would like to propose a new interface for the resource handling. I will show in code beloow. class RessourceUser(object): def get_resource(self, *resources): pass def free_resource(self, *resources): pass def isApplication(self): """ Returns true if it is an application that holds the resource. This means to release the resource send a stop signal to the aplication """ pass def isPlugin(self): """ Returns true if it is a plugin that holds the resource. This means the resouce can be released with the pause method from the plugin object. """ pass The Plugin class would then be enhanced with the following two methods. def pause(self): """ this method releases the resources the plugin uses. Stop activitis for this resource. """ pass def resume(self): """ this method tries to retake a resource and resume activities with this resource. """ pass The Plugin class and the Application class would both be inherited from the RessourceUser class (Maybe you have a better name for it). I will do this changes if you think it is a good Idea or maybe you got even a better idea. Thanks Mathias ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel