Showing
2 changed files
with
17 additions
and
12 deletions
... | @@ -26,6 +26,17 @@ class ABCDSimulator (BaseSimulator) : | ... | @@ -26,6 +26,17 @@ class ABCDSimulator (BaseSimulator) : |
26 | if nid in n2html.n2a : | 26 | if nid in n2html.n2a : |
27 | self.abcd[trans.name] = ", ".join("#" + i for i in | 27 | self.abcd[trans.name] = ", ".join("#" + i for i in |
28 | n2html.n2a[nid]) | 28 | n2html.n2a[nid]) |
29 | + def init (self, state=-1) : | ||
30 | + res = BaseSimulator.init(self, state) | ||
31 | + res.update(self.info) | ||
32 | + res["help"] = self.init_help() | ||
33 | + return res | ||
34 | + def init_help (self) : | ||
35 | + help = BaseSimulator.init_help(self) | ||
36 | + help.update({"#model .abcd" : "ABCD source code", | ||
37 | + "#model .tree" : "hierarchy of ABCD objects", | ||
38 | + "#model .petrinet" : "Petri nets semantics"}) | ||
39 | + return help | ||
29 | def getstate (self, state) : | 40 | def getstate (self, state) : |
30 | marking = self.states[state] | 41 | marking = self.states[state] |
31 | modes = dict((t, []) for t in self.transid) | 42 | modes = dict((t, []) for t in self.transid) |
... | @@ -70,9 +81,3 @@ class Simulator (BaseHTTPSimulator) : | ... | @@ -70,9 +81,3 @@ class Simulator (BaseHTTPSimulator) : |
70 | "href" : "#", | 81 | "href" : "#", |
71 | "script" : "dialog($('#model .petrinet').html())" | 82 | "script" : "dialog($('#model .petrinet').html())" |
72 | }] | 83 | }] |
73 | - def init_help (self) : | ||
74 | - help = BaseHTTPSimulator.init_help(self) | ||
75 | - help.update({"#model .abcd" : "ABCD source code", | ||
76 | - "#model .tree" : "hierarchy of ABCD objects", | ||
77 | - "#model .petrinet" : "Petri nets semantics"}) | ||
78 | - return help | ... | ... |
... | @@ -108,6 +108,12 @@ class BaseSimulator (object) : | ... | @@ -108,6 +108,12 @@ class BaseSimulator (object) : |
108 | def succ (self, state, mode) : | 108 | def succ (self, state, mode) : |
109 | state = self.states.succ(state, mode) | 109 | state = self.states.succ(state, mode) |
110 | return self.getstate(state) | 110 | return self.getstate(state) |
111 | + def init_help (self) : | ||
112 | + return {"#trace": "the states and transitions explored so far", | ||
113 | + "#model" : "the model being simulated", | ||
114 | + "#alive .ui #ui-quit" : "stop the simulator (server side)", | ||
115 | + "#alive .ui #ui-help" : "show this help", | ||
116 | + "#alive .ui #ui-about" : "show information about the simulator"} | ||
111 | 117 | ||
112 | class BaseHTTPSimulator (Node) : | 118 | class BaseHTTPSimulator (Node) : |
113 | def __init__ (self, net, port=8000, respatt=[], simulator=None) : | 119 | def __init__ (self, net, port=8000, respatt=[], simulator=None) : |
... | @@ -197,12 +203,6 @@ class BaseHTTPSimulator (Node) : | ... | @@ -197,12 +203,6 @@ class BaseHTTPSimulator (Node) : |
197 | "id" : "ui-argv", | 203 | "id" : "ui-argv", |
198 | "href" : "#", | 204 | "href" : "#", |
199 | "script" : "dialog(%r)" % argv}] | 205 | "script" : "dialog(%r)" % argv}] |
200 | - def init_help (self) : | ||
201 | - return {"#trace": "the states and transitions explored so far", | ||
202 | - "#model" : "the model being simulated", | ||
203 | - "#alive .ui #ui-quit" : "stop the simulator (server side)", | ||
204 | - "#alive .ui #ui-help" : "show this help", | ||
205 | - "#alive .ui #ui-about" : "show information about the simulator"} | ||
206 | @http("application/json", state=int) | 206 | @http("application/json", state=int) |
207 | def init (self, state=-1) : | 207 | def init (self, state=-1) : |
208 | ret = {"ui" : self.init_ui(), | 208 | ret = {"ui" : self.init_ui(), | ... | ... |
-
Please register or login to post a comment