author | Laurent Bessard |
Sat, 25 Aug 2012 14:44:49 +0200 | |
changeset 745 | ecd2effd4660 |
parent 738 | 1ccd08cfae0c |
permissions | -rw-r--r-- |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
3 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
4 |
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
5 |
#based on the plcopen standard. |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
6 |
# |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
8 |
# |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
9 |
#See COPYING file for copyrights details. |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
10 |
# |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
11 |
#This library is free software; you can redistribute it and/or |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
12 |
#modify it under the terms of the GNU General Public |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
13 |
#License as published by the Free Software Foundation; either |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
14 |
#version 2.1 of the License, or (at your option) any later version. |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
15 |
# |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
16 |
#This library is distributed in the hope that it will be useful, |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
19 |
#General Public License for more details. |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
20 |
# |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
21 |
#You should have received a copy of the GNU General Public |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
22 |
#License along with this library; if not, write to the Free Software |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
24 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
25 |
import re |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
26 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
27 |
import wx |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
28 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
29 |
RE_ESCAPED_CHARACTERS = ".*+()[]?:|{}^$<>=-," |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
30 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
31 |
def EscapeText(text): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
32 |
text = text.replace('\\', '\\\\') |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
33 |
for c in RE_ESCAPED_CHARACTERS: |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
34 |
text = text.replace(c, '\\' + c) |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
35 |
return text |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
36 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
37 |
#------------------------------------------------------------------------------- |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
38 |
# Search In Project Dialog |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
39 |
#------------------------------------------------------------------------------- |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
40 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
41 |
def GetElementsChoices(): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
42 |
_ = lambda x: x |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
43 |
return [("datatype", _("Data Type")), |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
44 |
("function", _("Function")), |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
45 |
("functionBlock", _("Function Block")), |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
46 |
("program", _("Program")), |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
47 |
("configuration", _("Configuration"))] |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
48 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
49 |
class SearchInProjectDialog(wx.Dialog): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
50 |
|
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
51 |
def __init__(self, parent): |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
52 |
wx.Dialog.__init__(self, parent, title=_('Search in Project'), |
737 | 53 |
size=wx.Size(600, 350)) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
54 |
|
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
55 |
main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
56 |
main_sizer.AddGrowableCol(0) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
57 |
main_sizer.AddGrowableRow(1) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
58 |
|
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
59 |
pattern_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
60 |
pattern_sizer.AddGrowableCol(0) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
61 |
main_sizer.AddSizer(pattern_sizer, border=20, |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
62 |
flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
63 |
|
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
64 |
pattern_label = wx.StaticText(self, label=_('Pattern to search:')) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
65 |
pattern_sizer.AddWindow(pattern_label, flag=wx.ALIGN_BOTTOM) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
66 |
|
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
67 |
self.CaseSensitive = wx.CheckBox(self, label=_('Case sensitive')) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
68 |
pattern_sizer.AddWindow(self.CaseSensitive, flag=wx.GROW) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
69 |
|
738
1ccd08cfae0c
Adding support for in POU graphical and textual editor
Laurent Bessard
parents:
737
diff
changeset
|
70 |
self.Pattern = wx.TextCtrl(self) |
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
71 |
pattern_sizer.AddWindow(self.Pattern, flag=wx.GROW) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
72 |
|
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
73 |
self.RegularExpression = wx.CheckBox(self, label=_('Regular expression')) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
74 |
pattern_sizer.AddWindow(self.RegularExpression, flag=wx.GROW) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
75 |
|
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
76 |
scope_staticbox = wx.StaticBox(self, label=_('Scope')) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
77 |
scope_sizer = wx.StaticBoxSizer(scope_staticbox, wx.HORIZONTAL) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
78 |
main_sizer.AddSizer(scope_sizer, border=20, |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
79 |
flag=wx.GROW|wx.LEFT|wx.RIGHT) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
80 |
|
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
81 |
scope_selection_sizer = wx.BoxSizer(wx.VERTICAL) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
82 |
scope_sizer.AddSizer(scope_selection_sizer, 1, border=5, |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
83 |
flag=wx.GROW|wx.TOP|wx.LEFT|wx.BOTTOM) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
84 |
|
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
85 |
self.WholeProject = wx.RadioButton(self, label=_('Whole Project'), |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
86 |
size=wx.Size(0, 24), style=wx.RB_GROUP) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
87 |
self.WholeProject.SetValue(True) |
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
88 |
self.Bind(wx.EVT_RADIOBUTTON, self.OnScopeChanged, self.WholeProject) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
89 |
scope_selection_sizer.AddWindow(self.WholeProject, border=5, |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
90 |
flag=wx.GROW|wx.BOTTOM) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
91 |
|
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
92 |
self.OnlyElements = wx.RadioButton(self, |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
93 |
label=_('Only Elements'), size=wx.Size(0, 24)) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
94 |
self.Bind(wx.EVT_RADIOBUTTON, self.OnScopeChanged, self.OnlyElements) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
95 |
self.OnlyElements.SetValue(False) |
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
96 |
scope_selection_sizer.AddWindow(self.OnlyElements, flag=wx.GROW) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
97 |
|
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
98 |
self.ElementsList = wx.CheckListBox(self) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
99 |
self.ElementsList.Enable(False) |
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
100 |
scope_sizer.AddWindow(self.ElementsList, 1, border=5, |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
101 |
flag=wx.GROW|wx.TOP|wx.RIGHT|wx.BOTTOM) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
102 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
103 |
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE) |
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
104 |
ok_button = self.ButtonSizer.GetAffirmativeButton() |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
105 |
ok_button.SetLabel(_('Search')) |
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
106 |
self.Bind(wx.EVT_BUTTON, self.OnOK, ok_button) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
107 |
main_sizer.AddSizer(self.ButtonSizer, border=20, |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
108 |
flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
109 |
|
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
110 |
self.SetSizer(main_sizer) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
111 |
|
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
112 |
for name, label in GetElementsChoices(): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
113 |
self.ElementsList.Append(_(label)) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
571
diff
changeset
|
114 |
|
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
571
diff
changeset
|
115 |
self.Pattern.SetFocus() |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
116 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
117 |
def GetCriteria(self): |
571 | 118 |
raw_pattern = pattern = self.Pattern.GetValue() |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
119 |
if not self.CaseSensitive.GetValue(): |
571 | 120 |
pattern = pattern.upper() |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
121 |
if not self.RegularExpression.GetValue(): |
571 | 122 |
pattern = EscapeText(pattern) |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
123 |
criteria = { |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
124 |
"raw_pattern": raw_pattern, |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
125 |
"pattern": re.compile(pattern), |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
126 |
"case_sensitive": self.CaseSensitive.GetValue(), |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
127 |
"regular_expression": self.RegularExpression.GetValue(), |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
128 |
} |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
129 |
if self.WholeProject.GetValue(): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
130 |
criteria["filter"] = "all" |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
131 |
elif self.OnlyElements.GetValue(): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
132 |
criteria["filter"] = [] |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
133 |
for index, (name, label) in enumerate(GetElementsChoices()): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
134 |
if self.ElementsList.IsChecked(index): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
135 |
criteria["filter"].append(name) |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
136 |
return criteria |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
137 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
138 |
def OnScopeChanged(self, event): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
139 |
self.ElementsList.Enable(self.OnlyElements.GetValue()) |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
140 |
event.Skip() |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
141 |
|
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
142 |
def OnOK(self, event): |
738
1ccd08cfae0c
Adding support for in POU graphical and textual editor
Laurent Bessard
parents:
737
diff
changeset
|
143 |
message = None |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
144 |
if self.Pattern.GetValue() == "": |
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
145 |
message = _("Form isn't complete. Pattern to search must be filled!") |
566
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
146 |
else: |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
147 |
wrong_pattern = False |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
148 |
if self.RegularExpression.GetValue(): |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
149 |
try: |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
150 |
re.compile(self.Pattern.GetValue()) |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
151 |
except: |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
152 |
wrong_pattern = True |
6014ef82a98a
Adding support for searching text or regular expression in whole project
laurent
parents:
diff
changeset
|
153 |
if wrong_pattern: |
714
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
154 |
message = _("Syntax error in regular expression of pattern to search!") |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
155 |
|
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
156 |
if message is not None: |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
157 |
dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR) |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
158 |
dialog.ShowModal() |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
159 |
dialog.Destroy() |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
160 |
else: |
131ea7f237b9
Replacing buttons with text by buttons with icons
Laurent Bessard
parents:
577
diff
changeset
|
161 |
self.EndModal(wx.ID_OK) |