diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-01-18 13:15:39 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-01-18 13:15:39 (GMT) |
commit | a10bc4ff15da53ab43c016976b4b7138b158ea91 (patch) | |
tree | f735892c092d9f4ece0ad506445cce57697f89e6 | |
parent | 414ff0fce4ffc48c7f17acf993d9000a2e424cc0 (diff) |
reworking of activity-specific metadata
-rw-r--r-- | TurtleArt/tawindow.py | 17 | ||||
-rw-r--r-- | TurtleArtActivity.py | 13 |
2 files changed, 18 insertions, 12 deletions
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index b6dc787..4634ccc 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -1371,11 +1371,14 @@ class TurtleArtWindow(): newblk.connections[i + 1] = argblk self.drag_group = find_group(newblk) self.block_operation = 'new' + debug_output(newblk.name, True) if len(newblk.spr.labels) > 0 and newblk.spr.labels[0] is not None \ and newblk.name not in ['', 'number', 'string']: - if newblk.spr.labels[0] not in self.used_block_list: - if len(self.used_block_list) > 0: - self.used_block_list.append(', ') + if len(self.used_block_list) > 0: + self.used_block_list.append(', ') + if newblk.name in special_names: + self.used_block_list.append(special_names[newblk.name]) + elif newblk.spr.labels[0] not in self.used_block_list: self.used_block_list.append(newblk.spr.labels[0]) def _new_macro(self, name, x, y): @@ -2870,9 +2873,11 @@ class TurtleArtWindow(): blk.connections = 'check' if self.running_sugar and len(blk.spr.labels) > 0 and \ blk.name not in ['', ' ', 'number', 'string']: - if blk.spr.labels[0] not in self.used_block_list: - if len(self.used_block_list) > 0: - self.used_block_list.append(', ') + if len(self.used_block_list) > 0: + self.used_block_list.append(', ') + if blk.name in special_names: + self.used_block_list.append(special_names[blk.name]) + elif blk.spr.labels[0] not in self.used_block_list: self.used_block_list.append(blk.spr.labels[0]) return blk diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py index 2144e58..d981bbc 100644 --- a/TurtleArtActivity.py +++ b/TurtleArtActivity.py @@ -94,12 +94,13 @@ class TurtleArtActivity(activity.Activity): # TRANS: activity count is the number of times this instance # has been accessed - if _('activity count') in self.metadata: - count = int(self.metadata[_('activity count')]) + if 'activity count' in self.metadata: + count = int(self.metadata['activity count']) count += 1 else: count = 1 - self.metadata[_('activity count')] = str(count) + self.metadata['activity count'] = str(count) + # Activity toolbar callbacks @@ -800,9 +801,9 @@ class TurtleArtActivity(activity.Activity): ''' Write the project to the Journal. ''' data_to_file(self.tw.assemble_data_to_save(), file_path) self.metadata['mime_type'] = 'application/x-turtle-art' - self.metadata[_('turtle blocks')] = ''.join(self.tw.used_block_list) - self.metadata['public'] = data_to_string([_('activity count'), - _('turtle blocks')]) + self.metadata['turtle blocks'] = ''.join(self.tw.used_block_list) + self.metadata['public'] = data_to_string(['activity count', + 'turtle blocks']) _logger.debug('Wrote to file: %s' % file_path) def read_file(self, file_path, run_it=True): |