diff options
author | Pootle daemon <pootle@pootle.sugarlabs.org> | 2013-11-12 05:31:48 (GMT) |
---|---|---|
committer | Pootle daemon <pootle@pootle.sugarlabs.org> | 2013-11-12 05:31:48 (GMT) |
commit | 2351608ff04addb03b8f22baa25fe12cab7be96e (patch) | |
tree | 83c620708b79e9008c22f89297bee63c1b1375fd | |
parent | 7b10b45f38a2891539cbc33d18f959fd54d04b58 (diff) | |
parent | c5869c2857450fa2288530467c8e58bfa528f879 (diff) |
Merge branch 'master' of git.sugarlabs.org:turtleart/mainline
-rw-r--r-- | TurtleArt/tabasics.py | 4 | ||||
-rw-r--r-- | TurtleArt/taexportpython.py | 19 | ||||
-rw-r--r-- | TurtleArt/tawindow.py | 6 | ||||
-rw-r--r-- | plugins/accelerometer/accelerometer.py | 1 | ||||
-rw-r--r-- | plugins/audio_sensors/audio_sensors.py | 10 | ||||
-rw-r--r-- | plugins/camera_sensor/camera_sensor.py | 2 | ||||
-rw-r--r-- | plugins/light_sensor/light_sensor.py | 1 | ||||
-rw-r--r-- | plugins/rfid/rfid.py | 1 | ||||
-rw-r--r-- | plugins/turtle_blocks_extras/turtle_blocks_extras.py | 2 | ||||
-rw-r--r-- | pyexported/window_setup.py | 12 |
10 files changed, 38 insertions, 20 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index a57216b..3d88ce4 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -544,6 +544,10 @@ pensize\nend\n') color_names = ('red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'white', 'black') + # Need to make sure color names are included in the PO files + color_names_i18n = (_('red'), _('orange'), _('yellow'), _('green'), + _('cyan'), _('blue'), _('purple'), _('white'), + _('black')) for name in color_names: self._make_constant(palette, name, _(name), name) diff --git a/TurtleArt/taexportpython.py b/TurtleArt/taexportpython.py index 1ed1ac5..819682e 100644 --- a/TurtleArt/taexportpython.py +++ b/TurtleArt/taexportpython.py @@ -39,6 +39,25 @@ from tawindow import plugins_in_use _SETUP_CODE_START = """\ #!/usr/bin/env python +_INSTALL_PATH = '/usr/share/sugar/activities/TurtleArt.activity' +_ALTERNATIVE_INSTALL_PATH = \ + '/usr/local/share/sugar/activities/TurtleArt.activity' + +import os, sys +if os.path.exists('../TurtleBlocks.activity'): + sys.path.append('../TurtleBlocks.activity') +elif os.path.exists(os.path.join(os.path.expanduser('~'), 'Activities', + 'TurtleBlocks.activity')): + sys.path.append(os.path.join(os.path.expanduser('~'), 'Activities', + 'TurtleBlocks.activity')) +elif os.path.exists(_INSTALL_PATH): + sys.path.append(_INSTALL_PATH) +elif os.path.exists(_ALTERNATIVE_INSTALL_PATH): + sys.path.append(_ALTERNATIVE_INSTALL_PATH) +else: + print 'This code require the TurtleBlocks activity to be installed.' + exit(1) + from time import * from random import uniform from math import * diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 6ca07d6..f96a178 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -1627,9 +1627,9 @@ before making changes to your program')) self._restore_from_trash(find_top_block(blk)) elif blk.type == 'proto': if self.deleting_blocks: - if 'my blocks' in palette_names and \ + if 'myblocks' in palette_names and \ self.selected_palette == \ - palette_names.index('my blocks'): + palette_names.index('myblocks'): self._delete_stack_alert(blk) self.parent.get_window().set_cursor( gtk.gdk.Cursor(gtk.gdk.LEFT_PTR)) @@ -1838,7 +1838,7 @@ before making changes to your program')) error_output('Could not remove macro %s: %s' % (macro_path, e)) return - i = palette_names.index('my blocks') + i = palette_names.index('myblocks') palette_blocks[i].remove(blk.name) for pblk in self.palettes[i]: if pblk.name == blk.name: diff --git a/plugins/accelerometer/accelerometer.py b/plugins/accelerometer/accelerometer.py index f2c39e6..57aadea 100644 --- a/plugins/accelerometer/accelerometer.py +++ b/plugins/accelerometer/accelerometer.py @@ -22,7 +22,6 @@ from gettext import gettext as _ from plugins.plugin import Plugin from TurtleArt.tapalette import make_palette -from TurtleArt.talogo import primitive_dictionary from TurtleArt.tautils import debug_output from TurtleArt.taprimitive import Primitive diff --git a/plugins/audio_sensors/audio_sensors.py b/plugins/audio_sensors/audio_sensors.py index 5184896..d62ca65 100644 --- a/plugins/audio_sensors/audio_sensors.py +++ b/plugins/audio_sensors/audio_sensors.py @@ -18,7 +18,6 @@ from gettext import gettext as _ try: - from numpy import append from numpy.fft import rfft PITCH_AVAILABLE = True except: @@ -33,7 +32,6 @@ from plugins.audio_sensors.ringbuffer import RingBuffer1d from TurtleArt.tapalette import make_palette from TurtleArt.taconstants import XO1, XO15, XO175, XO30, XO4 -from TurtleArt.talogo import primitive_dictionary from TurtleArt.tautils import debug_output from TurtleArt.taprimitive import (ConstantArg, Primitive) from TurtleArt.tatype import TYPE_NUMBER @@ -143,8 +141,8 @@ class Audio_sensors(Plugin): self.voltage_gain = -0.00015 self.voltage_bias = 1.70 elif self.hw == XO175: # Range 0.01V to 3.01V - self.voltage_gain = 0.000101 - self.voltage_bias = 1.371 + self.voltage_gain = 0.0000516 + self.voltage_bias = 1.3598 elif self.hw == XO4: # Range 0.17V to 3.08V self.voltage_gain = 0.0004073 self.voltage_bias = 1.6289 @@ -409,9 +407,9 @@ class Audio_sensors(Plugin): else: self._resistance[channel] = 420000000 elif self.hw == XO175: # Range 0 to inf ohms - if avg_buf < 30700: + if avg_buf < 30519: self._resistance[channel] = \ - (48000000. / (15740 - avg_buf)) - 1640 + (92000000. / (30519 - avg_buf)) - 1620 else: self._resistance[channel] = 999999999 elif self.hw == XO4: # Range 0 to inf ohms diff --git a/plugins/camera_sensor/camera_sensor.py b/plugins/camera_sensor/camera_sensor.py index d6eac89..5f79d15 100644 --- a/plugins/camera_sensor/camera_sensor.py +++ b/plugins/camera_sensor/camera_sensor.py @@ -30,7 +30,7 @@ from plugins.camera_sensor.v4l2 import v4l2_control, V4L2_CID_AUTOGAIN, \ from plugins.plugin import Plugin from TurtleArt.tapalette import make_palette -from TurtleArt.talogo import media_blocks_dictionary, primitive_dictionary +from TurtleArt.talogo import media_blocks_dictionary from TurtleArt.tautils import get_path, debug_output from TurtleArt.taconstants import MEDIA_SHAPES, NO_IMPORT, SKIN_PATHS, \ BLOCKS_WITH_SKIN diff --git a/plugins/light_sensor/light_sensor.py b/plugins/light_sensor/light_sensor.py index cd28c14..dc4ebb1 100644 --- a/plugins/light_sensor/light_sensor.py +++ b/plugins/light_sensor/light_sensor.py @@ -22,7 +22,6 @@ from gettext import gettext as _ from plugins.plugin import Plugin from TurtleArt.tapalette import make_palette -from TurtleArt.talogo import primitive_dictionary from TurtleArt.tautils import debug_output from TurtleArt.taprimitive import Primitive from TurtleArt.tatype import TYPE_NUMBER diff --git a/plugins/rfid/rfid.py b/plugins/rfid/rfid.py index 8deac63..c8742ff 100644 --- a/plugins/rfid/rfid.py +++ b/plugins/rfid/rfid.py @@ -24,7 +24,6 @@ from plugins.rfid.rfidutils import strhex2bin, strbin2dec, find_device from plugins.plugin import Plugin from TurtleArt.tapalette import make_palette -from TurtleArt.talogo import primitive_dictionary from TurtleArt.tautils import debug_output from TurtleArt.taprimitive import Primitive from TurtleArt.tatype import TYPE_STRING diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py index e6f2989..1e9b2e4 100644 --- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py +++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py @@ -1102,7 +1102,7 @@ Journal objects')) files = glob.glob(os.path.join(self.tw.macros_path, '*.tb')) if len(files) > 0: palette = make_palette( - 'my blocks', + 'myblocks', colors=["#FFFF00", "#A0A000"], help_string=_('Palette of user-defined operators'), translation=_('my blocks')) diff --git a/pyexported/window_setup.py b/pyexported/window_setup.py index 45c7ba4..537022a 100644 --- a/pyexported/window_setup.py +++ b/pyexported/window_setup.py @@ -6,8 +6,10 @@ pygtk.require('2.0') import gtk import gobject +from gettext import gettext as _ + import os -from sys import argv +import sys from TurtleArt.tablock import Media from TurtleArt.taconstants import CONSTANTS @@ -15,11 +17,10 @@ from TurtleArt.tatype import * from TurtleArt.tawindow import TurtleArtWindow +# search sys.path for a dir containing TurtleArt/tawindow.py # path to the toplevel directory of the TA installation _TA_INSTALLATION_PATH = None -# search the PYTHONPATH for a dir containing TurtleArt/tawindow.py -PYTHONPATH = os.environ["PYTHONPATH"] -for path in PYTHONPATH.split(":"): +for path in sys.path: try: entries = os.listdir(path) except OSError: @@ -113,7 +114,6 @@ class DummyTurtleMain(object): exit() - def get_tw(): """ Create a GTK window and instantiate a DummyTurtleMain instance. Return the TurtleArtWindow object that holds the turtles and the canvas. @@ -121,7 +121,7 @@ def get_tw(): # copied from turtleblocks.TurtleMain._setup_gtk() win = gtk.Window(gtk.WINDOW_TOPLEVEL) - gui = DummyTurtleMain(win=win, name=argv[0]) + gui = DummyTurtleMain(win=win, name=sys.argv[0]) # TODO re-enable this code (after giving gui the right attributes) # win.set_default_size(gui.width, gui.height) # win.move(gui.x, gui.y) |