diff options
author | Pootle daemon <pootle@pootle.sugarlabs.org> | 2013-03-09 05:31:12 (GMT) |
---|---|---|
committer | Pootle daemon <pootle@pootle.sugarlabs.org> | 2013-03-09 05:31:12 (GMT) |
commit | ba8fb0673d3aabc8a805c0d42b2f99a783be6961 (patch) | |
tree | 72223537caf0eadbfbc4d9773a937158a30c7b98 | |
parent | 66eaf19fb25f8755b5c2deebfff2e17edc98c017 (diff) | |
parent | 08c9ecede77be80144c5116e86c232e7a43df848 (diff) |
Merge branch 'master' of git.sugarlabs.org:turtleart/mainline
-rw-r--r-- | NEWS | 10 | ||||
-rw-r--r-- | TurtleArt/tawindow.py | 62 | ||||
-rw-r--r-- | activity/activity.info | 2 | ||||
-rw-r--r-- | images/palettehshift.svg | 55 | ||||
-rw-r--r-- | images/palettehshift2.svg | 69 | ||||
-rw-r--r-- | images/palettevshift.svg | 55 | ||||
-rw-r--r-- | images/palettevshift2.svg | 69 |
7 files changed, 221 insertions, 101 deletions
@@ -1,3 +1,13 @@ +174 + +ENHANCEMENTS: +* Always open Turtle Palette after loading new project +* Make shift-palette icons directional +* New translations + +BUG FIX: +* Fix typo that prevented palette repositioning to work properly + 173 ENHANCEMENTS: diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 9b70c5c..1564e0f 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -80,6 +80,8 @@ if GST_AVAILABLE: MOTION_THRESHOLD = 6 SNAP_THRESHOLD = 200 NO_DOCK = (100, 100) # Blocks cannot be docked +BUTTON_SIZE = 32 +MARGIN = 5 class TurtleArtWindow(): @@ -716,10 +718,8 @@ class TurtleArtWindow(): def hide_palette(self): ''' Hide the palette. ''' self._hide_toolbar_palette() - self.palette_button[self.orientation].hide() - self.palette_button[2].hide() - self.palette_button[3].hide() - self.palette_button[4].hide() + for button in self.palette_button: + button.hide() if not self.running_sugar or not self.activity.has_toolbarbox: self.toolbar_spr.hide() self.palette = False @@ -793,20 +793,27 @@ class TurtleArtWindow(): w, h = self.palette_sprs[n][self.orientation].get_dimensions() bx, by = self.palettes[n][0].spr.get_xy() if self.orientation == 0: - dx = w - self.width + if bx != BUTTON_SIZE: + dx = w - self.width + else: + dx = self.width - w dy = 0 - if bx - x > 0: - dx *= -1 else: dx = 0 - dy = h - self.height + ICON_SIZE - if by - y > 0: - dy *= -1 + if by != self.toolbar_offset + BUTTON_SIZE + MARGIN: + dy = h - self.height + ICON_SIZE + else: + dy = self.height - h - ICON_SIZE for blk in self.palettes[n]: if blk.get_visibility(): blk.spr.move_relative((dx, dy)) self.palette_button[self.orientation].set_layer(TOP_LAYER) - self.palette_button[self.orientation + 3].set_layer(TOP_LAYER) + if dx < 0 or dy < 0: + self.palette_button[self.orientation + 5].set_layer(TOP_LAYER) + self.palette_button[self.orientation + 3].hide() + else: + self.palette_button[self.orientation + 5].hide() + self.palette_button[self.orientation + 3].set_layer(TOP_LAYER) def show_toolbar_palette(self, n, init_only=False, regenerate=False, show=True): @@ -916,17 +923,14 @@ class TurtleArtWindow(): def _display_palette_shift_button(self, n): ''' Palettes too wide (or tall) for the screen get a shift button ''' + for i in range(4): + self.palette_button[i + 3].hide() if self.palette_sprs[n][self.orientation].type == \ 'category-shift-horizontal': self.palette_button[3].set_layer(CATEGORY_LAYER) - self.palette_button[4].hide() elif self.palette_sprs[n][self.orientation].type == \ 'category-shift-vertical': - self.palette_button[3].hide() self.palette_button[4].set_layer(CATEGORY_LAYER) - else: - self.palette_button[3].hide() - self.palette_button[4].hide() def _create_the_selectors(self): ''' Create the palette selector buttons: only when running @@ -1012,12 +1016,16 @@ class TurtleArtWindow(): self.palette_button.append(Sprite(self.sprite_list, dims[0], self.toolbar_offset, svg_str_to_pixbuf(svg_from_file( "%s/images/palettevshift.svg" % (self.path))))) - self.palette_button[3].name = _('shift') - self.palette_button[4].name = _('shift') - self.palette_button[3].type = 'palette' - self.palette_button[4].type = 'palette' - self.palette_button[3].hide() - self.palette_button[4].hide() + self.palette_button.append(Sprite(self.sprite_list, 0, + self.toolbar_offset + dims[1], svg_str_to_pixbuf(svg_from_file( + "%s/images/palettehshift2.svg" % (self.path))))) + self.palette_button.append(Sprite(self.sprite_list, dims[0], + self.toolbar_offset, svg_str_to_pixbuf(svg_from_file( + "%s/images/palettevshift2.svg" % (self.path))))) + for i in range(4): + self.palette_button[3 + i].name = _('shift') + self.palette_button[3 + i].type = 'palette' + self.palette_button[3 + i].hide() def _create_proto_blocks(self, n): ''' Create the protoblocks that will populate a palette. ''' @@ -1176,8 +1184,6 @@ class TurtleArtWindow(): def _layout_palette(self, n, regenerate=False, show=True): ''' Layout prototypes in a palette. ''' - BUTTON_SIZE = 32 - MARGIN = 5 if n is not None: if self.orientation == HORIZONTAL_PALETTE: x, y = BUTTON_SIZE, self.toolbar_offset + MARGIN @@ -1191,6 +1197,10 @@ class TurtleArtWindow(): if show: self.palette_button[2].move( (w - BUTTON_SIZE, self.toolbar_offset)) + self.palette_button[4].move( + (BUTTON_SIZE, self.toolbar_offset)) + self.palette_button[6].move( + (BUTTON_SIZE, self.toolbar_offset)) else: x, y = MARGIN, self.toolbar_offset + BUTTON_SIZE + MARGIN x, y, max_h = self._vertical_layout(x, y, self.palettes[n]) @@ -1203,6 +1213,10 @@ class TurtleArtWindow(): if show: self.palette_button[2].move((PALETTE_WIDTH - BUTTON_SIZE, self.toolbar_offset)) + self.palette_button[3].move((0, + self.toolbar_offset + BUTTON_SIZE)) + self.palette_button[5].move((0, + self.toolbar_offset + BUTTON_SIZE)) if show: self.palette_button[2].save_xy = \ self.palette_button[2].get_xy() diff --git a/activity/activity.info b/activity/activity.info index 118e2de..7ebcab1 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,6 +1,6 @@ [Activity] name = TurtleBlocks -activity_version = 173 +activity_version = 174 license = MIT bundle_id = org.laptop.TurtleArtActivity exec = sugar-activity TurtleArtActivity.TurtleArtActivity diff --git a/images/palettehshift.svg b/images/palettehshift.svg index dc5f82e..e3d594f 100644 --- a/images/palettehshift.svg +++ b/images/palettehshift.svg @@ -46,45 +46,24 @@ offset="1" /> </linearGradient> </defs> + <path + d="m 1.0632856,15.997629 a 14.936714,14.936714 0 1 0 29.8734274,0 14.936714,14.936714 0 1 0 -29.8734274,0 z" + id="path2819" + style="fill:#ffd000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2.12657046;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 26.666665,15.997628 -21.3333324,0" + id="path3106" + style="fill:none;stroke:#000000;stroke-width:2.66666651px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> <g - transform="matrix(1.9999999,0,0,1.9999999,3.5982256e-7,-0.00237004)" - id="g2995"> + transform="matrix(0,-2.6666665,2.6666665,0,-5.4949494,37.250152)" + id="g3896-4"> <path - d="m 18.983051,7.5932202 a 10.915255,10.169492 0 1 1 -21.8305089,0 10.915255,10.169492 0 1 1 21.8305089,0 z" - transform="matrix(0.68421284,0,0,0.73438846,2.4799099,2.4236267)" - id="path2819" - style="fill:#ffd000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <g - transform="matrix(0,-1.3333333,1.3333333,0,-2.6666664,18.666666)" - id="g3924"> - <path - d="m 8,4 0,8" - id="path3106" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - <g - transform="translate(0.0303029,-0.060606)" - id="g3896"> - <path - d="M 7.939394,4.060606 6,6" - id="path3108" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - <path - d="M 8,4.060606 9.9393942,6" - id="path3108-6" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - </g> - <g - transform="matrix(1,0,0,-1,0.0303029,16.060606)" - id="g3896-4"> - <path - d="M 7.939394,4.060606 6,6" - id="path3108-0" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - <path - d="M 8,4.060606 9.9393942,6" - id="path3108-6-8" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - </g> - </g> + d="M 7.939394,4.060606 6,6" + id="path3108-0" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> + <path + d="M 8,4.060606 9.9393942,6" + id="path3108-6-8" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> </g> </svg> diff --git a/images/palettehshift2.svg b/images/palettehshift2.svg new file mode 100644 index 0000000..26cf91a --- /dev/null +++ b/images/palettehshift2.svg @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="1.0" + width="32" + height="32" + id="svg2"> + <metadata + id="metadata8"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs9"> + <linearGradient + x1="0" + y1="17.200001" + x2="37" + y2="17.200001" + id="linearGradient5678" + xlink:href="#linearGradient1234" + gradientUnits="userSpaceOnUse" /> + <linearGradient + id="linearGradient1234"> + <stop + id="stop3087" + style="stop-color:#ffffff;stop-opacity:1" + offset="0" /> + <stop + id="stop3089" + style="stop-color:#a0ff00;stop-opacity:1" + offset="1" /> + </linearGradient> + </defs> + <path + d="m 1.0632856,15.997629 a 14.936714,14.936714 0 1 0 29.8734274,0 14.936714,14.936714 0 1 0 -29.8734274,0 z" + id="path2819" + style="fill:#ffd000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2.12657046;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 26.666665,15.997628 -21.3333324,0" + id="path3106" + style="fill:none;stroke:#000000;stroke-width:2.66666651px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> + <g + transform="matrix(0,-2.6666665,-2.6666665,0,37.494947,37.250152)" + id="g3896"> + <path + d="M 7.939394,4.060606 6,6" + id="path3108" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> + <path + d="M 8,4.060606 9.9393942,6" + id="path3108-6" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> + </g> +</svg> diff --git a/images/palettevshift.svg b/images/palettevshift.svg index a6ce6f4..31b1384 100644 --- a/images/palettevshift.svg +++ b/images/palettevshift.svg @@ -46,45 +46,24 @@ offset="1" /> </linearGradient> </defs> + <path + d="M 16,30.934343 A 14.936714,14.936714 0 1 1 16,1.0609154 14.936714,14.936714 0 1 1 16,30.934343 z" + id="path2819" + style="fill:#ffd000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2.12657046;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 16.000001,5.3309636 0,21.3333324" + id="path3106" + style="fill:none;stroke:#000000;stroke-width:2.66666651px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> <g - transform="matrix(0,1.9999999,-1.9999999,0,31.999999,-0.00236984)" - id="g2995"> + transform="matrix(2.6666665,0,0,2.6666665,-5.2525234,-5.4973184)" + id="g3896"> <path - d="m 18.983051,7.5932202 a 10.915255,10.169492 0 1 1 -21.8305089,0 10.915255,10.169492 0 1 1 21.8305089,0 z" - transform="matrix(0.68421284,0,0,0.73438846,2.4799099,2.4236267)" - id="path2819" - style="fill:#ffd000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <g - transform="matrix(0,-1.3333333,1.3333333,0,-2.6666664,18.666666)" - id="g3924"> - <path - d="m 8,4 0,8" - id="path3106" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - <g - transform="translate(0.0303029,-0.060606)" - id="g3896"> - <path - d="M 7.939394,4.060606 6,6" - id="path3108" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - <path - d="M 8,4.060606 9.9393942,6" - id="path3108-6" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - </g> - <g - transform="matrix(1,0,0,-1,0.0303029,16.060606)" - id="g3896-4"> - <path - d="M 7.939394,4.060606 6,6" - id="path3108-0" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - <path - d="M 8,4.060606 9.9393942,6" - id="path3108-6-8" - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> - </g> - </g> + d="M 7.939394,4.060606 6,6" + id="path3108" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> + <path + d="M 8,4.060606 9.9393942,6" + id="path3108-6" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> </g> </svg> diff --git a/images/palettevshift2.svg b/images/palettevshift2.svg new file mode 100644 index 0000000..c1935d8 --- /dev/null +++ b/images/palettevshift2.svg @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="1.0" + width="32" + height="32" + id="svg2"> + <metadata + id="metadata8"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs9"> + <linearGradient + x1="0" + y1="17.200001" + x2="37" + y2="17.200001" + id="linearGradient5678" + xlink:href="#linearGradient1234" + gradientUnits="userSpaceOnUse" /> + <linearGradient + id="linearGradient1234"> + <stop + id="stop3087" + style="stop-color:#ffffff;stop-opacity:1" + offset="0" /> + <stop + id="stop3089" + style="stop-color:#a0ff00;stop-opacity:1" + offset="1" /> + </linearGradient> + </defs> + <path + d="M 16,30.934343 A 14.936714,14.936714 0 1 1 16,1.0609154 14.936714,14.936714 0 1 1 16,30.934343 z" + id="path2819" + style="fill:#ffd000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2.12657046;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 16.000001,5.3309636 0,21.3333324" + id="path3106" + style="fill:none;stroke:#000000;stroke-width:2.66666651px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> + <g + transform="matrix(2.6666665,0,0,-2.6666665,-5.2525234,37.492578)" + id="g3896-4"> + <path + d="M 7.939394,4.060606 6,6" + id="path3108-0" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> + <path + d="M 8,4.060606 9.9393942,6" + id="path3108-6-8" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /> + </g> +</svg> |