Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/abacus_window.py
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2010-10-01 16:54:02 (GMT)
committer Walter Bender <walter@sugarlabs.org>2010-10-01 16:54:02 (GMT)
commit7fa4421c4b70c6988d0694c7416e68d89b03a48e (patch)
tree16760c86ee43587fae078bb3159d75bb98d88e0a /abacus_window.py
parent783483323178bafc4d60c5e29a33c1a0939e1484 (diff)
propogate abacus value between abaci
Diffstat (limited to 'abacus_window.py')
-rw-r--r--abacus_window.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/abacus_window.py b/abacus_window.py
index 7e150f5..569eec0 100644
--- a/abacus_window.py
+++ b/abacus_window.py
@@ -757,23 +757,25 @@ class AbacusGeneric():
def value(self, count_beads=False):
""" Return a string representing the value of each rod. """
- string = ''
- v = []
- for r in range(self.num_rods+1): # +1 for overflow
- v.append(0)
-
- # Tally the values on each rod.
- for i, bead in enumerate(self.beads):
- r = i/(self.top_beads+self.bot_beads)
- j = i % (self.top_beads+self.bot_beads)
- if bead.get_state() == 1:
- if j < self.top_beads:
- v[r+1] += self.top_factor
- else:
- v[r+1] += 1
if count_beads:
# Save the value associated with each rod as a 2-byte integer.
+ string = ''
+ v = []
+ for r in range(self.num_rods+1): # +1 for overflow
+ v.append(0)
+
+ # Tally the values on each rod.
+ for i, bead in enumerate(self.beads):
+ r = i/(self.top_beads+self.bot_beads)
+ j = i % (self.top_beads+self.bot_beads)
+ if bead.get_state() == 1:
+ if j < self.top_beads:
+ v[r+1] += self.top_factor
+ else:
+ v[r+1] += 1
+
+ # Save the value associated with each rod as a 2-byte integer.
for j in v[1:]:
string += "%2d" % (j)
else:
@@ -781,7 +783,7 @@ class AbacusGeneric():
for bead in self.beads:
sum += bead.get_value()
string = str(sum)
-
+ print self.name, string
return(string)
def label(self, string):