Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/turtleblocks.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2013-05-08 18:41:34 (GMT)
committer Walter Bender <walter.bender@gmail.com>2013-05-08 18:41:34 (GMT)
commit6553d941df5aa537afbbeb39fd6f55bfef61abd7 (patch)
treef0e149a9a3a1c12eca6742ddd06b3334d3954bf9 /turtleblocks.py
parent942c974ed60921f021665c6eaa337d3d9145e3b4 (diff)
consolidation of sharing/saving/copying code
Diffstat (limited to 'turtleblocks.py')
-rwxr-xr-xturtleblocks.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/turtleblocks.py b/turtleblocks.py
index 7cf5afd..36a03de 100755
--- a/turtleblocks.py
+++ b/turtleblocks.py
@@ -49,12 +49,10 @@ 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, MACROS)
-from TurtleArt.tautils import (data_to_string, data_from_string, listify,
- data_from_file, get_save_name, hat_on_top)
+ TAB_LAYER, SUFFIX)
+from TurtleArt.tautils import (data_from_string, get_save_name)
from TurtleArt.tawindow import TurtleArtWindow
from TurtleArt.taexportlogo import save_logo
-from TurtleArt.tapalette import make_palette
from util.menubuilder import MenuBuilder
@@ -66,7 +64,6 @@ class TurtleMain():
'/usr/local/share/sugar/activities/TurtleArt.activity'
_ICON_SUBPATH = 'images/turtle.png'
_GNOME_PLUGIN_SUBPATH = 'gnome_plugins'
- _MACROS_SUBPATH = 'macros'
def __init__(self):
self._abspath = os.path.abspath('.')
@@ -170,14 +167,6 @@ class TurtleMain():
if not exists(dpath):
makedirs(dpath)
- def _do_save_macro_cb(self, widget):
- if self.tw.saving_macro:
- self.win.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
- self.tw.saving_macro = False
- else:
- self.win.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))
- self.tw.saving_macro = True
-
def _start_gtk(self):
''' Get a main window set up. '''
self.win.connect('configure_event', self.tw.update_overlay_position)
@@ -609,16 +598,31 @@ class TurtleMain():
self.tw.stop_button()
self.tw.display_coordinates()
+ def _do_save_macro_cb(self, widget):
+ ''' Callback for save stack button. '''
+ self.tw.copying_blocks = False
+ if self.tw.saving_blocks:
+ self.win.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
+ self.tw.saving_blocks = False
+ else:
+ self.win.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))
+ self.tw.saving_blocks = True
+
def _do_copy_cb(self, button):
''' Callback for copy button. '''
- clipBoard = gtk.Clipboard()
- data = self.tw.assemble_data_to_save(False, False)
- if data is not []:
- text = data_to_string(data)
- clipBoard.set_text(text)
+ self.tw.saving_blocks = False
+ if self.tw.copying_blocks:
+ self.win.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
+ self.tw.copying_blocks = False
+ else:
+ self.win.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))
+ self.tw.copying_blocks = True
def _do_paste_cb(self, button):
''' Callback for paste button. '''
+ self.tw.copying_blocks = False
+ self.tw.saving_blocks = False
+ self.win.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
clipBoard = gtk.Clipboard()
text = clipBoard.wait_for_text()
if text is not None: