|
1 from __future__ import absolute_import |
|
2 |
1 import wx |
3 import wx |
2 from zope.interface import Interface, Attribute |
4 from zope.interface import Interface, Attribute |
3 from zope.interface.verify import verifyObject |
5 from zope.interface.verify import verifyObject |
4 from connectors import connectors_dialog, ConnectorDialog, GetConnectorFromURI |
6 from connectors import connectors_dialog, ConnectorDialog, GetConnectorFromURI |
5 |
7 |
6 |
8 |
7 [ID_URIWIZARDDIALOG,ID_URITYPECHOICE] = [wx.NewId() for _init_ctrls in range(2)] |
9 [ID_URIWIZARDDIALOG, ID_URITYPECHOICE] = [wx.NewId() for _init_ctrls in range(2)] |
|
10 |
8 |
11 |
9 class IConnectorPanel(Interface): |
12 class IConnectorPanel(Interface): |
10 """This is interface for panel of seperate connector type""" |
13 """This is interface for panel of seperate connector type""" |
11 uri = Attribute("""uri of connections""") |
14 uri = Attribute("""uri of connections""") |
12 type = Attribute("""type of connector""") |
15 type = Attribute("""type of connector""") |
13 |
16 |
14 def SetURI(uri): |
17 def SetURI(uri): # pylint: disable=no-self-argument |
15 """methode for set uri""" |
18 """methode for set uri""" |
16 |
19 |
17 def GetURI(): |
20 def GetURI(): # pylint: disable=no-self-argument |
18 """metohde for get uri""" |
21 """metohde for get uri""" |
19 |
22 |
20 |
23 |
21 class UriLocationEditor(wx.Dialog): |
24 class UriLocationEditor(wx.Dialog): |
22 def _init_ctrls(self, parent): |
25 def _init_ctrls(self, parent): |
23 wx.Dialog.__init__(self, id=ID_URIWIZARDDIALOG, |
26 self.UriTypeChoice = wx.Choice(parent=self, id=ID_URIWIZARDDIALOG, choices=self.URITYPES) |
24 name='UriLocationEditor', parent=parent, |
|
25 title='Uri location') |
|
26 self.UriTypeChoice = wx.Choice(parent=self, id=ID_URIWIZARDDIALOG, choices = self.URITYPES) |
|
27 self.UriTypeChoice.SetSelection(0) |
27 self.UriTypeChoice.SetSelection(0) |
28 self.Bind(wx.EVT_CHOICE, self.OnTypeChoice, self.UriTypeChoice) |
28 self.Bind(wx.EVT_CHOICE, self.OnTypeChoice, self.UriTypeChoice) |
29 self.PanelSizer = wx.BoxSizer(wx.HORIZONTAL) |
29 self.PanelSizer = wx.BoxSizer(wx.HORIZONTAL) |
30 self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL) |
30 self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) |
31 |
31 |
32 def _init_sizers(self): |
32 def _init_sizers(self): |
33 self.mainSizer = wx.BoxSizer(wx.VERTICAL) |
33 self.mainSizer = wx.BoxSizer(wx.VERTICAL) |
34 typeSizer = wx.BoxSizer(wx.HORIZONTAL) |
34 typeSizer = wx.BoxSizer(wx.HORIZONTAL) |
35 typeSizer.Add(wx.StaticText(self,wx.ID_ANY, _("URI type:")), border=5, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL) |
35 typeSizer.Add(wx.StaticText(self, wx.ID_ANY, _("URI type:")), border=5, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL) |
36 typeSizer.Add(self.UriTypeChoice, border=5, flag=wx.ALL) |
36 typeSizer.Add(self.UriTypeChoice, border=5, flag=wx.ALL) |
37 self.mainSizer.Add(typeSizer) |
37 self.mainSizer.Add(typeSizer) |
38 |
38 |
39 self.mainSizer.Add(self.PanelSizer, border=5, flag=wx.ALL) |
39 self.mainSizer.Add(self.PanelSizer, border=5, flag=wx.ALL) |
40 self.mainSizer.Add(self.ButtonSizer, border=5, flag=wx.BOTTOM|wx.ALIGN_CENTER_HORIZONTAL) |
40 self.mainSizer.Add(self.ButtonSizer, border=5, flag=wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL) |
41 self.SetSizer(self.mainSizer) |
41 self.SetSizer(self.mainSizer) |
42 self.Layout() |
42 self.Layout() |
43 self.Fit() |
43 self.Fit() |
44 |
44 |
45 def __init__(self, parent, uri): |
45 def __init__(self, parent, uri): |
|
46 wx.Dialog.__init__(self, id=ID_URIWIZARDDIALOG, |
|
47 name='UriLocationEditor', parent=parent, |
|
48 title='Uri location') |
46 self.URITYPES = [_("- Select URI type -")] |
49 self.URITYPES = [_("- Select URI type -")] |
47 for connector_type, connector_function in connectors_dialog.iteritems(): |
50 for connector_type, connector_function in connectors_dialog.iteritems(): |
48 try: |
51 try: |
49 connector_function['function']() |
52 connector_function['function']() |
50 self.URITYPES.append(connector_type) |
53 self.URITYPES.append(connector_type) |
51 except Exception as e: |
54 except Exception: |
52 pass |
55 pass |
53 |
56 |
54 self.selected = None |
57 self.selected = None |
55 self.parrent = parent |
58 self.parrent = parent |
56 self.logger = self.parrent.CTR.logger |
59 self.logger = self.parrent.CTR.logger |