Connect it up.

Inelegant but functional.
This commit is contained in:
Simon Forman
2020-05-10 08:28:49 -07:00
parent cc6516698b
commit 663753a770
3 changed files with 44 additions and 4 deletions
+16 -1
View File
@@ -29,7 +29,7 @@ from inspect import getdoc
from joy.joy import run
from joy.library import HELP_TEMPLATE
from joy.parser import Symbol
from joy.utils.stack import stack_to_string
from joy.utils.stack import iter_stack, stack_to_string
from joy.utils.types import type_check
from .utils import is_numerical
@@ -152,3 +152,18 @@ class StackDisplayWorld(World):
if os.path.exists(self.filename):
with open(self.filename, 'rb') as f:
return pickle.load(f)
class StackWorld(StackDisplayWorld):
viewer = None
def set_viewer(self, viewer):
self.viewer = viewer
def print_stack(self):
StackDisplayWorld.print_stack(self)
if self.viewer:
self.viewer.stack = list(iter_stack(self.stack))
self.viewer._update()