def OnReplace(self, event):
        """Called when a replace operation is started, returns find position"""

        find_string = event.GetFindString()
        flags = self._wxflag2flag(event.GetFlags())
        replace_string = event.GetReplaceString()

        gridpos = list(self.grid.actions.cursor)

        findpos = self.grid.actions.find(gridpos, find_string, flags,
                                         search_result=False)

        if findpos is None:
            statustext = _(u"'{find_string}' not found.")
            statustext = statustext.format(find_string=find_string)

        else:
            with undo.group(_("Replace")):
                self.grid.actions.replace(findpos, find_string, replace_string)
            self.grid.actions.cursor = findpos

            # Update statusbar
            statustext = _(u"Replaced '{find_string}' in cell {key} with "
                           u"{replace_string}.")
            statustext = statustext.format(find_string=find_string,
                                           key=findpos,
                                           replace_string=replace_string)

        post_command_event(self.grid.main_window, self.grid.StatusBarMsg,
                           text=statustext)

        event.Skip()
def OnReplace ( self , event ) : find_string = event . GetFindString ( ) flags = self . _wxflag2flag ( event . GetFlags ( ) ) replace_string = event . GetReplaceString ( ) gridpos = list ( self . grid . actions . cursor ) findpos = self . grid . actions . find ( gridpos , find_string , flags , search_result = False ) if findpos is None : statustext = _ ( u"'{find_string}' not found." ) statustext = statustext . format ( find_string = find_string ) else : with undo . group ( _ ( "Replace" ) ) : self . grid . actions . replace ( findpos , find_string , replace_string ) self . grid . actions . cursor = findpos statustext = _ ( u"Replaced '{find_string}' in cell {key} with " u"{replace_string}." ) statustext = statustext . format ( find_string = find_string , key = findpos , replace_string = replace_string ) post_command_event ( self . grid . main_window , self . grid . StatusBarMsg , text = statustext ) event . Skip ( )
Called when a replace operation is started, returns find position