From b285375dd227959df9e237965d9ac6b77618f88d Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sun, 10 Feb 2013 20:57:57 +0000 Subject: more code cleanup --- diff --git a/NEWS b/NEWS index dc8022b..9a1c358 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +172 + +ENHANCEMENTS: +* Prevent rearrangement of blocks while program is running +* New translations + 171 ENHANCEMENTS: diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index 2ef21c2..ffa07a2 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -64,10 +64,10 @@ from random import uniform from gettext import gettext as _ -from tapalette import make_palette, define_logo_function -from talogo import primitive_dictionary, logoerror -from tautils import convert, chr_to_ord, round_int, strtype -from taconstants import COLORDICT, CONSTANTS, XO30 +from tapalette import (make_palette, define_logo_function) +from talogo import (primitive_dictionary, logoerror) +from tautils import (convert, chr_to_ord, round_int, strtype) +from taconstants import (COLORDICT, CONSTANTS) def _color_to_num(c): @@ -436,14 +436,9 @@ pensize\rend\r') def _color_palette(self): """ The basic Turtle Art color palette """ - if self.tw.hw == XO30: - palette = make_palette('pen', - colors=["#00FFFF", "#00A0A0"], - help_string=_('Palette of pen colors')) - else: - palette = make_palette('colors', - colors=["#00FFFF", "#00A0A0"], - help_string=_('Palette of pen colors')) + palette = make_palette('colors', + colors=["#00FFFF", "#00A0A0"], + help_string=_('Palette of pen colors')) self._make_constant(palette, 'red', _('red'), CONSTANTS['red']) self._make_constant(palette, 'orange', _('orange'), diff --git a/TurtleArt/tablock.py b/TurtleArt/tablock.py index f42a9b9..3f64066 100644 --- a/TurtleArt/tablock.py +++ b/TurtleArt/tablock.py @@ -22,16 +22,16 @@ import gtk import cairo -from taconstants import EXPANDABLE, EXPANDABLE_ARGS, OLD_NAMES, CONSTANTS, \ - STANDARD_STROKE_WIDTH, BLOCK_SCALE, BOX_COLORS, GRADIENT_COLOR, \ - EXPANDABLE_FLOW, COLORDICT -from tapalette import palette_blocks, block_colors, expandable_blocks, \ - content_blocks, block_names, block_primitives, block_styles, \ - special_block_colors -from tasprite_factory import SVG, svg_str_to_pixbuf +from taconstants import (EXPANDABLE, EXPANDABLE_ARGS, OLD_NAMES, CONSTANTS, + STANDARD_STROKE_WIDTH, BLOCK_SCALE, BOX_COLORS, + GRADIENT_COLOR, EXPANDABLE_FLOW, COLORDICT) +from tapalette import (palette_blocks, block_colors, expandable_blocks, + content_blocks, block_names, block_primitives, + block_styles, special_block_colors) +from tasprite_factory import (SVG, svg_str_to_pixbuf) import sprites -from tautils import debug_output, error_output +from tautils import (debug_output, error_output) class Blocks: diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index a040e4c..1d07784 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -28,8 +28,8 @@ import pango import cairo import pangocairo -from tautils import image_to_base64, get_path, data_to_string, round_int, \ - debug_output +from tautils import (image_to_base64, get_path, data_to_string, round_int, + debug_output) from taconstants import COLORDICT diff --git a/TurtleArt/taexportlogo.py b/TurtleArt/taexportlogo.py index 7fea030..7d7d1cb 100644 --- a/TurtleArt/taexportlogo.py +++ b/TurtleArt/taexportlogo.py @@ -1,4 +1,4 @@ -#Copyright (c) 2008-11, Walter Bender +#Copyright (c) 2008-13, Walter Bender #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal @@ -24,8 +24,9 @@ try: except: HAS_DATASTORE = False -from TurtleArt.tapalette import logo_commands, logo_functions -from TurtleArt.taconstants import TITLEXY, CONSTANTS +from TurtleArt.tapalette import (logo_commands, logo_functions) +from TurtleArt.taconstants import (TITLEXY, CONSTANTS) + def save_logo(tw): """ Set up the Turtle Art color palette and color processing. """ diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index 316b314..158857a 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- #Copyright (c) 2007-8, Playful Invention Company. -#Copyright (c) 2008-12, Walter Bender +#Copyright (c) 2008-13, Walter Bender #Copyright (c) 2008-10, Raúl Gutiérrez Segalés #Permission is hereby granted, free of charge, to any person obtaining a copy @@ -33,10 +33,10 @@ try: except ImportError: GRID_CELL_SIZE = 55 -from taconstants import TAB_LAYER, DEFAULT_SCALE, PREFIX_DICTIONARY -from tapalette import block_names, value_blocks -from tautils import get_pixbuf_from_journal, convert, data_from_file, \ - text_media_type, round_int, debug_output, find_group +from taconstants import (TAB_LAYER, DEFAULT_SCALE, PREFIX_DICTIONARY) +from tapalette import (block_names, value_blocks) +from tautils import (get_pixbuf_from_journal, convert, data_from_file, + text_media_type, round_int, debug_output, find_group) try: from util.RtfParser import RtfTextOnly diff --git a/TurtleArt/tapalette.py b/TurtleArt/tapalette.py index cac6cfa..2d903e5 100644 --- a/TurtleArt/tapalette.py +++ b/TurtleArt/tapalette.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -#Copyright (c) 2011,12 Walter Bender +#Copyright (c) 2011-13 Walter Bender #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal @@ -81,14 +81,14 @@ import gtk try: from sugar.graphics import style - from util.helpbutton import add_section, add_paragraph + from util.helpbutton import (add_section, add_paragraph) GRID_CELL_SIZE = style.GRID_CELL_SIZE HELP_PALETTE = True except ImportError: GRID_CELL_SIZE = 55 HELP_PALETTE = False -from taconstants import EXPANDABLE_STYLE, EXPANDABLE_FLOW +from taconstants import (EXPANDABLE_STYLE, EXPANDABLE_FLOW) from tautils import debug_output from gettext import gettext as _ diff --git a/TurtleArt/taturtle.py b/TurtleArt/taturtle.py index 91118de..7acb90e 100644 --- a/TurtleArt/taturtle.py +++ b/TurtleArt/taturtle.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -#Copyright (c) 2010,12 Walter Bender +#Copyright (c) 2010-13 Walter Bender #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal @@ -24,9 +24,9 @@ from math import sin, cos, pi, sqrt import gtk import cairo -from taconstants import TURTLE_LAYER, DEFAULT_TURTLE_COLORS -from tasprite_factory import SVG, svg_str_to_pixbuf -from tacanvas import wrap100, COLOR_TABLE +from taconstants import (TURTLE_LAYER, DEFAULT_TURTLE_COLORS) +from tasprite_factory import (SVG, svg_str_to_pixbuf) +from tacanvas import (wrap100, COLOR_TABLE) from sprites import Sprite from tautils import debug_output diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py index a8e372c..9affe1c 100644 --- a/TurtleArt/tautils.py +++ b/TurtleArt/tautils.py @@ -42,8 +42,8 @@ except (ImportError, AttributeError): OLD_SUGAR_SYSTEM = True from StringIO import StringIO -from taconstants import (HIT_HIDE, HIT_SHOW, XO1, XO15, XO175, XO4, - UNKNOWN, MAGICNUMBER, SUFFIX) +from taconstants import (HIT_HIDE, HIT_SHOW, XO1, XO15, XO175, XO4, UNKNOWN, + MAGICNUMBER, SUFFIX) import logging _logger = logging.getLogger('turtleart-activity') diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 65c65b5..f6df191 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -58,10 +58,10 @@ from tapalette import (palette_names, palette_blocks, expandable_blocks, block_names, content_blocks, default_values, special_names, block_styles, help_strings, hidden_proto_blocks, string_or_number_args, make_palette, palette_name_to_index, palette_init_on_start) -from talogo import LogoCode, primitive_dictionary, logoerror +from talogo import (LogoCode, primitive_dictionary, logoerror) from tacanvas import TurtleGraphics -from tablock import Blocks, Block -from taturtle import Turtles, Turtle +from tablock import (Blocks, Block) +from taturtle import (Turtles, Turtle) from tautils import (magnitude, get_load_name, get_save_name, data_from_file, data_to_file, round_int, get_id, get_pixbuf_from_journal, movie_media_type, audio_media_type, image_media_type, save_picture, @@ -71,8 +71,8 @@ from tautils import (magnitude, get_load_name, get_save_name, data_from_file, get_hardware, debug_output, error_output, convert, find_bot_block, restore_clamp, collapse_clamp, data_from_string, increment_name, get_screen_dpi) -from tasprite_factory import SVG, svg_str_to_pixbuf, svg_from_file -from sprites import Sprites, Sprite +from tasprite_factory import (SVG, svg_str_to_pixbuf, svg_from_file) +from sprites import (Sprites, Sprite) if GST_AVAILABLE: from tagplay import stop_media diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py index b5b357b..1de91d7 100644 --- a/TurtleArtActivity.py +++ b/TurtleArtActivity.py @@ -1,5 +1,5 @@ #Copyright (c) 2007, Playful Invention Company -#Copyright (c) 2008-12, Walter Bender +#Copyright (c) 2008-13, Walter Bender #Copyright (c) 2009-10 Raul Gutierrez Segales #Copyright (c) 2012 Alan Aguiar @@ -33,14 +33,14 @@ _logger = logging.getLogger('turtleart-activity') from sugar.activity import activity try: # 0.86 toolbar widgets - from sugar.activity.widgets import ActivityToolbarButton, StopButton - from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton + from sugar.activity.widgets import (ActivityToolbarButton, StopButton) + from sugar.graphics.toolbarbox import (ToolbarBox, ToolbarButton) HAS_TOOLBARBOX = True except ImportError: HAS_TOOLBARBOX = False from sugar.graphics.toolbutton import ToolButton from sugar.graphics.radiotoolbutton import RadioToolButton -from sugar.graphics.alert import ConfirmationAlert, NotifyAlert +from sugar.graphics.alert import (ConfirmationAlert, NotifyAlert) from sugar.graphics import style from sugar.datastore import datastore from sugar import profile @@ -54,18 +54,18 @@ import tempfile from gettext import gettext as _ -from TurtleArt.tapalette import palette_names, help_strings, help_palettes, \ - help_windows -from TurtleArt.taconstants import BLOCK_SCALE, XO1, XO15, XO175, \ - XO30, XO4, MIMETYPE +from TurtleArt.tapalette import (palette_names, help_strings, help_palettes, + help_windows) +from TurtleArt.taconstants import (BLOCK_SCALE, XO1, XO15, XO175, XO30, XO4, + MIMETYPE) from TurtleArt.taexportlogo import save_logo -from TurtleArt.tautils import data_to_file, data_to_string, data_from_string, \ - get_path, chooser, get_hardware +from TurtleArt.tautils import (data_to_file, data_to_string, data_from_string, + get_path, chooser, get_hardware) from TurtleArt.tawindow import TurtleArtWindow from TurtleArt.tacollaboration import Collaboration if HAS_TOOLBARBOX: - from util.helpbutton import HelpButton, add_section, add_paragraph + from util.helpbutton import (HelpButton, add_section, add_paragraph) class TurtleArtActivity(activity.Activity): @@ -619,9 +619,7 @@ class TurtleArtActivity(activity.Activity): self._toolbox.toolbar.insert(self._help_button, -1) self._help_button.show() - if not self.tw.hw in [XO30]: - self._add_separator(self._toolbox.toolbar, expand=True, - visible=False) + self._add_separator(self._toolbox.toolbar, expand=True, visible=False) stop_button = StopButton(self) stop_button.props.accelerator = 'Q' @@ -756,7 +754,7 @@ class TurtleArtActivity(activity.Activity): self.share_button = self._add_button('shareoff', _('Sharing blocks disabled'), self._share_cb, toolbar) - if self.has_toolbarbox and gtk.gdk.screen_width() < 1024: + if self.has_toolbarbox: self._add_separator(toolbar, expand=False, visible=True) save_load_button = self._add_button( 'save-load', _('Save/Load'), self._save_load_palette_cb, diff --git a/activity/activity.info b/activity/activity.info index 8a5190d..10d8de0 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,6 +1,6 @@ [Activity] name = TurtleBlocks -activity_version = 171 +activity_version = 172 license = MIT bundle_id = org.laptop.TurtleArtActivity exec = sugar-activity TurtleArtActivity.TurtleArtActivity diff --git a/turtleblocks.py b/turtleblocks.py index 19da326..4fe4800 100755 --- a/turtleblocks.py +++ b/turtleblocks.py @@ -1,6 +1,6 @@ #!/usr/bin/env python #Copyright (c) 2007-8, Playful Invention Company -#Copyright (c) 2008-12, Walter Bender +#Copyright (c) 2008-13, Walter Bender #Copyright (c) 2011 Collabora Ltd. #Permission is hereby granted, free of charge, to any person obtaining a copy @@ -47,9 +47,9 @@ sys.argv[1:] = [] # Execution of import gst cannot see '--help' or '-h' import gettext -from TurtleArt.taconstants import OVERLAY_LAYER, DEFAULT_TURTLE_COLORS, \ - TAB_LAYER, SUFFIX -from TurtleArt.tautils import data_to_string, data_from_string, get_save_name +from TurtleArt.taconstants import (OVERLAY_LAYER, DEFAULT_TURTLE_COLORS, + TAB_LAYER, SUFFIX) +from TurtleArt.tautils import (data_to_string, data_from_string, get_save_name) from TurtleArt.tawindow import TurtleArtWindow from TurtleArt.taexportlogo import save_logo -- cgit v0.9.1