8 |
8 |
9 from __future__ import absolute_import |
9 from __future__ import absolute_import |
10 from __future__ import print_function |
10 from __future__ import print_function |
11 |
11 |
12 import wx |
12 import wx |
|
13 from zope.interface import implementer |
|
14 |
13 from controls.UriLocationEditor import IConnectorPanel |
15 from controls.UriLocationEditor import IConnectorPanel |
14 from zope.interface import implementer |
|
15 |
16 |
16 URITypes = ["LOCAL", "PYRO", "PYROS"] |
17 URITypes = ["LOCAL", "PYRO", "PYROS"] |
17 |
18 |
18 |
19 |
19 def PYRO_connector_dialog(confnodesroot): |
20 def PYRO_connector_dialog(confnodesroot): |
20 [ID_IPTEXT, ID_PORTTEXT] = [wx.NewId() for _init_ctrls in range(2)] |
21 [ID_IPTEXT, ID_PORTTEXT] = [wx.NewId() for _init_ctrls in range(2)] |
21 |
|
22 |
22 |
23 @implementer(IConnectorPanel) |
23 @implementer(IConnectorPanel) |
24 class PYROConnectorPanel(wx.Panel): |
24 class PYROConnectorPanel(wx.Panel): |
25 def __init__(self, typeConnector, parrent, *args, **kwargs): |
25 def __init__(self, typeConnector, parrent, *args, **kwargs): |
26 self.type = typeConnector |
26 self.type = typeConnector |
29 self._init_ctrls() |
29 self._init_ctrls() |
30 self._init_sizers() |
30 self._init_sizers() |
31 self.uri = None |
31 self.uri = None |
32 |
32 |
33 def _init_ctrls(self): |
33 def _init_ctrls(self): |
34 self.IpText = wx.TextCtrl(parent=self, id=ID_IPTEXT, size = wx.Size(200, -1)) |
34 self.IpText = wx.TextCtrl(parent=self, id=ID_IPTEXT, size=wx.Size(200, -1)) |
35 self.PortText = wx.TextCtrl(parent=self, id=ID_PORTTEXT, size = wx.Size(200, -1)) |
35 self.PortText = wx.TextCtrl(parent=self, id=ID_PORTTEXT, size=wx.Size(200, -1)) |
36 |
36 |
37 def _init_sizers(self): |
37 def _init_sizers(self): |
38 self.mainSizer = wx.FlexGridSizer(cols=2, hgap=10, rows=5, vgap=10) |
38 self.mainSizer = wx.FlexGridSizer(cols=2, hgap=10, rows=5, vgap=10) |
39 self.mainSizer.AddWindow(wx.StaticText(self, label=_("URI host:")), |
39 self.mainSizer.AddWindow(wx.StaticText(self, label=_("URI host:")), |
40 flag=wx.ALIGN_CENTER_VERTICAL) |
40 flag=wx.ALIGN_CENTER_VERTICAL) |
53 self.IpText.SetValue(uri_list[1].strip("/")) |
53 self.IpText.SetValue(uri_list[1].strip("/")) |
54 self.PortText.SetValue(uri_list[2]) |
54 self.PortText.SetValue(uri_list[2]) |
55 elif length == 2: |
55 elif length == 2: |
56 self.IpText.SetValue(uri_list[1].strip("/")) |
56 self.IpText.SetValue(uri_list[1].strip("/")) |
57 |
57 |
58 |
|
59 def GetURI(self): |
58 def GetURI(self): |
60 self.uri = self.type+"://"+self.IpText.GetValue()+":"+self.PortText.GetValue() |
59 self.uri = self.type+"://"+self.IpText.GetValue()+":"+self.PortText.GetValue() |
61 return self.uri |
60 return self.uri |
62 |
61 |
63 return PYROConnectorPanel("PYRO", confnodesroot) |
62 return PYROConnectorPanel("PYRO", confnodesroot) |