From a6178fc05f6d296533718694bf8d4ae4bb80f994 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 12 Oct 2005 23:27:18 +0000 Subject: fix drawing of configSequence string can now be used for input of: - IPs - MACs (just decimal values up to now) - Integers of a defined size - real numbers with a defined size before and after the decimal point --- lib/python/Components/config.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/python/Components/config.py') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 93479b66..9c2c3f43 100644 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -137,8 +137,12 @@ class configSequence: self.valueBounds = self.parent.vals[1] def checkValues(self): - maxPos = len(self.parent.value) * len(self.valueBounds) + len(self.parent.value) - + maxPos = 0 + num = 0 + for i in self.parent.value: + maxPos += len(str(self.valueBounds[num][1])) + num += 1 + if self.markedPos >= maxPos: self.markedPos = maxPos - 1 if self.markedPos < 0: @@ -188,6 +192,7 @@ class configSequence: value = "" mPos = self.markedPos print "Positon: " + str(mPos) + num = 0; for i in self.parent.value: if len(value): #fixme no heading separator possible value += self.seperator @@ -198,9 +203,9 @@ class configSequence: #if diff > 0: ## if this helps?! #value += " " * diff - print (("%0" + str(len(str(self.valueBounds[0][1]))) + "d") % i) - value += ("%0" + str(len(str(self.valueBounds[0][1]))) + "d") % i - + print (("%0" + str(len(str(self.valueBounds[num][1]))) + "d") % i) + value += ("%0" + str(len(str(self.valueBounds[num][1]))) + "d") % i + num += 1 # only mark cursor when we are selected # (this code is heavily ink optimized!) return ("mtext"[1-selected:], value, [mPos]) -- cgit v1.2.3