Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArtActivity.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-06-30 14:49:33 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-06-30 14:49:33 (GMT)
commitea576330818699e188d7226b8bc6643efc38af26 (patch)
treeba1b34347fbf3d201ec6386cda30c8e28d906f62 /TurtleArtActivity.py
parenteefbc133c3d825b8f87979117af6a8eaaefa4e10 (diff)
new copy button behavior
Diffstat (limited to 'TurtleArtActivity.py')
-rw-r--r--TurtleArtActivity.py47
1 files changed, 35 insertions, 12 deletions
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
index 777bd79..86991da 100644
--- a/TurtleArtActivity.py
+++ b/TurtleArtActivity.py
@@ -868,6 +868,10 @@ class TurtleArtActivity(activity.Activity):
else: # ...or else, load a Start Block onto the canvas.
self.tw.load_start()
+ if self.has_toolbarbox:
+ self._old_cursor = self.get_window().get_cursor()
+ self.copying = False
+
def _setup_sharing(self):
''' Setup the Collabora stack. '''
self._collaboration = Collaboration(self.tw, self)
@@ -1096,8 +1100,25 @@ in order to use the plugin.'))
error_handler=self._internal_jobject_error_cb)
self._jobject.destroy()
+ def restore_cursor(self):
+ ''' No longer copying, so restore standard cursor. '''
+ self.copying = False
+ if self.has_toolbarbox:
+ self.get_window().set_cursor(self._old_cursor)
+
def _copy_cb(self, button):
''' Copy to the clipboard. '''
+ if self.copying:
+ self.restore_cursor()
+ else:
+ self.copying = True
+ if self.has_toolbarbox:
+ self._old_cursor = self.get_window().get_cursor()
+ self.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))
+
+ def send_to_clipboard(self):
+ ''' Send selected stack to clipboard. '''
+ self.restore_cursor()
clipboard = gtk.Clipboard()
_logger.debug('Serialize the project and copy to clipboard.')
data = self.tw.assemble_data_to_save(False, False)
@@ -1106,20 +1127,10 @@ in order to use the plugin.'))
clipboard.set_text(text)
self.tw.paste_offset = 20
- def _share_cb(self, button):
- ''' Share a stack of blocks. '''
- if not self.tw.sharing():
- return
- _logger.debug('Serialize a stack and send as event.')
- data = self.tw.assemble_data_to_save(False, False)
- if data is not []:
- text = data_to_string(data)
- event = 'B|%s' % (data_to_string([self.tw.nick, text])) # Paste
- self.tw.send_event(event)
- self.tw.paste_offset = 20
-
def _paste_cb(self, button):
''' Paste from the clipboard. '''
+ if self.copying:
+ self.restore_cursor()
clipboard = gtk.Clipboard()
_logger.debug('Paste to the project.')
text = clipboard.wait_for_text()
@@ -1134,6 +1145,18 @@ in order to use the plugin.'))
self.tw.paste_offset)
self.tw.paste_offset += 20
+ def _share_cb(self, button):
+ ''' Share a stack of blocks. '''
+ if not self.tw.sharing():
+ return
+ _logger.debug('Serialize a stack and send as event.')
+ data = self.tw.assemble_data_to_save(False, False)
+ if data is not []:
+ text = data_to_string(data)
+ event = 'B|%s' % (data_to_string([self.tw.nick, text])) # Paste
+ self.tw.send_event(event)
+ self.tw.paste_offset = 20
+
def _add_label(self, string, toolbar, width=None):
''' Add a label to a toolbar. '''
label = gtk.Label(string)