dabo Commit
Revision 4149
Date: 2008-06-17 16:21:14 -0700 (Tue, 17 Jun 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4149

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

Log:
Refactored out the code that hilites a line into its own method, so that it can 
be called independently.


Diff:
Modified: trunk/dabo/ui/uiwx/dEditor.py
===================================================================
--- trunk/dabo/ui/uiwx/dEditor.py       2008-06-17 23:12:01 UTC (rev 4148)
+++ trunk/dabo/ui/uiwx/dEditor.py       2008-06-17 23:21:14 UTC (rev 4149)
@@ -1134,17 +1134,24 @@
                elif mg == 1:
                        # Line number margin; hilite the line
                        ln = self.LineFromPosition(evt.GetPosition())
-                       start = self.PositionFromLine(ln)
-                       end = self.PositionFromLine(ln+1)
-                       if evt.GetShift():
-                               # Need to extend from the current position
-                               currStart = self.GetSelectionStart()
-                               currEnd = self.GetSelectionEnd()
-                               start = min(start, currStart)
-                               end = max(end, currEnd)
-                       self.SetSelection(start, end)
-                               
-       
+                       self.hiliteLine(ln, evt.GetShift())
+
+
+       def hiliteLine(self, lineNum, extend=False):
+               """Selects the specified line. If the line number does not 
exist, 
+               a ValueError is raised.
+               """
+               start = self.PositionFromLine(lineNum)
+               end = self.PositionFromLine(lineNum+1)
+               if extend:
+                       # Need to extend from the current position
+                       currStart = self.GetSelectionStart()
+                       currEnd = self.GetSelectionEnd()
+                       start = min(start, currStart)
+                       end = max(end, currEnd)
+               self.SetSelection(start, end)
+
+
        def callTip(self):
                """Present the call tip for the current object, if any."""
                runtimeObjName = self._getRuntimeObjectName()




_______________________________________________
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