151 section_end = "$" |
151 section_end = "$" |
152 section_infos["pattern"] = re.compile( |
152 section_infos["pattern"] = re.compile( |
153 section_infos["comment"] + "(.*)" + |
153 section_infos["comment"] + "(.*)" + |
154 section_end, re.DOTALL) |
154 section_end, re.DOTALL) |
155 |
155 |
156 self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|wx.stc.STC_MOD_BEFOREDELETE) |
156 self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT | wx.stc.STC_MOD_BEFOREDELETE) |
157 |
157 |
158 self.Bind(wx.stc.EVT_STC_DO_DROP, self.OnDoDrop) |
158 self.Bind(wx.stc.EVT_STC_DO_DROP, self.OnDoDrop) |
159 self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus) |
159 self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus) |
160 self.Bind(wx.stc.EVT_STC_MODIFIED, self.OnModification) |
160 self.Bind(wx.stc.EVT_STC_MODIFIED, self.OnModification) |
161 |
161 |
169 self.CurrentFindHighlight = None |
169 self.CurrentFindHighlight = None |
170 |
170 |
171 def OnModification(self, event): |
171 def OnModification(self, event): |
172 if not self.DisableEvents: |
172 if not self.DisableEvents: |
173 mod_type = event.GetModificationType() |
173 mod_type = event.GetModificationType() |
174 if not (mod_type&wx.stc.STC_PERFORMED_UNDO or mod_type&wx.stc.STC_PERFORMED_REDO): |
174 if not (mod_type & wx.stc.STC_PERFORMED_UNDO or mod_type & wx.stc.STC_PERFORMED_REDO): |
175 if mod_type&wx.stc.STC_MOD_BEFOREINSERT: |
175 if mod_type & wx.stc.STC_MOD_BEFOREINSERT: |
176 if self.CurrentAction is None: |
176 if self.CurrentAction is None: |
177 self.StartBuffering() |
177 self.StartBuffering() |
178 elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1: |
178 elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1: |
179 self.Controler.EndBuffering() |
179 self.Controler.EndBuffering() |
180 self.StartBuffering() |
180 self.StartBuffering() |
181 self.CurrentAction = ("Add", event.GetPosition()) |
181 self.CurrentAction = ("Add", event.GetPosition()) |
182 wx.CallAfter(self.RefreshModel) |
182 wx.CallAfter(self.RefreshModel) |
183 elif mod_type&wx.stc.STC_MOD_BEFOREDELETE: |
183 elif mod_type & wx.stc.STC_MOD_BEFOREDELETE: |
184 if self.CurrentAction is None: |
184 if self.CurrentAction is None: |
185 self.StartBuffering() |
185 self.StartBuffering() |
186 elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1: |
186 elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1: |
187 self.Controler.EndBuffering() |
187 self.Controler.EndBuffering() |
188 self.StartBuffering() |
188 self.StartBuffering() |
762 |
762 |
763 def DoGetBestSize(self): |
763 def DoGetBestSize(self): |
764 return self.ParentWindow.GetPanelBestSize() |
764 return self.ParentWindow.GetPanelBestSize() |
765 |
765 |
766 def ShowErrorMessage(self, message): |
766 def ShowErrorMessage(self, message): |
767 dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR) |
767 dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR) |
768 dialog.ShowModal() |
768 dialog.ShowModal() |
769 dialog.Destroy() |
769 dialog.Destroy() |
770 |
770 |
771 def OnVariablesGridCellChange(self, event): |
771 def OnVariablesGridCellChange(self, event): |
772 row, col = event.GetRow(), event.GetCol() |
772 row, col = event.GetRow(), event.GetCol() |