From d26e4815fe10b86fb88feea20ab846101b36c28f Mon Sep 17 00:00:00 2001 From: mfrasca <> Date: Fri, 6 Oct 2006 16:27:03 +0000 Subject: [PATCH] 1293224 char font recalculating the height of the lines. --- examples/pywmhdmon.py | 6 +++--- wmdocklib/pywmhelpers.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/pywmhdmon.py b/examples/pywmhdmon.py index 0787a80..8caeca8 100755 --- a/examples/pywmhdmon.py +++ b/examples/pywmhdmon.py @@ -147,7 +147,7 @@ class PywmHDMon: x + paintWidth + xOffset, y + yOffset) def getY(self, line): - return 2 + (line - 1) * (char_height + 3) + return 2 + (line - 1) * (char_height + 1) def paintLabel(self, line, label): self.addString(label, 1, self.getY(line)) @@ -446,8 +446,8 @@ def main(): displayMode = defaultMode pathsToMonitor.append((label[:3], path, displayMode, action)) wmdocklib.addMouseRegion(i, - 8, 8 + (i - 1) * (char_height + 3), - 58, 4 + i * (char_height + 3)) + 8, 8 + (i - 1) * (char_height + 1), + 58, 4 + i * (char_height + 1)) procStat = config.get('procstat', defaultProcStat) skipping = int(config.get('skipconf', 0)) actMonEnabled = int(config.get('monitoring')) diff --git a/wmdocklib/pywmhelpers.py b/wmdocklib/pywmhelpers.py index 050eba8..e77e69c 100644 --- a/wmdocklib/pywmhelpers.py +++ b/wmdocklib/pywmhelpers.py @@ -88,7 +88,11 @@ def addChar(ch, x, y, xOffset, yOffset, width, height): targY = y + yOffset if targX + char_width > width - xOffset or targY + char_height > height - yOffset\ or targX < 0 or targY < 0: - raise ValueError, "Out of bounds." + raise ValueError, "Out of bounds. %s %s %s %s" % ( + targX + char_width > width - xOffset, + targY + char_height > height - yOffset, + targX < 0, + targY < 0) pywmgeneral.copyXPMArea(chX, chY, char_width, char_height, targX, targY) return (char_width, char_height) @@ -106,7 +110,7 @@ def getVertSpacing(numLines, margin, height, yOffset): """Return the optimal spacing between a number of lines. margin is the space we want between the first line and the top.""" - h = height - numLines * char_height - yOffset * 2 - margin + h = height - (numLines * char_height + 1) - yOffset * 2 - margin return h / (numLines - 1)