Ejemplo n.º 1
0
 def getstate (self, state) :
     marking = self.states[state]
     places = ["%s = %s" % (H.span(place.name, class_="place"),
                            H.span(marking(place.name), class_="token"))
               for place in sorted(self.states.net.place(),
                                   key=operator.attrgetter("name"))]
     modes = [{"state" : state,
               "mode" : i,
               "html" : "%s : %s" % (H.span(trans.name, class_="trans"),
                                     H.span(binding, class_="binding"))}
               for i, (trans, binding) in enumerate(marking.modes)]
     return {"id" : state,
             "states" : [{"do" : "sethtml",
                          "select" : "#net",
                          "html" : H.i(self.states.net)},
                         {"do" : "settext",
                          "select" : "#state",
                          "text" : state},
                         {"do" : "setlist",
                          "select" : "#marking",
                          "items" : places},
                         ],
             "modes" : [{"select" : "#modes",
                         "items" : modes},
                        ],
             }
Ejemplo n.º 2
0
 def getstate(self, state):
     marking = self.states[state]
     places = [
         "%s = %s" % (H.span(place.name, class_="place"),
                      H.span(marking(place.name), class_="token"))
         for place in sorted(self.states.net.place(),
                             key=operator.attrgetter("name"))
     ]
     modes = [{
         "state":
         state,
         "mode":
         i,
         "html":
         "%s : %s" % (H.span(
             trans.name, class_="trans"), H.span(binding, class_="binding"))
     } for i, (trans, binding) in enumerate(marking.modes)]
     return {
         "id":
         state,
         "states": [
             {
                 "do": "sethtml",
                 "select": "#net",
                 "html": H.i(self.states.net)
             },
             {
                 "do": "settext",
                 "select": "#state",
                 "text": state
             },
             {
                 "do": "setlist",
                 "select": "#marking",
                 "items": places
             },
         ],
         "modes": [
             {
                 "select": "#modes",
                 "items": modes
             },
         ],
     }
Ejemplo n.º 3
0
 def init_ui (self) :
     argv = H.code(" ".join(sys.argv))
     version = (H.ul(H.li(H.b("Python: "),
                          H.br.join(sys.version.splitlines())),
                     H.li(H.b("SNAKES: "), snakes.version)))
     return [{"label" : "Versions",
              "id" : "ui-version",
              "href" : "#",
              "script" : "dialog(%r)" % version},
             {"label" : "Argv",
              "id" : "ui-argv",
              "href" : "#",
              "script" : "dialog(%r)" % argv}]
Ejemplo n.º 4
0
 def init_ui(self):
     argv = H.code(" ".join(sys.argv))
     version = (H.ul(
         H.li(H.b("Python: "), H.br.join(sys.version.splitlines())),
         H.li(H.b("SNAKES: "), snakes.version)))
     return [{
         "label": "Versions",
         "id": "ui-version",
         "href": "#",
         "script": "dialog(%r)" % version
     }, {
         "label": "Argv",
         "id": "ui-argv",
         "href": "#",
         "script": "dialog(%r)" % argv
     }]