code: def _is_aborted(self, cycle, statustext, total_elements=None, freq=None):
          
  
          if total_elements is None:
              statustext += _("{nele} elements processed. Press <Esc> to abort.")
          else:
              statustext += _("{nele} of {totalele} elements processed. "
                              "Press <Esc> to abort.")
  
          if freq is None:
              show_msg = False
              freq = 1000
          else:
              show_msg = True
  
          # Show progress in statusbar each freq (1000) cells
          if cycle % freq == 0:
              if show_msg:
                  text = statustext.format(nele=cycle, totalele=total_elements)
                  try:
                      post_command_event(self.main_window, self.StatusBarMsg,
                                         text=text)
                  except TypeError:
                      # The main window does not exist any more
                      pass
  
              # Now wait for the statusbar update to be written on screen
              if is_gtk():
                  try:
                      wx.Yield()
                  except:
                      pass
  
              # Abort if we have to
              if self.need_abort:
                  # We have to abort`
                  return True
  
          # Continue
          return False
docs: Displays progress and returns True if abort
  
          Parameters
          ----------
  
          cycle: Integer
          \tThe current operation cycle
          statustext: String
          \tLeft text in statusbar to be displayed
          total_elements: Integer:
          \tThe number of elements that have to be processed
          freq: Integer, defaults to None
          \tNo. operations between two abort possibilities, 1000 if None