dabo Commit
Revision 4504
Date: 2008-09-05 09:13:29 -0700 (Fri, 05 Sep 2008)
Author: Nate
Trac: http://svn.dabodev.com/trac/dabo/changeset/4504

Changed:
U   trunk/dabo/ui/uiwx/dEditor.py

Log:
Added 2 new properties to the dEditor widget.  They are ShowEdgeGuide and 
EdgeGuideColumn.  Basically, ShowEdgeGuide will display a line at the specified 
column position.  Note that if the editor has a variable spaced font set, wx 
uses the average of the characters' widths to determine where to put the line.  
Also note that wx will only allow for either HiliteCharsBeyondLimit or 
ShowEdgeGuide to be True, not both.  So, when one is set to True, the other is 
set to False.

Fixed a bug where if we set HiliteCharsBeyondLimit to True and then set it to 
False, the highlighting wouldn't go away.

What I would like to do is combine HiliteLimitColumn and EdgeGuideColumn into 
one property.  I would also like to combine HiliteCharsBeyondLimit and 
ShowEdgeGuide in a property (EdgeMode maybe?).  Ed and Paul, thoughts?  If 
y'all agree, I'll do it, and keep HiliteCharsBeyondLimit and HiliteLimitColumn 
functional, but issue a deprecation warning when they're called.

Diff:
Modified: trunk/dabo/ui/uiwx/dEditor.py
===================================================================
--- trunk/dabo/ui/uiwx/dEditor.py       2008-09-04 23:18:01 UTC (rev 4503)
+++ trunk/dabo/ui/uiwx/dEditor.py       2008-09-05 16:13:29 UTC (rev 4504)
@@ -241,6 +241,8 @@
                self._bufferedDrawing = True
                self._hiliteCharsBeyondLimit = False
                self._hiliteLimitColumn = 79
+               self._showEdgeGuide = False
+               self._edgeGuideColumn = 80
                self._encoding = self.Application.Encoding
                self._eolMode = ""
                self._useAntiAliasing = True
@@ -1950,6 +1952,18 @@
                        self._properties["CommentString"] = val
 
 
+       def _getEdgeGuideColumn(self):
+               return self._edgeGuideColumn
+       
+       def _setEdgeGuideColumn(self, val):
+               if self._constructed():
+                       self._edgeGuideColumn = val
+                       if self.ShowEdgeGuide:
+                               self.SetEdgeColumn(val)
+               else:
+                       self._properties["EdgeGuideColumn"] = val
+
+
        def _getEncoding(self):
                return self._encoding
 
@@ -2023,10 +2037,12 @@
        def _setHiliteCharsBeyondLimit(self, val):
                if self._constructed():
                        self._hiliteCharsBeyondLimit = val
-               if val:
-                       self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
-                       self.SetEdgeColumn(self.HiliteLimitColumn)
-
+                       if val:
+                               self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
+                               self.SetEdgeColumn(self.HiliteLimitColumn)
+                               self._showEdgeGuide = False
+                       else:
+                               self.SetEdgeMode(stc.STC_EDGE_NONE)
                else:
                        self._properties["HiliteCharsBeyondLimit"] = val
 
@@ -2037,7 +2053,8 @@
        def _setHiliteLimitColumn(self, val):
                if self._constructed():
                        self._hiliteLimitColumn = val
-                       self.SetEdgeColumn(val)
+                       if self.HiliteCharsBeyondLimit:
+                               self.SetEdgeColumn(val)
                else:
                        self._properties["HiliteLimitColumn"] = val
 
@@ -2167,6 +2184,22 @@
                        self._properties["ShowCodeFolding"] = val
 
 
+       def _getShowEdgeGuide(self):
+               return self._showEdgeGuide
+
+       def _setShowEdgeGuide(self, val):
+               if self._constructed():
+                       self._showEdgeGuide = val
+                       if val:
+                               self.SetEdgeMode(stc.STC_EDGE_LINE)
+                               self.SetEdgeColumn(self.EdgeGuideColumn)
+                               self._hiliteCharsBeyondLimit = False
+                       else:
+                               self.SetEdgeMode(stc.STC_EDGE_NONE)
+               else:
+                       self._properties["ShowEdgeGuide"] = val
+
+
        def _getShowEOL(self):
                return self._showEOL
 
@@ -2361,6 +2394,10 @@
        CommentString = property(_getCommentString, _setCommentString, None,
                        _("String used to prefix lines that are commented out  
(str)"))
        
+       EdgeGuideColumn = property(_getEdgeGuideColumn, _setEdgeGuideColumn, 
None,
+                       _("""If self.EdgeGuide is set to True, specifies the 
column 
+                       position the guide is in(int)"""))
+       
        Encoding = property(_getEncoding, _setEncoding, None,
                        _("Type of encoding to use. Defaults to the 
application's default encoding.  (str)"))
        
@@ -2381,7 +2418,8 @@
        
        HiliteCharsBeyondLimit = property(_getHiliteCharsBeyondLimit, 
_setHiliteCharsBeyondLimit, None,
                        _("""When True, characters beyond the column set it 
-                       self.HiliteLimitColumn are visibly hilited  (bool)"""))
+                       self.HiliteLimitColumn are visibly hilited  Note: When 
set to True,
+                       self.ShowEdgeGuide will be set to False. (bool)"""))
        
        HiliteLimitColumn = property(_getHiliteLimitColumn, 
_setHiliteLimitColumn, None,
                        _("""If self.HiliteCharsBeyondLimit is True, specifies 
@@ -2427,6 +2465,11 @@
                        _("""Determines if the code folding symbols are 
displayed 
                        in the left margin (default=True)  (bool)"""))
        
+       ShowEdgeGuide = property(_getShowEdgeGuide, _setShowEdgeGuide, None,
+                       _("""When True, will display a line at the column set 
by 
+                       self.EdgeGuideColumn.  Note: When set to True, 
+                       self.HiliteCharsBeyondLimit will be set to False. 
(bool)"""))
+       
        ShowEOL = property(_getShowEOL, _setShowEOL, None,
                        _("""Determines if end-of-line markers are visible 
                        (default=False)  (bool)"""))




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to