def construct(self):
        page = super().construct()

        item = self.item
        subject = item.subject

        if not subject:
            return page

        if not item.is_communication():
            hbox = create_hbox_label(self, page, gettext("Message sort"))

            sort_data = self.MESSAGE_SORT
            lifeline = None
            cinfo = item.canvas.get_connection(item.tail)
            if cinfo:
                lifeline = cinfo.connected

            # disallow connecting two delete messages to a lifeline
            if (lifeline and lifeline.is_destroyed
                    and subject.messageSort != "deleteMessage"):
                sort_data = list(sort_data)
                assert sort_data[4][1] == "deleteMessage"
                del sort_data[4]

            combo = self.combo = create_uml_combo(sort_data,
                                                  self._on_message_sort_change)
            hbox.pack_start(combo, False, True, 0)

            index = combo.get_model().get_index(subject.messageSort)
            combo.set_active(index)

        return page
    def construct(self):
        page = super(MessagePropertyPage, self).construct()

        item = self.item
        subject = item.subject

        if not subject:
            return page

        if item.is_communication():
            self._messages = CommunicationMessageModel(item)
            tree_view = create_tree_view(self._messages, (_("Message"),))
            tree_view.set_headers_visible(False)
            frame = Gtk.Frame.new(label=_("Additional Messages"))
            frame.add(tree_view)
            page.pack_start(frame, True, True, 0)

            self._inverted_messages = CommunicationMessageModel(item, inverted=True)
            tree_view = create_tree_view(self._inverted_messages, (_("Message"),))
            tree_view.set_headers_visible(False)
            frame = Gtk.Frame.new(label=_("Inverted Messages"))
            frame.add(tree_view)
            page.pack_end(frame, True, True, 0)
        else:
            hbox = create_hbox_label(self, page, _("Message sort"))

            sort_data = self.MESSAGE_SORT
            lifeline = None
            cinfo = item.canvas.get_connection(item.tail)
            if cinfo:
                lifeline = cinfo.connected

            # disallow connecting two delete messages to a lifeline
            if (
                lifeline
                and lifeline.is_destroyed
                and subject.messageSort != "deleteMessage"
            ):
                sort_data = list(sort_data)
                assert sort_data[4][1] == "deleteMessage"
                del sort_data[4]

            combo = self.combo = create_uml_combo(
                sort_data, self._on_message_sort_change
            )
            hbox.pack_start(combo, False, True, 0)

            index = combo.get_model().get_index(subject.messageSort)
            combo.set_active(index)

        return page
예제 #3
0
    def construct(self):
        page = Gtk.VBox()

        hbox = create_hbox_label(self, page, _("Dependency type"))

        self.combo = create_uml_combo(self.DEPENDENCY_TYPES,
                                      self._on_dependency_type_change)
        hbox.pack_start(self.combo, False, True, 0)

        hbox = create_hbox_label(self, page, "")

        button = Gtk.CheckButton(_("Automatic"))
        button.set_active(self.item.auto_dependency)
        button.connect("toggled", self._on_auto_dependency_change)
        hbox.pack_start(button, True, True, 0)

        self.watcher.watch("subject", self._on_subject_change).subscribe_all()
        button.connect("destroy", self.watcher.unsubscribe_all)

        self.update()

        return page