Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2013-03-01 21:43:47 (GMT)
committer Walter Bender <walter.bender@gmail.com>2013-03-01 21:43:47 (GMT)
commit007b1147007a01c242101b467e7bce73b3375bf7 (patch)
tree64ec37b3fba78905b6ff60c5b5f074de509c466b
parentac7a97144d4f700a0ba9e4079eac66d03aab7a46 (diff)
fix display of turtle coordinates to be more compact
-rw-r--r--TurtleArt/tawindow.py19
-rw-r--r--TurtleArtActivity.py4
2 files changed, 13 insertions, 10 deletions
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index e842e41..dd3013f 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -2382,6 +2382,7 @@ before making changes to your Turtle Blocks program'))
if self.active_turtle is None:
self.canvas.set_turtle(self.default_turtle_name)
self._coordinate_counter = 0
+ self.display_coordinates()
return
# If we don't have a group of blocks, then there is nothing to do.
@@ -3860,17 +3861,19 @@ may not terminate.', False)
x = round_int(float(self.canvas.xcor) / self.coord_scale)
y = round_int(float(self.canvas.ycor) / self.coord_scale)
h = round_int(self.canvas.heading)
- if int(x) == x and int(y) == y and int(h) == h:
- formatting = '%s: %d %s: %d %s: %d'
- else:
- formatting = '%s: %0.2f %s: %0.2f %s: %0.2f'
if self.running_sugar:
- self.activity.coordinates_label.set_text(
- formatting % (_('xcor'), x, _('ycor'), y,
- _('heading'), h))
+ if int(x) == x and int(y) == y and int(h) == h:
+ formatting = '(%d, %d) %d'
+ else:
+ formatting = '(%0.2f, %0.2f) %0.2f'
+ self.activity.coordinates_label.set_text(
+ formatting % (x, y, h))
self.activity.coordinates_label.show()
elif self.interactive_mode:
- formatting = '%s — ' + formatting
+ if int(x) == x and int(y) == y and int(h) == h:
+ formatting = '%s — %s: %d %s: %d %s: %d'
+ else:
+ formatting = '%s — %s: %0.2f %s: %0.2f %s: %0.2f'
self.parent.set_title(
formatting % (_('Turtle Art'), _('xcor'), x, _('ycor'), y,
_('heading'), h))
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
index dd67d0d..c459688 100644
--- a/TurtleArtActivity.py
+++ b/TurtleArtActivity.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
#Copyright (c) 2007, Playful Invention Company
#Copyright (c) 2008-13, Walter Bender
#Copyright (c) 2009-10 Raul Gutierrez Segales
@@ -630,8 +631,7 @@ class TurtleArtActivity(activity.Activity):
self._add_button('view-metric', _('Metric coordinates'),
self.do_metric_cb, view_toolbar)
self._add_separator(view_toolbar, visible=False)
- self.coordinates_label = self._add_label(_('xcor') + ' = 0 ' + \
- _('ycor') + ' = 0 ' + _('heading') + ' = 0', view_toolbar)
+ self.coordinates_label = self._add_label('(0, 0) 0', view_toolbar)
self._add_separator(view_toolbar, expand=True, visible=False)
self.rescale_button = self._add_button(
'expand-coordinates', _('Rescale coordinates up'),