From 833f0758a425af373370cdd2634a29c6a4370b26 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Fri, 14 Sep 2012 17:05:51 +0000 Subject: handle blocks with 4 labels --- 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, \ -- cgit v0.9.1