10#include "MantidJson/Json.h"
33 Json::Value cell_data;
34 const Json::Value empty = Json::Value(Json::ValueType::objectValue);
36 cell_data[
"cell_type"] =
"code";
37 cell_data[
"collapsed"] =
false;
38 cell_data[
"input"] = std::move(array_code);
39 cell_data[
"language"] =
"python";
40 cell_data[
"metadata"] = empty;
41 cell_data[
"outputs"] = Json::Value(Json::arrayValue);
52 Json::Value cell_data;
53 const Json::Value empty = Json::Value(Json::ValueType::objectValue);
55 cell_data[
"cell_type"] =
"code";
56 cell_data[
"collapsed"] =
false;
57 cell_data[
"input"] = string_code;
58 cell_data[
"language"] =
"python";
59 cell_data[
"metadata"] = empty;
60 cell_data[
"outputs"] = Json::Value(Json::arrayValue);
63 return Mantid::JsonHelpers::jsonToString(cell_data,
" ");
73 Json::Value cell_data;
74 const Json::Value empty = Json::Value(Json::ValueType::objectValue);
76 cell_data[
"cell_type"] =
"markdown";
77 cell_data[
"metadata"] = empty;
78 cell_data[
"source"] = std::move(string_array);
89 Json::Value cell_data;
90 const Json::Value empty = Json::Value(Json::ValueType::objectValue);
92 cell_data[
"cell_type"] =
"markdown";
93 cell_data[
"metadata"] = empty;
94 cell_data[
"source"] = string_text;
97 return Mantid::JsonHelpers::jsonToString(cell_data,
" ");
105 Json::Value strings(Json::arrayValue);
106 strings.append(Json::Value(
"This IPython Notebook was automatically "
107 "generated by MantidPlot, version: "));
109 strings.append(Json::Value(
"\n"));
111 strings.append(Json::Value(
"\n\nThe following information may be useful:\n"
112 "* [Mantid Framework Python API Reference]"
113 "(http://docs.mantidproject.org/nightly/api/python/index.html)\n"
114 "* [IPython Notebook "
115 "Documentation](http://ipython.org/ipython-doc/stable/notebook/)\n"
116 "* [matplotlib Documentation](http://matplotlib.org/contents.html)\n\n"
117 "Help requests and bug reports should be submitted to the [Mantid forum.]"
118 "(http://forum.mantidproject.org)"));
130 Json::Value import_mantid(Json::arrayValue);
132 import_mantid.append(Json::Value(
"#Import Mantid's Python API and IPython plotting tools\n"
133 "from mantid.simpleapi import *\n"
134 "from MantidIPython import *\n"
136 "#Some magic to tell matplotlib how to behave in IPython Notebook. Use "
137 "'%matplotlib nbagg' for interactive plots, if available.\n"
138 "%matplotlib inline"));
149 const Json::Value empty = Json::Value(Json::ValueType::objectValue);
151 Json::Value worksheet;
153 worksheet[
"metadata"] = empty;
155 Json::Value worksheet_arr(Json::arrayValue);
156 worksheet_arr.append(worksheet);
158 Json::Value meta_name;
159 meta_name[
"name"] =
"Mantid Notebook";
160 output[
"metadata"] = meta_name;
161 output[
"nbformat"] = 3;
162 output[
"nbformat_minor"] = 0;
163 output[
"worksheets"] = worksheet_arr;
176 return Mantid::JsonHelpers::jsonToString(root,
" ");
void headerComment()
Add a markdown cell of information for the user to the buffer of cells to write to the notebook.
void headerCode()
Add code cells to the buffer of cells to write to the notebook These are to import Mantid and matplot...
Json::Value buildNotebook()
Create a Json value containing the whole notebook.
std::string codeCell(const std::string &string_code)
Add a code cell to the buffer of cells to write to the notebook.
std::string writeNotebook()
Create a formatted string of Json which describes a notebook.
std::string markdownCell(const std::string &string_text)
Add a markdown cell to the buffer of cells to write to the notebook.
Json::Value m_cell_buffer
The Logger class is in charge of the publishing messages from the framework through various channels.
static const char * version()
The full version number.
static std::string releaseNotes()
The url to the most applicable release notes.
Kernel::Logger g_log("ExperimentInfo")
static logger object