From 8ba5716c20e99d3ff2e92099eb2d7e8642d28de2 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Wed, 13 Apr 2011 15:37:51 +0000 Subject: revert tagettext magic until it is fixed --- diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index ecca12d..8a43dbd 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -62,6 +62,8 @@ from time import time from math import sqrt 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 diff --git a/TurtleArt/tablock.py b/TurtleArt/tablock.py index 25e2ff8..bcca2cd 100644 --- a/TurtleArt/tablock.py +++ b/TurtleArt/tablock.py @@ -20,6 +20,7 @@ #THE SOFTWARE. import gtk +from gettext import gettext as _ from taconstants import EXPANDABLE, EXPANDABLE_ARGS, OLD_NAMES, CONSTANTS, \ STANDARD_STROKE_WIDTH, BLOCK_SCALE, BOX_COLORS, GRADIENT_COLOR diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index ad456bc..e437808 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -25,6 +25,7 @@ from math import sin, cos, pi import pango import cairo import base64 +from gettext import gettext as _ from sprites import Sprite from tasprite_factory import SVG diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py index c3a5d14..54c2d27 100644 --- a/TurtleArt/taconstants.py +++ b/TurtleArt/taconstants.py @@ -19,6 +19,8 @@ #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN #THE SOFTWARE. +from gettext import gettext as _ + # # Sprite layers # diff --git a/TurtleArt/taexporthtml.py b/TurtleArt/taexporthtml.py index 314e604..843b8b0 100644 --- a/TurtleArt/taexporthtml.py +++ b/TurtleArt/taexporthtml.py @@ -22,9 +22,10 @@ import pygtk pygtk.require('2.0') import gtk import os.path -from tautils import data_to_string, save_picture, image_to_base64, get_path -from gettext import gettext as _ from cgi import escape +from gettext import gettext as _ + +from tautils import data_to_string, save_picture, image_to_base64, get_path # A dictionary to define the HTML wrappers around template elements HTML_GLUE = { diff --git a/TurtleArt/taexportlogo.py b/TurtleArt/taexportlogo.py index 2e41b05..127689b 100644 --- a/TurtleArt/taexportlogo.py +++ b/TurtleArt/taexportlogo.py @@ -18,10 +18,13 @@ #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN #THE SOFTWARE. +from gettext import gettext as _ + try: from sugar.datastore import datastore + HAS_DATASTORE = True except: - pass + HAS_DATASTORE = False from TurtleArt.tapalette import logo_commands, logo_functions from TurtleArt.taconstants import TITLEXY, CONSTANTS @@ -129,12 +132,11 @@ def save_logo(tw): def _add_label(string): if type(string) == str and string[0:8] in ['#smedia_', '#saudio_', '#svideo_', '#sdescr_']: - try: + string = string[8:] + if HAS_DATASTORE: dsobject = datastore.get(string[8:]) - string = dsobject.metadata['title'] - except: - print 'failed to get title for %s' % (string) - string = string[8:] + if 'title' in dsobject.metadata: + string = dsobject.metadata['title'] else: string = str(string) if string[0:2] == '#s': diff --git a/TurtleArt/taturtle.py b/TurtleArt/taturtle.py index 75bff6a..0ca72e4 100644 --- a/TurtleArt/taturtle.py +++ b/TurtleArt/taturtle.py @@ -19,15 +19,16 @@ #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN #THE SOFTWARE. +from random import uniform +from math import sin, cos, pi +from gettext import gettext as _ + 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 -from random import uniform -from math import sin, cos, pi - SHAPES = 36 diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py index ab4336f..c027537 100644 --- a/TurtleArt/tautils.py +++ b/TurtleArt/tautils.py @@ -23,6 +23,8 @@ import gtk import pickle import subprocess import dbus +import os.path +from gettext import gettext as _ try: OLD_SUGAR_SYSTEM = False @@ -37,11 +39,11 @@ except (ImportError, AttributeError): from simplejson import dump as jdump except: OLD_SUGAR_SYSTEM = True +from StringIO import StringIO from taconstants import HIDE_LAYER, COLLAPSIBLE, BLOCK_LAYER, HIT_HIDE, \ HIT_SHOW, XO1, XO15, UNKNOWN -from StringIO import StringIO -import os.path + import logging _logger = logging.getLogger('turtleart-activity') diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 08b5365..3b69175 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -26,6 +26,7 @@ import pygtk pygtk.require('2.0') import gtk import gobject +from gettext import gettext as _ try: import gst @@ -87,6 +88,7 @@ class TurtleArtWindow(): _PLUGIN_SUBPATH = 'plugins' def __init__(self, win, path, parent=None, mycolors=None, mynick=None): + print '3. canvas, window', win, win.window self._loaded_project = '' self._sharing = False self.parent = parent @@ -95,16 +97,27 @@ class TurtleArtWindow(): if type(win) == gtk.DrawingArea: self.interactive_mode = True self.window = win + print '3a. canvas, window', self.window, self.window.window self.window.set_flags(gtk.CAN_FOCUS) + self.window.show_all() + print '3b. canvas, window', self.window, self.window.window if self.parent is not None: self.parent.show_all() + print '3c. canvas, window', self.window, self.window.window self.running_sugar = True else: - self.window.show_all() + print '3d. canvas, window', self.window, self.window.window self.running_sugar = False + print '4. canvas, window', self.window, self.window.window self.area = self.window.window + print '5. window', self.area if self.area is not None: self.gc = self.area.new_gc() + else: + # Why would the drawable area be none??? + # We lose... + print 'drawable area is None... punting' + exit() self._setup_events() elif type(win) == gtk.gdk.Pixmap: self.interactive_mode = False @@ -520,7 +533,7 @@ class TurtleArtWindow(): self.show_palette() if self.activity is not None and self.activity.has_toolbarbox: self.activity.palette_buttons[0].set_icon( - palette_names[0] + 'on') + palette_names[0] + 'on') self.hide = False if self.running_sugar: self.activity.recenter() diff --git a/plugins/audio_sensors/audio_sensors.py b/plugins/audio_sensors/audio_sensors.py index 3504461..22298a0 100644 --- a/plugins/audio_sensors/audio_sensors.py +++ b/plugins/audio_sensors/audio_sensors.py @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +from gettext import gettext as _ + try: from numpy import append from numpy.fft import rfft diff --git a/plugins/camera_sensor/camera_sensor.py b/plugins/camera_sensor/camera_sensor.py index b76275b..d26e666 100644 --- a/plugins/camera_sensor/camera_sensor.py +++ b/plugins/camera_sensor/camera_sensor.py @@ -19,6 +19,7 @@ import gst import gtk from fcntl import ioctl import os +from gettext import gettext as _ from plugins.camera_sensor.tacamera import Camera from plugins.camera_sensor.v4l2 import v4l2_control, V4L2_CID_AUTOGAIN, \ diff --git a/plugins/rfid/rfid.py b/plugins/rfid/rfid.py index a7fd47c..e607eba 100644 --- a/plugins/rfid/rfid.py +++ b/plugins/rfid/rfid.py @@ -18,9 +18,9 @@ import dbus from dbus.mainloop.glib import DBusGMainLoop +from gettext import gettext as _ from plugins.rfid.rfidutils import strhex2bin, strbin2dec, find_device - from plugins.plugin import Plugin from TurtleArt.tapalette import make_palette diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index 6aec358..5d4c1d0 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -18,6 +18,7 @@ import gtk from time import time import os.path +from gettext import gettext as _ try: from sugar.datastore import datastore -- cgit v0.9.1