Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions opencodeblocks/blocks/codeblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ def init_run_button(self):
"""Initialize the run button"""
run_button = QPushButton(">", self.root)
run_button.move(int(self.edge_size), int(self.edge_size / 2))
run_button.setFixedSize(int(3 * self.edge_size), int(3 * self.edge_size))
run_button.setFixedSize(int(3 * self.edge_size),
int(3 * self.edge_size))
run_button.clicked.connect(self.run_left)
return run_button

def init_run_all_button(self):
"""Initialize the run all button"""
run_all_button = QPushButton(">>", self.root)
run_all_button.setFixedSize(int(3 * self.edge_size), int(3 * self.edge_size))
run_all_button.setFixedSize(
int(3 * self.edge_size), int(3 * self.edge_size))
run_all_button.clicked.connect(self.run_right)
run_all_button.raise_()

Expand Down Expand Up @@ -228,6 +230,8 @@ def stdout(self, value: str):
if hasattr(self, "output_panel"):
if value.startswith("<img>"):
display_text = self.b64_to_html(value[5:])
elif value.startswith("<div>"):
display_text = value
else:
display_text = self.str_to_html(value)
self.output_panel.setText(display_text)
Expand Down
4 changes: 4 additions & 0 deletions opencodeblocks/graphics/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def message_to_output(self, message: dict) -> Tuple[str, str]:
message_type = 'image'
# output an image (from plt.plot or plt.imshow)
out = message['data']['image/png']
elif 'text/html' in message['data']:
message_type = 'text'
# output some html text (like a pandas dataframe)
out = message['data']['text/html']
else:
message_type = 'text'
# output data as str (for example if code="a=10\na")
Expand Down