Changeset 4249

Show
Ignore:
Timestamp:
07/08/08 12:42:16 (2 months ago)
Author:
nate
Message:

Added an EOLMode property. The property the is stored as a string and allows you to set the EOLMode of the file to CRLF, LF, or CR standards. If not explicitly set by the user, the standard will default to the OS standard. Upon setting the EOLMode, all end of line markers are automatically converted to the new standard.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/ui/uiwx/dEditor.py

    r4246 r4249  
    242242        self._hiliteLimitColumn = 79 
    243243        self._encoding = self.Application.Encoding 
     244        self._eolMode = "" 
    244245        self._useAntiAliasing = True 
    245246        self._codeFolding = True 
     
    676677        ## Seems that eolmode is CRLF on Mac by default... explicitly set it! 
    677678        if wx.Platform == "__WXMSW__": 
    678             self.SetEOLMode(stc.STC_EOL_CRLF) 
    679         else: 
    680             self.SetEOLMode(stc.STC_EOL_LF) 
     679            self.EOLMode = "CRLF" 
     680        else: 
     681            self.EOLMode = "LF" 
    681682 
    682683        if self.HiliteCharsBeyondLimit: 
     
    19301931 
    19311932 
     1933    def _getEOLMode(self): 
     1934        return self._eolMode 
     1935 
     1936    def _setEOLMode(self, val): 
     1937        if _constructer(): 
     1938            if val.lower() == "crlf": 
     1939                self.SetEOLMode(stc.STC_EOL_CRLF) 
     1940                self.ConvertEOLs(stc.STC_EOL_CRLF) 
     1941                self._eolMode = "CRLF" 
     1942            elif val.lower() == "lf": 
     1943                self.SetEOLMode(stc.STC_EOL_LF) 
     1944                self.ConvertEOLs(stc.STC_EOL_LF) 
     1945                self._eolMode = "LF" 
     1946            elif val.lower() == "cr": 
     1947                self.SetEOLMode(stc.STC_EOL_CR) 
     1948                self.ConvertEOLs(stc.STC_EOL_CR) 
     1949                self._eolMode = "CR" 
     1950            else: 
     1951                raise ValueError, "EOLMode value must be either 'LFCR', 'LF', or 'CR'" 
     1952        else: 
     1953            self._properties["EOLMode"] = val 
     1954 
     1955 
    19321956    def _getFileName(self): 
    19331957        return os.path.split(self._fileName)[1] 
     
    23002324            _("Type of encoding to use. Defaults to the application's default encoding.  (str)")) 
    23012325     
     2326    EOLMode = property(_getEOLMode, _setEOLMode, None, 
     2327            _("End of line characters. Allowed values are 'CRLF', 'LF' and 'CR'. (default=os dependent) (str)")) 
     2328     
    23022329    FileName = property(_getFileName, None, None, 
    23032330            _("Name of the file being edited (without path info)  (str)"))