Mathias Weber wrote: > 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.
OK, fine by me. > 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 OK. But do not include it into plugin.py and make an keep it an extra file. > The Plugin class would then be enhanced with the following two methods. > > def pause(self): > def resume(self): Well, most plugins will never use that function. So I guess maybe keep the ressource.py as it is (only move it out of application). The functions isApplication and isPlugin are not really needed, you could ask isinstance. Another idea: create the RessourceUser class. Application inherits From this class, Plugin does not. IF you have a plugin that uses ressource you inherit from both Plugin and RessourceUser. in ressource.py: class RessourceUser(object): def resource_get(self, *resources): the code we have now def resource_free(self, *resources): the code we have now def resource_type(self): raise NotImplemented class RessourcePlugin(RessourceUser): def resource_type(self): return 'plugin' def plugin_pause(self): pass def plugin_resume(self): pass in application/base.py: class Application(RessourceUser): def resource_type(self): return 'application' in your plugin: class PluginInterface(InputPlugin, RessourcePlugin): > The Plugin class and the Application class would both be inherited from > the RessourceUser class (Maybe you have a better name for it). RessourceHandler? > I will do this changes if you think it is a good Idea or maybe you > got even a better idea. What do you think of this idea? Also notice the names of the functions. I think it is a good idea to start all functions with the names where they belong too. Open for discussion Dischi -- What happens if a big asteroid hits the Earth? Judging from realistic simulations involving a sledge hammer and a common laboratory frog, we can assume it will be pretty bad.
pgpQo6eKkGTda.pgp
Description: PGP signature
------------------------------------------------------------------------- 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