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
def construct(self): page = Gtk.VBox() if not self.item.subject: return page # Show operations toggle hbox = Gtk.HBox() label = Gtk.Label(label="") label.set_justify(Gtk.Justification.LEFT) hbox.pack_start(label, False, True, 0) button = Gtk.CheckButton(label=gettext("Show operations")) button.set_active(self.item.show_operations) button.connect("toggled", self._on_show_operations_change) hbox.pack_start(button, True, True, 0) page.pack_start(hbox, False, True, 0) def create_model(): return ClassOperations(self.item, (str, bool, bool, object)) self.model = create_model() tip = """\ Add and edit class operations according to UML syntax. Operation syntax examples - call() - + call(a: int, b: str) - # call(a: int: b: str): bool """ tree_view = create_tree_view( self.model, (gettext("Operation"), gettext("A"), gettext("S")), tip ) page.pack_start(tree_view, True, True, 0) @AsyncIO(single=True) def handler(event): if not tree_view.props.has_focus and self.item and self.item.subject: self.model = create_model() tree_view.set_model(self.model) self.watcher.watch("ownedOperation.name", handler).watch( "ownedOperation.isAbstract", handler ).watch("ownedOperation.visibility", handler).watch( "ownedOperation.returnResult.lowerValue", handler ).watch( "ownedOperation.returnResult.upperValue", handler ).watch( "ownedOperation.returnResult.typeValue", handler ).watch( "ownedOperation.formalParameter.lowerValue", handler ).watch( "ownedOperation.formalParameter.upperValue", handler ).watch( "ownedOperation.formalParameter.typeValue", handler ).watch( "ownedOperation.formalParameter.defaultValue", handler ).subscribe_all() tree_view.connect("destroy", self.watcher.unsubscribe_all) return page
def construct(self): page = Gtk.VBox() if not self.item.subject: return page # Show attributes toggle hbox = Gtk.HBox() label = Gtk.Label(label="") label.set_justify(Gtk.Justification.LEFT) hbox.pack_start(label, False, True, 0) button = Gtk.CheckButton(label=gettext("Show attributes")) button.set_active(self.item.show_attributes) button.connect("toggled", self._on_show_attributes_change) hbox.pack_start(button, True, True, 0) page.pack_start(hbox, False, True, 0) def create_model(): return ClassAttributes(self.item, (str, bool, object)) self.model = create_model() tip = """\ Add and edit class attributes according to UML syntax. Attribute syntax examples - attr - + attr: int - # /attr: int """ tree_view = create_tree_view( self.model, (gettext("Attributes"), gettext("S")), tip ) page.pack_start(tree_view, True, True, 0) @AsyncIO(single=True) def handler(event): # Single it's asynchronous, make sure all properties are still there if not tree_view.props.has_focus and self.item and self.item.subject: self.model = create_model() tree_view.set_model(self.model) self.watcher.watch("ownedAttribute.name", handler).watch( "ownedAttribute.isDerived", handler ).watch("ownedAttribute.visibility", handler).watch( "ownedAttribute.isStatic", handler ).watch( "ownedAttribute.lowerValue", handler ).watch( "ownedAttribute.upperValue", handler ).watch( "ownedAttribute.defaultValue", handler ).watch( "ownedAttribute.typeValue", handler ).subscribe_all() tree_view.connect("destroy", self.watcher.unsubscribe_all) return page