dabo Commit
Revision 4152
Date: 2008-06-17 18:14:08 -0700 (Tue, 17 Jun 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4152
Changed:
U trunk/dabo/ui/uiwx/dEditor.py
Log:
Changed the 'LineNumber' property to be one-based, to match the displayed line
numbers in the editor. Added the '_ZeroBasedLineNumber' property that does the
actual communication with the wx layer.
Diff:
Modified: trunk/dabo/ui/uiwx/dEditor.py
===================================================================
--- trunk/dabo/ui/uiwx/dEditor.py 2008-06-17 23:53:07 UTC (rev 4151)
+++ trunk/dabo/ui/uiwx/dEditor.py 2008-06-18 01:14:08 UTC (rev 4152)
@@ -393,7 +393,7 @@
line number is passed.
"""
if line is None:
- line = self.LineNumber
+ line = self._ZeroBasedLineNumber
if nm in self._bookmarks.keys():
self.clearBookmark(nm)
hnd = self.MarkerAdd(line, self._bmkPos)
@@ -414,7 +414,7 @@
self.moveToEnd()
# Add some breathing room above
self.LineNumber = foundLine-3
- self.LineNumber = foundLine
+ self._ZeroBasedLineNumber = foundLine
def clearBookmark(self, nm):
@@ -1142,7 +1142,7 @@
a ValueError is raised.
"""
start = self.PositionFromLine(lineNum)
- end = self.PositionFromLine(lineNum+1)
+ end = self.PositionFromLine(lineNum+1) -1
if extend:
# Need to extend from the current position
currStart = self.GetSelectionStart()
@@ -2031,16 +2031,10 @@
def _getLineNumber(self):
- return self.GetCurrentLine()
+ return self._ZeroBasedLineNumber + 1
def _setLineNumber(self, val):
- try:
- # Try coercing to int
- val = int(val)
- except ValueError:
- pass
- self.GotoLine(val)
- self.EnsureCaretVisible()
+ self._ZeroBasedLineNumber = val - 1
def _getLineCount(self):
@@ -2279,6 +2273,22 @@
self.SetWrapMode(val)
+ def _getZeroBasedLineNumber(self):
+ return self.GetCurrentLine()
+
+ def _setZeroBasedLineNumber(self, val):
+ if self._constructed():
+ try:
+ # Try coercing to int
+ val = int(val)
+ except ValueError:
+ pass
+ self.GotoLine(val)
+ self.EnsureCaretVisible()
+ else:
+ self._properties["_ZeroBasedLineNumber"] = val
+
+
def _getZoomLevel(self):
return self.GetZoom()
@@ -2420,6 +2430,9 @@
_("""Controls whether text lines that are wider than
the window
are soft-wrapped or clipped. (bool)"""))
+ _ZeroBasedLineNumber = property(_getZeroBasedLineNumber,
_setZeroBasedLineNumber, None,
+ _("This is the underlying property that handles the
wxPython zero-based line numbering. It's equal to LineNumber-1 (int)"))
+
ZoomLevel = property(_getZoomLevel, _setZoomLevel, None,
_("Point increase/decrease from normal viewing size
(int)"))
_______________________________________________
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]