Ticket #673: view-source-display-logo-code.patch

File view-source-display-logo-code.patch, 872 bytes (added by rgs, 15 years ago)

display logo code when view source is called

  • TurtleArtActivity.py

    diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
    index dbe357c..38afc40 100644
    a b class TurtleArtActivity(activity.Activity): 
    929929                error_handler=self._internal_jobject_error_cb)
    930930        self._jobject.destroy()
    931931
     932    def get_document_path(self, async_cb, async_err_cb):
     933        logo_code_path = self._dump_logo_code()
     934        async_cb(logo_code_path)
     935
     936    def _dump_logo_code(self):
     937        import tempfile
     938        tafd, tafile = tempfile.mkstemp(".ta")
     939        try:
     940            code = save_logo(self, self.tw)
     941            f = file(tafile, "w")
     942            f.write(code)
     943            f.close()
     944        except Exception as e:
     945            print("couldn't dump code to view source: " + str(e))
     946
     947        return tafile
     948
    932949"""
    933950Class for setting up tube for sharing
    934951"""