Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2010-02-11 15:03:47 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2010-02-11 15:03:47 (GMT)
commit8605a116859795bd358aff439c302c376872d7d7 (patch)
tree41ae33d15b10d93f63aab86f40aa09ba32a573a2
parent8797f517158941d17897b25970f7f25f6d72b220 (diff)
eliminated obsolete constants
-rw-r--r--sprites.py6
-rw-r--r--tablock.py8
-rw-r--r--taconstants.py68
-rw-r--r--tawindow.py6
4 files changed, 58 insertions, 30 deletions
diff --git a/sprites.py b/sprites.py
index b847958..7a0dd1c 100644
--- a/sprites.py
+++ b/sprites.py
@@ -346,6 +346,12 @@ class Sprite:
def label_safe_width(self):
return self._width-self._margins[0]-self._margins[2]
+ def label_safe_height(self):
+ return self._height-self._margins[1]-self._margins[3]
+
+ def label_left_top(self):
+ return (self._margins[0], self._margins[1])
+
def get_pixel(self, pos, i=0):
x, y = pos
x = x-self._x
diff --git a/tablock.py b/tablock.py
index 7f77154..b03da6c 100644
--- a/tablock.py
+++ b/tablock.py
@@ -282,6 +282,8 @@ class Block:
self._make_basic_style(svg)
elif self.name in BASIC_STYLE_HEAD:
self._make_basic_style_head(svg)
+ elif self.name in BASIC_STYLE_EXTENDED:
+ self._make_basic_style_extended(svg)
elif self.name in BASIC_STYLE_HEAD_1ARG:
self._make_basic_style_head_1arg(svg)
elif self.name in BASIC_STYLE_TAIL:
@@ -353,6 +355,12 @@ class Block:
self.docks = [['flow',True,self.svg.docks[0][0],self.svg.docks[0][1]],
['flow',False,self.svg.docks[1][0],self.svg.docks[1][1]]]
+ def _make_basic_style_extended(self, svg):
+ self.svg.expand(self.dx+15+self.ex, 15+self.ey)
+ self._make_basic_block(svg)
+ self.docks = [['flow',True,self.svg.docks[0][0],self.svg.docks[0][1]],
+ ['flow',False,self.svg.docks[1][0],self.svg.docks[1][1]]]
+
def _make_basic_style_head(self, svg):
self.svg.expand(10+self.dx+self.ex, self.ey)
self.svg.set_slot(False)
diff --git a/taconstants.py b/taconstants.py
index 3c23f89..89294ce 100644
--- a/taconstants.py
+++ b/taconstants.py
@@ -126,8 +126,8 @@ PALETTES = [['forward', 'back', 'clean', 'left', 'right', 'show',
['kbinput', 'push', 'printheap', 'keyboard', 'pop', 'clearheap',
'myfunc', 'nop', 'sandwichtop', 'sandwichbottom',
'addturtle', 'print', 'comment', 'width', 'height'],
- ['journal', 'audio', 'description', 'savepix',
- 'hideblocks', 'showblocks', 'fullscreen', 'picturelist',
+ ['journal', 'audio', 'description', 'savepix', 'hideblocks',
+ 'showblocks', 'fullscreen', 'picturelist', 'picture1x1a',
'picture1x1', 'picture2x2', 'picture2x1', 'picture1x2'],
['empty', 'restoreall']]
@@ -151,19 +151,8 @@ ICON_SIZE = 55
SELECTED_COLOR = "#0000FF"
SELECTED_STROKE_WIDTH = 1.5
STANDARD_STROKE_WIDTH = 1.0
-THUMB_W = 80
-THUMB_H = 60
-PYTHON_X = 17
-PYTHON_Y = 8
-MEDIA_X = 37
-MEDIA_Y = 6
-TEMPLATE_X = 24
-TEMPLATE_Y = 18
-PIXBUF_X = 17
-PIXBUF_Y = 2
BLOCK_SCALE = 2.0
-PALETTE_DEFAULT_SCALE = 1.5
-PALETTE_SCALE = {'template2x2':1.0, 'template1x2':1.0}
+PALETTE_SCALE = 1.5
#
# Block-style definitions
@@ -173,8 +162,9 @@ BASIC_STYLE_HEAD_1ARG = ['hat']
BASIC_STYLE_TAIL = ['stopstack', 'empty']
BASIC_STYLE = ['clean', 'penup', 'pendown', 'stack1', 'stack2', 'vspace',
'hideblocks', 'showblocks', 'clearheap', 'printheap', 'kbinput',
- 'picturelist', 'picture1x1', 'picture2x2', 'picture2x1', 'picture1x2',
'fullscreen', 'sandwichcollapsed']
+BASIC_STYLE_EXTENDED = ['picturelist', 'picture1x1', 'picture2x2',
+ 'picture2x1', 'picture1x2', 'picture1x1a']
BASIC_STYLE_1ARG = ['forward', 'back', 'left', 'right', 'seth', 'show',
'setscale', 'setpensize', 'setcolor', 'setshade', 'print', 'showaligned',
'settextsize', 'settextcolor', 'print', 'wait', 'storeinbox1', 'savepix',
@@ -240,7 +230,7 @@ MACROS = {
[11, ['string','∙ '], 0, 0, [10, None]],
[12, ['string','∙ '], 0, 0, [10, None]],
[13, 'sandwichbottom', 0, 0, [10, None]]],
- 'picture1x1':
+ 'picture1x1a':
[[0, 'sandwichtop', 0, 0, [None, 1, 2]],
[1, ['string', _('picture')], 0, 0, [0, None]],
[2, 'setxy', 0, 0, [0, 3, 4, 5]],
@@ -265,7 +255,7 @@ MACROS = {
[5, 'show', 0, 0, [2, 6, 7]],
[6, ['string',_('Title')], 0, 0, [5, None]],
[7, 'setscale', 0, 0, [5, 8, 9]],
- [8, ['number', '90'], 0, 0, [7, None]],
+ [8, ['number', '45'], 0, 0, [7, None]],
[9, 'setxy', 0, 0, [7, 10, 11, 12]],
[10, 'leftx', 0, 0, [9, None]],
[11, 'topy', 0, 0, [9, None]],
@@ -296,7 +286,7 @@ MACROS = {
[5, 'show', 0, 0, [2, 6, 7]],
[6, ['string',_('Title')], 0, 0, [5, None]],
[7, 'setscale', 0, 0, [5, 8, 9]],
- [8, ['number', '90'], 0, 0, [7, None]],
+ [8, ['number', '45'], 0, 0, [7, None]],
[9, 'setxy', 0, 0, [7, 10, 11, 12]],
[10, 'leftx', 0, 0, [9, None]],
[11, 'topy', 0, 0, [9, None]],
@@ -327,7 +317,7 @@ MACROS = {
[5, 'show', 0, 0, [2, 6, 7]],
[6, ['string',_('Title')], 0, 0, [5, None]],
[7, 'setscale', 0, 0, [5, 8, 9]],
- [8, ['number', '90'], 0, 0, [7, None]],
+ [8, ['number', '45'], 0, 0, [7, None]],
[9, 'setxy', 0, 0, [7, 10, 11, 12]],
[10, 'leftx', 0, 0, [9, None]],
[11, 'topy', 0, 0, [9, None]],
@@ -348,7 +338,28 @@ MACROS = {
[26, 'bottomy', 0, 0, [24, None]],
[27, 'showaligned', 0, 0, [24, 28, 29]],
[28, 'description', 0, 0, [27, None]],
- [29, 'sandwichbottom', 0, 0, [27, None]]]
+ [29, 'sandwichbottom', 0, 0, [27, None]]],
+ 'picture1x1':
+ [[0, 'sandwichtop', 0, 0, [None, 1, 2]],
+ [1, ['string', _('1×1 picture')], 0, 0, [0, None]],
+ [2, 'setxy', 0, 0, [0, 3, 4, 5]],
+ [3, 'titlex', 0, 0, [2, None]],
+ [4, 'titley', 0, 0, [2, None]],
+ [5, 'show', 0, 0, [2, 6, 7]],
+ [6, ['string',_('Title')], 0, 0, [5, None]],
+ [7, 'setscale', 0, 0, [5, 8, 9]],
+ [8, ['number', '45'], 0, 0, [7, None]],
+ [9, 'setxy', 0, 0, [7, 10, 11, 12]],
+ [10, 'leftx', 0, 0, [9, None]],
+ [11, 'topy', 0, 0, [9, None]],
+ [12, 'showaligned', 0, 0, [9, 13, 14]],
+ [13, 'journal', 0, 0, [12, None]],
+ [14, 'setxy', 0, 0, [12, 15, 16, 17]],
+ [15, 'rightx', 0, 0, [14, None]],
+ [16, 'topy', 0, 0, [14, None]],
+ [17, 'showaligned', 0, 0, [14, 18, 19]],
+ [18, 'description', 0, 0, [17, None]],
+ [19, 'sandwichbottom', 0, 0, [17, None]]]
}
#
@@ -428,11 +439,12 @@ BLOCK_NAMES = {
'pendown':[_('pen down')],
'pensize':[_('pen size')],
'penup':[_('pen up')],
- 'picturelist':[_('bulleted list')],
- 'picture1x1':[_('1×1 picture')],
- 'picture2x2':[_('2×2 pictures')],
- 'picture2x1':[_('2×1 pictures')],
- 'picture1x2':[_('1×2 pictures')],
+ 'picturelist':[' '],
+ 'picture1x1':[' '],
+ 'picture1x1a':[' '],
+ 'picture2x2':[' '],
+ 'picture2x1':[' '],
+ 'picture1x2':[' '],
'plus2':['+'],
'pop':[_('pop')],
'printheap':[_('show heap')],
@@ -803,6 +815,12 @@ HELP_STRINGS = {
'pen':_("palette of pen commands"),
'pensize':_("holds current pen size (can be used in place of a number block)"),
'penup':_("Turtle will not draw when moved."),
+ 'picture1x1':_("presentation template: select Journal object (with description)"),
+ 'picture1x1a':_("presentation template: select Journal object (no description)"),
+ 'picture1x2':_("presentation template: select two Journal objects"),
+ 'picture2x1':_("presentation template: select two Journal objects"),
+ 'picture2x2':_("presentation template: select four Journal objects"),
+ 'picturelist':_("presentation template: list of bullets"),
'plus2':_("adds two alphanumeric inputs"),
'pop':_("pops value off FILO (first-in last-out heap)"),
'portfolio':_("palette of presentation templates"),
diff --git a/tawindow.py b/tawindow.py
index 82aaf44..d59c572 100644
--- a/tawindow.py
+++ b/tawindow.py
@@ -445,13 +445,9 @@ class TurtleArtWindow():
if self.palettes[n] == []:
for i, name in enumerate(PALETTES[n]):
# Some blocks are too big to fit the palette.
- if PALETTE_SCALE.has_key(name):
- scale = PALETTE_SCALE[name]
- else:
- scale = PALETTE_DEFAULT_SCALE
self.palettes[n].append(Block(self.block_list,
self.sprite_list, name,
- 0, 0, 'proto', [], scale))
+ 0, 0, 'proto', [], PALETTE_SCALE))
self.palettes[n][i].spr.set_layer(TAB_LAYER)
self.palettes[n][i].spr.set_shape(self.palettes[n][i].shapes[0])
# Some blocks get a skin.