[nvda-addons] Re: Registering an add-on as a com server

  • From: James Scholes <james@xxxxxxxxxxxxx>
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Wed, 13 Jul 2016 17:44:54 +0100

Pranav Lal wrote:

In terms of registering the com server with windows, I need to use the name of
the class. However, many add-ons share the name of the class. Is this going to
be a problem or do I need to do something more complex?

All global plugins use the class name of GlobalPlugin, but you're not
importing any code from other global plugins.  So if you reference the
name GlobalPlugin in your source file, it will refer specifically to
your subclassed GlobalPlugin, and nothing else.

With that said, however, I'm not really convinced that putting a COM
server inside a GlobalPlugin is the best idea.  It is specific and
complex enough that it should probably just go in its own class.  Your
GlobalPlugin will then only be responsible for registering it on
startup, and doing whatever else it needs to do.

class COMServer(object):
        # COM server code

class GlobalPlugin(globalPluginHandler.GlobalPlugin):
        def __init__(self, *args, **kwargs):
                super(GlobalPlugin, self).__init__(*args, **kwargs)
                # register COM server
-- 
James Scholes
http://twitter.com/JamesScholes
----------------------------------------------------------------
NVDA add-ons: A list to discuss add-on code enhancements and for reporting 
bugs. 

Community addons are available from: http://addons.nvda-project.org
To send a message to the list: nvda-addons@xxxxxxxxxxxxx
To change your list settings/unsubscribe: 
//www.freelists.org/list/nvda-addons
To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx

Other related posts: