Commit 0d1d0d49 authored by Theresa Pollinger's avatar Theresa Pollinger
Browse files

fix for installation connection problem

parent f9a2dcbe
......@@ -18,7 +18,7 @@ def install_my_kernel_spec(user=True, prefix=None):
with open(os.path.join(td, 'kernel.json'), 'w') as f:
json.dump(kernel_json, f, sort_keys=True)
interview = Interview()
interview = Interview(True)
with open(os.path.join(td, 'kernel.js'), 'w') as f:
# javascript code that sets an initial markdown cell in every new notebook
js = """define(['base/js/namespace'], function(Jupyter)
......@@ -58,9 +58,7 @@ Otherwise, you can always answer with \LaTeX-type input.
#You can inspect the currently loaded MMT theories under http://localhost:43397 #TODO
def __init__(self, **kwargs):
self.state_machine = pde_state_machine.PDE_States(self.poutput, self.update_prompt, self.please_prompt, self.display_html)
def __init__(self, install_run=False, **kwargs):
# call superclass constructor
super(Interview, self).__init__(**kwargs)
......@@ -70,18 +68,26 @@ Otherwise, you can always answer with \LaTeX-type input.
# from metakernel import register_ipython_magics
# register_ipython_magics()
self.poutstring = ""# to collect string output to send
self.outstream_name = 'stdout'
# already send some input to state machine, to capture initial output and have it displayed via kernel.js
self.state_machine.handle_state_dependent_input("anything") # TODO compatibility with not-notebook?
self.my_markdown_greeting = Interview.banner + self.poutstring
self.poutstring = ""
self.state_machine, self.my_markdown_greeting = self.set_initial_message(install_run)
# bokeh notebook setup
def set_initial_message(self, install_run=False):
# set it up -- without server communication capabilities if we are just installing
self.state_machine = pde_state_machine.PDE_States(self.poutput, self.update_prompt, self.please_prompt,
self.display_html, install_run)
# already send some input to state machine, to capture initial output and have it displayed via kernel.js
# / not displayed in the real thing
self.state_machine.handle_state_dependent_input("anything") # TODO compatibility with not-notebook?
my_markdown_greeting = Interview.banner + self.poutstring
self.poutstring = ""
return self.state_machine, my_markdown_greeting
def poutput(self, text, outstream_name='stdout'):
"""Accumulate the output here"""
self.poutstring += str(text) + "\n"
......@@ -67,7 +67,8 @@ class CriticalSubdict():
class PDE_States:
"""Just a state machine using pytranisitions that walks our theory graph and creates ephemeral theories and views"""
def __init__(self, output_function, after_state_change_function, prompt_function, display_html_function=None):
def __init__(self, output_function, after_state_change_function, prompt_function, display_html_function=None,
# just act like we were getting the right replies from MMT
self.cheating = True
......@@ -180,7 +181,13 @@ class PDE_States:
self.exaout = None
self.mmtinterface = MMTInterface()
self.install_run = install_run
if self.install_run:
self.mmtinterface = None
self.mmtinterface = MMTInterface()
#with MMTInterface() as self.mmtinterface:
"""Variables to signal callbacks depending on yes/no prompts"""
self.prompted = False
......@@ -277,7 +284,9 @@ class PDE_States:
def domain_mmt_preamble(self):
# set the current MMT theoryname for parsing the input TODO use right dimension
self.simdata[self.state]["theoryname"] = "ephdomain"
if not self.install_run:
# (ok, root) = self.mmtinterface.query_for(self.simdata[self.state]["theoryname"])
def domain_mmt_postamble(self):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment