diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-09-14 17:05:51 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-09-14 17:05:51 (GMT) |
commit | 833f0758a425af373370cdd2634a29c6a4370b26 (patch) | |
tree | 36c9787c770e5b9dad48698daa945e58b41d0eb7 | |
parent | 5651670a8ae3f0f67958e254b46391b779a630a9 (diff) |
handle blocks with 4 labels
-rw-r--r-- | TurtleArt/tablock.py | 28 | ||||
-rw-r--r-- | plugins/turtle_blocks_extras/turtle_blocks_extras.py | 3 |
2 files changed, 19 insertions, 12 deletions
diff --git a/TurtleArt/tablock.py b/TurtleArt/tablock.py index 2ead410..bb78b9d 100644 --- a/TurtleArt/tablock.py +++ b/TurtleArt/tablock.py @@ -531,23 +531,29 @@ class Block: debug_output('WARNING: unknown block name %s' % (self.name)) n = 0 for i in range(n): + if i > 0: + size = int(self._font_size[1] + 0.5) + else: + size = int(self._font_size[0] + 0.5) if self.name in block_styles['compare-porch-style']: - self.spr.set_label_attributes(int(self._font_size[0] + 0.5), - True, 'center', 'bottom', i=i) + self.spr.set_label_attributes(size, True, 'center', 'bottom', + i=i) elif self.name in block_styles['number-style-porch']: - self.spr.set_label_attributes(int(self._font_size[0] + 0.5), - True, 'right', 'bottom', i=i) + self.spr.set_label_attributes(size, True, 'right', 'bottom', + i=i) elif self.name in EXPANDABLE_FLOW: self._calc_moving_labels(i) elif i == 1: # top - self.spr.set_label_attributes(int(self._font_size[1] + 0.5), - True, 'right', 'top', i=i) - elif i == 2: # bottom - self.spr.set_label_attributes(int(self._font_size[1] + 0.5), - True, 'right', 'bottom', i=i) + self.spr.set_label_attributes(size, True, 'right', 'top', i=i) + elif i > 0 and i == n - 1: # bottom + self.spr.set_label_attributes(size, True, 'right', 'bottom', + i=i) + elif i > 0: + self.spr.set_label_attributes(size, True, 'right', 'middle', + i=i) else: - self.spr.set_label_attributes(int(self._font_size[0] + 0.5), - True, 'center', 'middle', i=i) + self.spr.set_label_attributes(size, True, 'center', 'middle', + i=i) def _calc_moving_labels(self, i): ''' Some labels move as blocks change shape/size ''' diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index ff9eebe..606a632 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -313,7 +313,8 @@ complete')) palette.add_block('sinewave', style='basic-style-3arg', # TRANS: pitch, duration, amplitude - label=[_('sinewave'), _('pitch'), _('duration'), ''], + label=[_('sinewave') + '\n\n', _('pitch'), + _('amplitude'), _('duration')], prim_name='sinewave', default=[1000, 5000, 1], help_string=_('plays a sinewave at frequency, \ |