Esempio n. 1
0
    def add_extra_simrun_items(self, items):
        def text_fn(text, item, attr):
            return lambda: ("{0}: {1}".format(text,
                                              getattr(item, attr)),)
        for item in self.net.transitions():
            box_position = item.box.get_position()
            if item.get_time_substitution():
                size = item.box.size
                position = utils.vector_add_t(box_position, size, 0.5)
                i = citems.SimRunLabel(
                    None, "simrunbox", citems.RelativePlacement(item.box, position))
                i.text_fn = text_fn("time", item, "time_substitution_code")
                items.append(i)
                box_position = utils.vector_add(box_position, (0, 20))

            if item.get_clock_substitution():
                size = item.box.size
                position = utils.vector_add_t(box_position, size, 0.5)
                i = citems.SimRunLabel(
                    None, "simrunbox", citems.RelativePlacement(item.box, position))
                i.text_fn = text_fn("clock", item, "clock_substitution_code")
                items.append(i)

        for item in self.net.edges():
            if item.get_size_substitution():
                position = utils.vector_add(item.inscription.get_position(), (0, 10))
                i = citems.SimRunLabel(
                    None, "simrunbox", citems.RelativePlacement(item.inscription, position))
                i.text_fn = text_fn("size", item, "size_substitution_code")
                items.append(i)
Esempio n. 2
0
 def get_end_points(self):
     if self.points:
         p1 = self.points[0].get_position()
         p2 = self.points[-1].get_position()
     else:
         p1 = utils.vector_add_t(
             self.to_item.box.get_position(), self.to_item.box.size, 0.5)
         p2 = utils.vector_add_t(
             self.from_item.box.get_position(), self.from_item.box.size, 0.5)
     return (self.from_item.box.get_border_point(p1),
             self.to_item.box.get_border_point(p2))
Esempio n. 3
0
 def get_end_points(self):
     if self.points:
         p1 = self.points[0].get_position()
         p2 = self.points[-1].get_position()
     else:
         p1 = utils.vector_add_t(self.to_item.box.get_position(),
                                 self.to_item.box.size, 0.5)
         p2 = utils.vector_add_t(self.from_item.box.get_position(),
                                 self.from_item.box.size, 0.5)
     return (self.from_item.box.get_border_point(p1),
             self.to_item.box.get_border_point(p2))
Esempio n. 4
0
 def add_extra_verif_items(self, items):
     for item in self.net.places() + self.net.transitions():
             size = item.box.size
             position = utils.vector_add_t(item.box.get_position(), size, 0.5)
             i = citems.VerifLabel(
                 None, "verifbox", citems.RelativePlacement(item.box, position))
             i.text = item.get_verif_labels()
             items.append(i)
Esempio n. 5
0
 def add_extra_tracing_items(self, items):
     for item in self.net.places() + self.net.transitions():
         if item.tracing:
             size = item.box.size
             position = utils.vector_add_t(item.box.get_position(), size, 0.5)
             i = citems.TraceLabel(
                 None, "tracebox", citems.RelativePlacement(item.box, position))
             i.text = item.get_trace_texts()
             items.append(i)
Esempio n. 6
0
    def __init__(self, net, id, position):
        NetItem.__init__(self, net, id)

        self.box = citems.ElementBox(
            self,
            "box",
            citems.AbsPlacement(position),
            self.default_size,
            self.default_radius)

        self.label_placement = self.box.get_relative_placement(
            utils.vector_add_t(position, self.default_size, 0.5))
        self.label_trace = citems.TraceLabel(self, "tracebox", self.label_placement)
        self.label_trace.text_fn = self.get_trace_label_text

        self.label_simrun = citems.SimRunLabel(self, "simrunbox", self.label_placement)
        self.label_simrun.text_fn = self.get_simrun_label_text

        self.label_verif = citems.VerifLabel(self, "verifbox", self.label_placement)
        self.label_verif.text_fn = self.get_verif_label_text
Esempio n. 7
0
    def __init__(self, net, id, position):
        NetItem.__init__(self, net, id)

        self.box = citems.ElementBox(self, "box",
                                     citems.AbsPlacement(position),
                                     self.default_size, self.default_radius)

        self.label_placement = self.box.get_relative_placement(
            utils.vector_add_t(position, self.default_size, 0.5))
        self.label_trace = citems.TraceLabel(self, "tracebox",
                                             self.label_placement)
        self.label_trace.text_fn = self.get_trace_label_text

        self.label_simrun = citems.SimRunLabel(self, "simrunbox",
                                               self.label_placement)
        self.label_simrun.text_fn = self.get_simrun_label_text

        self.label_verif = citems.VerifLabel(self, "verifbox",
                                             self.label_placement)
        self.label_verif.text_fn = self.get_verif_label_text