--- a/connectors/PYRO/__init__.py Mon Sep 21 12:12:08 2009 +0200
+++ b/connectors/PYRO/__init__.py Thu Sep 24 18:22:31 2009 +0200
@@ -24,6 +24,13 @@
+# this module attribute contains a list of DNS-SD (Zeroconf) service types +# supported by this connector plugin. +# for connectors that do not support DNS-SD, this attribute can be omitted +# or set to an empty list. +supported_dnssd_services = ["_PYRO._tcp.local."] def PYRO_connector_factory(uri, pluginsroot):
This returns the connector to Pyro style PLCobject
--- a/connectors/USB/__init__.py Mon Sep 21 12:12:08 2009 +0200
+++ b/connectors/USB/__init__.py Thu Sep 24 18:22:31 2009 +0200
@@ -19,4 +19,4 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from connector_USB import *
\ No newline at end of file
+from USB_connector import * \ No newline at end of file
--- 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
_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 +# a dict from a DNS-SD service type to a connector module that support it +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)
+ runtime_port = pluginsroot.AppFrame.StartLocalRuntime(taskbaricon=True) return PYRO.PYRO_connector_factory(
"PYRO://127.0.0.1:"+str(runtime_port),
--- a/discovery.py Mon Sep 21 12:12:08 2009 +0200
+++ b/discovery.py Thu Sep 24 18:22:31 2009 +0200
@@ -21,10 +21,12 @@
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import wx.lib.mixins.listctrl as listmix
-import wx.lib.mixins.listctrl as listmix
class AutoWidthListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
def __init__(self, parent, id, name, pos=wx.DefaultPosition,
@@ -117,21 +119,26 @@
self.ZeroConfInstance = Zeroconf()
+ for browser in self.Browsers: self.ZeroConfInstance.close()
- self.Browser = ServiceBrowser(self.ZeroConfInstance, "_PYRO._tcp.local.", self)
+ for browser in self.Browsers: + for t in connectors.dnssd_connectors.keys(): + self.Browsers.append(ServiceBrowser(self.ZeroConfInstance, t, self)) def OnRefreshButton(self, event):
self.ServicesList.DeleteAllItems()
def OnLocalButton(self, event):