--- a/connectors/__init__.py Mon Sep 21 12:12:08 2009 +0200
+++ b/connectors/__init__.py Thu Sep 24 18:22:31 2009 +0200
@@ -23,9 +23,28 @@
from os import listdir, path
+import PYRO
+
_base_path = path.split(__file__)[0]
-connector_types = [name for name in listdir(_base_path) if path.isdir(path.join(_base_path, name)) and name.upper() != "CVS" and not name.startswith("__")]
+connector_types = [name for name in listdir(_base_path)
+ if path.isdir(path.join(_base_path, name))
+ and name.upper() != "CVS"
+ and not name.startswith("__")]
+
+# a dict from a URI scheme (connector name) to connector module
+connector_modules = {}
+
+# a dict from a DNS-SD service type to a connector module that support it
+dnssd_connectors = {}
+
+for t in connector_types:
+ new_module = getattr(__import__("connectors." + t), t)
+ connector_modules[t] = new_module
+
+ if hasattr(new_module, "supported_dnssd_services"):
+ for st in new_module.supported_dnssd_services:
+ dnssd_connectors[st] = new_module
def ConnectorFactory(uri, pluginsroot):
"""
@@ -35,16 +54,11 @@
servicetype = uri.split("://")[0]
if servicetype in connector_types:
# import module according to uri type
- connectormodule = getattr(__import__("connectors."+servicetype), servicetype)
+ connectormodule = connector_modules[servicetype]
factoryname = servicetype + "_connector_factory"
return getattr(connectormodule, factoryname)(uri, pluginsroot)
elif servicetype == "LOCAL":
- #handle incompatibility with tray icon and svgui...
- poisoned_plugin = False
- for PlugIn in pluginsroot.IterChilds():
- poisoned_plugin |= PlugIn.PlugType == "svgui"
- runtime_port = pluginsroot.AppFrame.StartLocalRuntime(taskbaricon = not poisoned_plugin)
- import PYRO
+ runtime_port = pluginsroot.AppFrame.StartLocalRuntime(taskbaricon=True)
return PYRO.PYRO_connector_factory(
"PYRO://127.0.0.1:"+str(runtime_port),
pluginsroot)