|
1 #!/usr/bin/env python |
1 # -*- coding: utf-8 -*- |
2 # -*- coding: utf-8 -*- |
2 |
3 |
3 #This file is part of Beremiz, a Integrated Development Environment for |
4 # This file is part of Beremiz, a Integrated Development Environment for |
4 #programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
5 # |
6 # |
6 #Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
7 # |
8 # |
8 #See COPYING file for copyrights details. |
9 # See COPYING file for copyrights details. |
9 # |
10 # |
10 #This library is free software; you can redistribute it and/or |
11 # This program is free software; you can redistribute it and/or |
11 #modify it under the terms of the GNU General Public |
12 # modify it under the terms of the GNU General Public License |
12 #License as published by the Free Software Foundation; either |
13 # as published by the Free Software Foundation; either version 2 |
13 #version 2.1 of the License, or (at your option) any later version. |
14 # of the License, or (at your option) any later version. |
14 # |
15 # |
15 #This library is distributed in the hope that it will be useful, |
16 # This program is distributed in the hope that it will be useful, |
16 #but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 #General Public License for more details. |
19 # GNU General Public License for more details. |
19 # |
20 # |
20 #You should have received a copy of the GNU General Public |
21 # You should have received a copy of the GNU General Public License |
21 #License along with this library; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 |
24 |
24 import socket |
25 import socket |
25 import wx |
26 import wx |
26 import wx.lib.mixins.listctrl as listmix |
27 import wx.lib.mixins.listctrl as listmix |
27 from util.Zeroconf import * |
28 from util.Zeroconf import * |
59 parent.AddSizer(self.ButtonSizer, 0, border=0, flag=0) |
60 parent.AddSizer(self.ButtonSizer, 0, border=0, flag=0) |
60 |
61 |
61 def _init_coll_ButtonGridSizer_Growables(self, parent): |
62 def _init_coll_ButtonGridSizer_Growables(self, parent): |
62 parent.AddGrowableCol(0) |
63 parent.AddGrowableCol(0) |
63 parent.AddGrowableCol(1) |
64 parent.AddGrowableCol(1) |
64 parent.AddGrowableRow(1) |
65 parent.AddGrowableRow(0) |
65 |
66 |
66 def _init_sizers(self): |
67 def _init_sizers(self): |
67 self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) |
68 self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) |
68 self.ButtonGridSizer = wx.FlexGridSizer(cols=4, hgap=5, rows=1, vgap=0) |
69 self.ButtonGridSizer = wx.FlexGridSizer(cols=4, hgap=5, rows=1, vgap=0) |
69 |
70 |
76 |
77 |
77 def _init_ctrls(self, prnt): |
78 def _init_ctrls(self, prnt): |
78 wx.Dialog.__init__(self, id=ID_DISCOVERYDIALOG, |
79 wx.Dialog.__init__(self, id=ID_DISCOVERYDIALOG, |
79 name='DiscoveryDialog', parent=prnt, |
80 name='DiscoveryDialog', parent=prnt, |
80 size=wx.Size(600, 600), style=wx.DEFAULT_DIALOG_STYLE, |
81 size=wx.Size(600, 600), style=wx.DEFAULT_DIALOG_STYLE, |
81 title='Service Discovery') |
82 title=_('Service Discovery')) |
82 |
83 |
83 self.staticText1 = wx.StaticText(id=ID_DISCOVERYDIALOGSTATICTEXT1, |
84 self.staticText1 = wx.StaticText(id=ID_DISCOVERYDIALOGSTATICTEXT1, |
84 label=_('Services available:'), name='staticText1', parent=self, |
85 label=_('Services available:'), name='staticText1', parent=self, |
85 pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) |
86 pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) |
86 |
87 |
87 # Set up list control |
88 # Set up list control |
88 self.ServicesList = AutoWidthListCtrl(id=ID_DISCOVERYDIALOGSERVICESLIST, |
89 self.ServicesList = AutoWidthListCtrl(id=ID_DISCOVERYDIALOGSERVICESLIST, |
89 name='ServicesList', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0), |
90 name='ServicesList', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0), |
90 style=wx.LC_REPORT|wx.LC_EDIT_LABELS|wx.LC_SORT_ASCENDING|wx.LC_SINGLE_SEL) |
91 style=wx.LC_REPORT|wx.LC_EDIT_LABELS|wx.LC_SORT_ASCENDING|wx.LC_SINGLE_SEL) |
91 self.ServicesList.InsertColumn(0, 'NAME') |
92 self.ServicesList.InsertColumn(0, _('NAME')) |
92 self.ServicesList.InsertColumn(1, 'TYPE') |
93 self.ServicesList.InsertColumn(1, _('TYPE')) |
93 self.ServicesList.InsertColumn(2, 'IP') |
94 self.ServicesList.InsertColumn(2, _('IP')) |
94 self.ServicesList.InsertColumn(3, 'PORT') |
95 self.ServicesList.InsertColumn(3, _('PORT')) |
95 self.ServicesList.SetColumnWidth(0, 150) |
96 self.ServicesList.SetColumnWidth(0, 150) |
96 self.ServicesList.SetColumnWidth(1, 150) |
97 self.ServicesList.SetColumnWidth(1, 150) |
97 self.ServicesList.SetColumnWidth(2, 150) |
98 self.ServicesList.SetColumnWidth(2, 150) |
98 self.ServicesList.SetColumnWidth(3, 150) |
99 self.ServicesList.SetColumnWidth(3, 150) |
99 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, id=ID_DISCOVERYDIALOGSERVICESLIST) |
100 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, id=ID_DISCOVERYDIALOGSERVICESLIST) |