Permalink
Browse files

added ordering for property pages

git-svn-id: file:///Users/arjan/backup/gaphor/gaphor/trunk@2785 a8418922-720d-0410-834f-a69b97ada669
  • Loading branch information...
amolenaar committed May 27, 2009
1 parent 0ffb333 commit b079792616b52b9288ea37627f123beff631fac0
@@ -87,6 +87,8 @@ class StereotypePage(object):
interface.implements(IPropertyPage)
+ order = 40
+
element_factory = inject('element_factory')
def __init__(self, context):
@@ -10,7 +10,6 @@
from gaphor.core import _, inject, transactional
from gaphor import UML
from gaphor.diagram import items
-from gaphor.ui.interfaces import IPropertyPage
from zope import interface, component
from gaphor.adapters.propertypages import NamedItemPropertyPage
@@ -20,7 +19,6 @@ class TransitionPropertyPage(NamedItemPropertyPage):
"""
element_factory = inject('element_factory')
- interface.implements(IPropertyPage)
component.adapts(items.TransitionItem)
def construct(self):
View
@@ -33,6 +33,8 @@ class IPropertyPage(interface.Interface):
A property page which can display itself in a notebook
"""
+ order = interface.Attribute('Order number, used for ordered display')
+
def construct(self):
"""
Create the page (gtk.Widget) that belongs to the Property page.
@@ -42,7 +42,13 @@ def create_pages(self, item):
"""
Load all tabs that can operate on the given item.
"""
+ adapters = []
for name, adapter in component.getAdapters([item,], IPropertyPage):
+ adapters.append((adapter.order, name, adapter))
+
+ adapters.sort()
+
+ for _, name, adapter in adapters:
try:
page = adapter.construct()
expander = gtk.Expander()

0 comments on commit b079792

Please sign in to comment.