1
0
mirror of https://github.com/gryf/wmdocklib.git synced 2025-12-19 20:38:03 +01:00

1578113: trailing black in text line

rewritten the _scrollAndDisplay method.
This commit is contained in:
mfrasca
2006-10-16 13:12:13 +00:00
parent 111d3f4ed9
commit 40e45c56ba

View File

@@ -141,7 +141,7 @@ height = 64
xOffset = 4 xOffset = 4
yOffset = 4 yOffset = 4
maxChars = 9 maxChars = 13
defaultConfigFile = '~/.pywmgenericrc' defaultConfigFile = '~/.pywmgenericrc'
defaultRGBFiles = ('/usr/share/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt') defaultRGBFiles = ('/usr/share/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt')
@@ -191,6 +191,7 @@ class Entry:
self._display = display self._display = display
self._scrollText = scrollText self._scrollText = scrollText
self._glue = ' ... '
self._scrollPos = 0 self._scrollPos = 0
self._tickCount = 0L self._tickCount = 0L
@@ -331,23 +332,16 @@ class Entry:
When reaching the end, paint number of spaces before scrolling in the When reaching the end, paint number of spaces before scrolling in the
same line again from the right. same line again from the right.
""" """
if self._scrollPos >= \
len(self._displayLine) + (maxChars - 4): # increase the amount of scrolled chars by one, modulo the lenght.
self._scrollPos = 0 # take the line, append to it some glue and a copy of the line
self.displayText(self._displayLine) # again, drop as many characters as the updated scrollPos, display
elif self._scrollPos >= len(self._displayLine) - 3: # the resulting text.
self._scrollPos += 1 self._scrollPos += 1
disp = self._displayLine[self._scrollPos:] + \ self._scrollPos %= len(self._displayLine) + len(self._glue)
' ' * (maxChars - 3) disp = self._displayLine + self._glue + self._displayLine
diff = self._scrollPos - len(self._displayLine) disp = disp[self._scrollPos:]
if diff > 0:
disp = disp[diff:]
disp += self._displayLine
self.displayText(disp) self.displayText(disp)
else:
self._scrollPos += 1
self.displayText(
self._displayLine[self._scrollPos:])
def tick1(self): def tick1(self):
"""Do things that should be done often. """Do things that should be done often.