def _get_adapters(self, item): """Return an ordered list of (order, name, adapter).""" adaptermap = {} if isinstance(item, Presentation) and item.subject: for adapter in PropertyPages(item.subject): adaptermap[(adapter.order, adapter.__class__.__name__)] = adapter for adapter in PropertyPages(item): adaptermap[(adapter.order, adapter.__class__.__name__)] = adapter return sorted(adaptermap.items())
def get_adapters(self, item): """ Return an ordered list of (order, name, adapter). """ adaptermap = {} try: if item.subject: for adapter in PropertyPages(item.subject): adaptermap[adapter.name] = (adapter.order, adapter.name, adapter) except AttributeError: pass for adapter in PropertyPages(item): adaptermap[adapter.name] = (adapter.order, adapter.name, adapter) adapters = sorted(adaptermap.values()) return adapters
"requirement-id-changed": (self._on_id_changed, ), "requirement-destroyed": (self.watcher.unsubscribe_all, ), }) return builder.get_object("requirement-editor") @transactional def _on_id_changed(self, entry): self.subject.externalId = entry.get_text() @transactional def _on_text_changed(self, buffer): self.subject.text = buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter(), False) PropertyPages.register(RequirementItem)(AttributesPage) PropertyPages.register(RequirementItem)(OperationsPage) @PropertyPages.register(BlockItem) class PartsAndReferencesPage(PropertyPageBase): """An editor for Block items.""" order = 30 def __init__(self, item): super().__init__() self.item = item self.watcher = item.subject and item.subject.watcher() def construct(self):