parameters: (self)
docstring: Reloads the current file, returns True on success and
          False if there is a failure.
          @return: whether file was reloaded or not
docstring_summary: Reloads the current file, returns True on success and
          False if there is a failure.
          @return: whether file was reloaded or not
docstring_tokens: Reloads the current file returns True on success and False if there is a failure . @return : whether file was reloaded or not
function: def ReloadFile(self):
          """Reloads the current file, returns True on success and
          False if there is a failure.
          @return: whether file was reloaded or not
  
          """
          cfile = self.GetFileName()
          if os.path.exists(cfile):
              try:
                  self.BeginUndoAction()
                  marks = self.GetBookmarks()
                  cpos = self.GetCurrentPos()
                  # TODO: Handle async re-loads of large files
                  txt = self.File.Read()
                  self.SetReadOnly(False)
                  if txt is not None:
                      if self.File.IsRawBytes() and not ebmlib.IsUnicode(txt):
                          self.AddStyledText(txt)
                          self.SetReadOnly(True) # Don't allow editing of raw bytes
                      else:
                          self.SetText(txt)
                  else:
                      return False, _("Failed to reload: %s") % cfile
  
                  self.SetModTime(ebmlib.GetFileModTime(cfile))
                  for mark in marks:
                      self.AddBookmark(mark)
                  self.EndUndoAction()
                  self.SetSavePoint()
              except (UnicodeDecodeError, AttributeError, OSError, IOError), msg:
                  self.LOG("[ed_stc][err] Failed to Reload %s" % cfile)
                  return False, msg
              else:
                  self.GotoPos(cpos)
                  context = self.TopLevelParent.Id
                  ed_msg.PostMessage(ed_msg.EDMSG_FILE_OPENED,
                                     self.GetFileName(), context)
                  return True, ''
          else:
              self.LOG("[ed_stc][err] %s does not exists, cant reload." % cfile)
              return False, _("%s does not exist") % cfile
function_tokens: def ReloadFile ( self ) : cfile = self . GetFileName ( ) if os . path . exists ( cfile ) : try : self . BeginUndoAction ( ) marks = self . GetBookmarks ( ) cpos = self . GetCurrentPos ( ) # TODO: Handle async re-loads of large files txt = self . File . Read ( ) self . SetReadOnly ( False ) if txt is not None : if self . File . IsRawBytes ( ) and not ebmlib . IsUnicode ( txt ) : self . AddStyledText ( txt ) self . SetReadOnly ( True ) # Don't allow editing of raw bytes else : self . SetText ( txt ) else : return False , _ ( "Failed to reload: %s" ) % cfile self . SetModTime ( ebmlib . GetFileModTime ( cfile ) ) for mark in marks : self . AddBookmark ( mark ) self . EndUndoAction ( ) self . SetSavePoint ( ) except ( UnicodeDecodeError , AttributeError , OSError , IOError ) , msg : self . LOG ( "[ed_stc][err] Failed to Reload %s" % cfile ) return False , msg else : self . GotoPos ( cpos ) context = self . TopLevelParent . Id ed_msg . PostMessage ( ed_msg . EDMSG_FILE_OPENED , self . GetFileName ( ) , context ) return True , '' else : self . LOG ( "[ed_stc][err] %s does not exists, cant reload." % cfile ) return False , _ ( "%s does not exist" ) % cfile