22 # You should have received a copy of the GNU General Public License |
22 # You should have received a copy of the GNU General Public License |
23 # along with this program; if not, write to the Free Software |
23 # along with this program; if not, write to the Free Software |
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
25 |
25 |
26 import re |
26 import re |
|
27 import wx |
27 from plcopen.plcopen import * |
28 from plcopen.plcopen import * |
28 import wx |
29 from util.TranslationCatalogs import NoTranslate |
29 |
30 |
30 #------------------------------------------------------------------------------- |
31 # ------------------------------------------------------------------------------- |
31 # Search In Project Dialog |
32 # Search In Project Dialog |
32 #------------------------------------------------------------------------------- |
33 # ------------------------------------------------------------------------------- |
|
34 |
33 |
35 |
34 def GetElementsChoices(): |
36 def GetElementsChoices(): |
35 _ = lambda x: x |
37 _ = NoTranslate |
36 return [("datatype", _("Data Type")), |
38 return [("datatype", _("Data Type")), |
37 ("function", _("Function")), |
39 ("function", _("Function")), |
38 ("functionBlock", _("Function Block")), |
40 ("functionBlock", _("Function Block")), |
39 ("program", _("Program")), |
41 ("program", _("Program")), |
40 ("configuration", _("Configuration"))] |
42 ("configuration", _("Configuration"))] |
41 |
43 |
|
44 |
42 class SearchInProjectDialog(wx.Dialog): |
45 class SearchInProjectDialog(wx.Dialog): |
43 |
46 |
44 def __init__(self, parent): |
47 def __init__(self, parent): |
45 wx.Dialog.__init__(self, parent, title=_('Search in Project')) |
48 wx.Dialog.__init__(self, parent, title=_('Search in Project')) |
46 |
49 |
47 main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) |
50 main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) |
48 main_sizer.AddGrowableCol(0) |
51 main_sizer.AddGrowableCol(0) |
49 main_sizer.AddGrowableRow(1) |
52 main_sizer.AddGrowableRow(1) |
50 |
53 |
51 pattern_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5) |
54 pattern_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5) |
52 pattern_sizer.AddGrowableCol(0) |
55 pattern_sizer.AddGrowableCol(0) |
53 main_sizer.AddSizer(pattern_sizer, border=20, |
56 main_sizer.AddSizer(pattern_sizer, border=20, |
54 flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT) |
57 flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT) |
55 |
58 |
56 pattern_label = wx.StaticText(self, label=_('Pattern to search:')) |
59 pattern_label = wx.StaticText(self, label=_('Pattern to search:')) |
57 pattern_sizer.AddWindow(pattern_label, flag=wx.ALIGN_BOTTOM) |
60 pattern_sizer.AddWindow(pattern_label, flag=wx.ALIGN_BOTTOM) |
58 |
61 |
59 self.CaseSensitive = wx.CheckBox(self, label=_('Case sensitive')) |
62 self.CaseSensitive = wx.CheckBox(self, label=_('Case sensitive')) |
60 pattern_sizer.AddWindow(self.CaseSensitive, flag=wx.GROW) |
63 pattern_sizer.AddWindow(self.CaseSensitive, flag=wx.GROW) |
61 |
64 |
62 self.Pattern = wx.TextCtrl(self, size=wx.Size(250,-1)) |
65 self.Pattern = wx.TextCtrl(self, size=wx.Size(250, -1)) |
63 self.Bind(wx.EVT_TEXT, self.FindPatternChanged, self.Pattern) |
66 self.Bind(wx.EVT_TEXT, self.FindPatternChanged, self.Pattern) |
64 pattern_sizer.AddWindow(self.Pattern, flag=wx.GROW) |
67 pattern_sizer.AddWindow(self.Pattern, flag=wx.GROW) |
65 self.Bind(wx.EVT_CHAR_HOOK, self.OnEscapeKey) |
68 self.Bind(wx.EVT_CHAR_HOOK, self.OnEscapeKey) |
66 self.RegularExpression = wx.CheckBox(self, label=_('Regular expression')) |
69 self.RegularExpression = wx.CheckBox(self, label=_('Regular expression')) |
67 pattern_sizer.AddWindow(self.RegularExpression, flag=wx.GROW) |
70 pattern_sizer.AddWindow(self.RegularExpression, flag=wx.GROW) |
68 |
71 |
69 scope_staticbox = wx.StaticBox(self, label=_('Scope')) |
72 scope_staticbox = wx.StaticBox(self, label=_('Scope')) |
70 scope_sizer = wx.StaticBoxSizer(scope_staticbox, wx.HORIZONTAL) |
73 scope_sizer = wx.StaticBoxSizer(scope_staticbox, wx.HORIZONTAL) |
71 main_sizer.AddSizer(scope_sizer, border=20, |
74 main_sizer.AddSizer(scope_sizer, border=20, |
72 flag=wx.GROW|wx.LEFT|wx.RIGHT) |
75 flag=wx.GROW | wx.LEFT | wx.RIGHT) |
73 |
76 |
74 scope_selection_sizer = wx.BoxSizer(wx.VERTICAL) |
77 scope_selection_sizer = wx.BoxSizer(wx.VERTICAL) |
75 scope_sizer.AddSizer(scope_selection_sizer, 1, border=5, |
78 scope_sizer.AddSizer(scope_selection_sizer, 1, border=5, |
76 flag=wx.GROW|wx.TOP|wx.LEFT|wx.BOTTOM) |
79 flag=wx.GROW | wx.TOP | wx.LEFT | wx.BOTTOM) |
77 |
80 |
78 self.WholeProject = wx.RadioButton(self, label=_('Whole Project'), style=wx.RB_GROUP) |
81 self.WholeProject = wx.RadioButton(self, label=_('Whole Project'), style=wx.RB_GROUP) |
79 self.WholeProject.SetValue(True) |
82 self.WholeProject.SetValue(True) |
80 self.Bind(wx.EVT_RADIOBUTTON, self.OnScopeChanged, self.WholeProject) |
83 self.Bind(wx.EVT_RADIOBUTTON, self.OnScopeChanged, self.WholeProject) |
81 scope_selection_sizer.AddWindow(self.WholeProject, border=5, |
84 scope_selection_sizer.AddWindow(self.WholeProject, border=5, |
82 flag=wx.GROW|wx.BOTTOM) |
85 flag=wx.GROW | wx.BOTTOM) |
83 |
86 |
84 self.OnlyElements = wx.RadioButton(self, label=_('Only Elements')) |
87 self.OnlyElements = wx.RadioButton(self, label=_('Only Elements')) |
85 self.Bind(wx.EVT_RADIOBUTTON, self.OnScopeChanged, self.OnlyElements) |
88 self.Bind(wx.EVT_RADIOBUTTON, self.OnScopeChanged, self.OnlyElements) |
86 self.OnlyElements.SetValue(False) |
89 self.OnlyElements.SetValue(False) |
87 scope_selection_sizer.AddWindow(self.OnlyElements, flag=wx.GROW) |
90 scope_selection_sizer.AddWindow(self.OnlyElements, flag=wx.GROW) |
88 |
91 |
89 self.ElementsList = wx.CheckListBox(self) |
92 self.ElementsList = wx.CheckListBox(self) |
90 self.ElementsList.Enable(False) |
93 self.ElementsList.Enable(False) |
91 scope_sizer.AddWindow(self.ElementsList, 1, border=5, |
94 scope_sizer.AddWindow(self.ElementsList, 1, border=5, |
92 flag=wx.GROW|wx.TOP|wx.RIGHT|wx.BOTTOM) |
95 flag=wx.GROW | wx.TOP | wx.RIGHT | wx.BOTTOM) |
93 |
96 |
94 buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) |
97 buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) |
95 main_sizer.AddSizer(buttons_sizer, border=20, |
98 main_sizer.AddSizer(buttons_sizer, border=20, |
96 flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_RIGHT) |
99 flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_RIGHT) |
97 |
100 |