Beispiel #1
0
def installParcel(parcel, old_version=None):
    blocks = schema.ns('osaf.framework.blocks', parcel)

    makeSubtree(parcel, PhotoMixin, [
        makeEditor(parcel,
                   "PhotoBody",
                   viewAttribute=u"photoBody",
                   border=RectType(2.0, 2.0, 2.0, 2.0),
                   position=0.86,
                   presentationStyle={
                       'format': 'Image'
                   }).install(parcel)
    ])

    # Event to add a new image to the repository
    newImageEvent = NewImageEvent.update(parcel,
                                         'NewImage',
                                         blockName='NewImage',
                                         classParameter=Note,
                                         allCollection=schema.ns(
                                             'osaf.pim',
                                             parcel.itsView).allCollection)

    # Add menu item to Chandler
    photosMenu = Menu.update(parcel,
                             'PhotosDemoMenu',
                             blockName='PhotosDemoMenuItem',
                             title=_(u'&Photos'),
                             helpString=_(u'Import photos'),
                             childrenBlocks=[],
                             parentBlock=schema.ns('osaf.views.main',
                                                   parcel).ExperimentalMenu)

    MenuItem.update(parcel,
                    'ImportImageItem',
                    blockName='ImportImageItemMenuItem',
                    title=_(u'&Import image...'),
                    helpString=_(u'Import an image from disk'),
                    event=newImageEvent,
                    eventsForNamedLookup=[newImageEvent],
                    parentBlock=photosMenu)
Beispiel #2
0
def installParcel(parcel, old_version=None):
    blocks = schema.ns('osaf.framework.blocks', parcel)

    makeSubtree(parcel, PhotoMixin, [
        makeEditor(parcel, "PhotoBody",
            viewAttribute=u"photoBody",
            border=RectType(2.0, 2.0, 2.0, 2.0),
            position=0.86,           
            presentationStyle = { 'format': 'Image' }
        ).install(parcel)
    ])

     # Event to add a new image to the repository
    newImageEvent = NewImageEvent.update(
        parcel, 'NewImage',
        blockName = 'NewImage',
        classParameter = Note,
        allCollection = schema.ns('osaf.pim', parcel.itsView).allCollection)

    # Add menu item to Chandler
    photosMenu = Menu.update(
        parcel, 'PhotosDemoMenu',
        blockName = 'PhotosDemoMenuItem',
        title = _(u'&Photos'),
        helpString = _(u'Import photos'),
        childrenBlocks = [ ],
        parentBlock = schema.ns('osaf.views.main', parcel).ExperimentalMenu)

    MenuItem.update(
        parcel, 'ImportImageItem',
        blockName = 'ImportImageItemMenuItem',
        title = _(u'&Import image...'),
        helpString = _(u'Import an image from disk'),
        event = newImageEvent,
        eventsForNamedLookup = [newImageEvent],
        parentBlock = photosMenu)
Beispiel #3
0
def installParcel(parcel, oldVersion=None):
    """
    This function defines the feed parcel detail view layout.
    """
    
    detail = schema.ns("osaf.views.detail", parcel)
    blocks = schema.ns("osaf.framework.blocks", parcel)
    main   = schema.ns("osaf.views.main", parcel)
    feeds  = schema.ns("feeds", parcel)
    
    # Create an AddFeedCollectionEvent that adds an RSS collection to the sidebar.
    addFeedCollectionEvent = AddFeedCollectionEvent.update(
        parcel, "addFeedCollectionEvent",
        blockName = "addFeedCollectionEvent")
    
    # Add a separator to the "Collection" menu ...
    feedsMenu = blocks.Menu.update(parcel, "feedsDemoMenu",
                                   blockName = "feedsDemoMenu",
                                   title = _(u'&Feeds'),
                                   helpString = _(u'RSS reader'),
                                   childrenBlocks = [ ],
                                   parentBlock = main.ExperimentalMenu)
    
    # ... and, below it, a menu item to subscribe to a RSS feed.
    blocks.MenuItem.update(parcel, "newFeedChannel",
        blockName = "newFeedChannel",
        title = _(u"&Create new feed channel..."),
        event = addFeedCollectionEvent,
        eventsForNamedLookup = [addFeedCollectionEvent],
        parentBlock = feedsMenu,
    )
    
    # The hierarchy of UI elements for the FeedItem detail view
    feedItemRootBlocks = [
        # The markup bar
        detail.MarkupBar,
        detail.makeSpacer(parcel, height=6, position=0.01).install(parcel),
        
        # Author area
        detail.makeArea(parcel, "AuthorArea",
            position=0.19,
            childBlocks = [
                detail.makeLabel(parcel, _(u"author"), borderTop=2),
                detail.makeSpacer(parcel, width=8),
                #field("AuthorAttribute", title=u"author"),
                detail.makeEditor(parcel, "author",
                       viewAttribute=u"author",
                       border=RectType(0,2,2,2),
                       readOnly=True),                   
            ]
        ).install(parcel),
        
        # Category
        detail.makeArea(parcel, "CategoryArea",
            position=0.2,
            childBlocks = [
                detail.makeLabel(parcel, _(u"category"), borderTop=2),
                detail.makeSpacer(parcel, width=8),
                detail.makeEditor(parcel, "category",
                       viewAttribute=u"category",
                       border=RectType(0,2,2,2),
                       readOnly=True),
            ]
        ).install(parcel),
        
        # URL
        detail.makeArea(parcel, "LinkArea", 
            position=0.3,
            childBlocks = [
                detail.makeLabel(parcel, _(u"link"), borderTop=2),
                detail.makeSpacer(parcel, width=8),
                detail.makeEditor(parcel, "link",
                       viewAttribute=u"link",
                       border=RectType(0,2,2,2),
                       readOnly=True),
            ],
        ).install(parcel),
        
        # Date area
        detail.makeArea(parcel, "DateArea",
            position=0.4,
            childBlocks = [
                detail.makeLabel(parcel, _(u"date"), borderTop=2),
                detail.makeSpacer(parcel, width=8),
                detail.makeEditor(parcel, "date",
                       viewAttribute=u"date",
                       border=RectType(0,2,2,2),
                       readOnly=True,
                       stretchFactor=0.0,
                       size=SizeType(90, -1)),
            ],
        ).install(parcel),
        
        detail.makeSpacer(parcel, height=7, position=0.8999).install(parcel),
        
        FeedItemDetail.update(parcel, "ItemBodyArea",
            position=0.9,
            blockName="articletext",
            size=SizeType(100,50),
            minimumSize=SizeType(100,50),
        ),
    ]
    
    # The BranchSubtree ties the blocks to our FeedItem"s Kind.
    detail.makeSubtree(parcel, FeedItem, feedItemRootBlocks)
Beispiel #4
0
def installParcel(parcel, oldVersion=None):
    """
    This function defines the feed parcel detail view layout.
    """

    detail = schema.ns("osaf.views.detail", parcel)
    blocks = schema.ns("osaf.framework.blocks", parcel)
    main = schema.ns("osaf.views.main", parcel)
    feeds = schema.ns("feeds", parcel)

    # Create an AddFeedCollectionEvent that adds an RSS collection to the sidebar.
    addFeedCollectionEvent = AddFeedCollectionEvent.update(
        parcel, "addFeedCollectionEvent", blockName="addFeedCollectionEvent"
    )

    # Add a separator to the "Collection" menu ...
    feedsMenu = blocks.Menu.update(
        parcel,
        "feedsDemoMenu",
        blockName="feedsDemoMenu",
        title=_(u"&Feeds"),
        helpString=_(u"RSS reader"),
        childrenBlocks=[],
        parentBlock=main.ExperimentalMenu,
    )

    # ... and, below it, a menu item to subscribe to a RSS feed.
    blocks.MenuItem.update(
        parcel,
        "newFeedChannel",
        blockName="newFeedChannel",
        title=_(u"&Create new feed channel..."),
        event=addFeedCollectionEvent,
        eventsForNamedLookup=[addFeedCollectionEvent],
        parentBlock=feedsMenu,
    )

    # The hierarchy of UI elements for the FeedItem detail view
    feedItemRootBlocks = [
        # The markup bar
        detail.MarkupBar,
        detail.makeSpacer(parcel, height=6, position=0.01).install(parcel),
        # Author area
        detail.makeArea(
            parcel,
            "AuthorArea",
            position=0.19,
            childBlocks=[
                detail.makeLabel(parcel, _(u"author"), borderTop=2),
                detail.makeSpacer(parcel, width=8),
                # field("AuthorAttribute", title=u"author"),
                detail.makeEditor(
                    parcel, "author", viewAttribute=u"author", border=RectType(0, 2, 2, 2), readOnly=True
                ),
            ],
        ).install(parcel),
        # Category
        detail.makeArea(
            parcel,
            "CategoryArea",
            position=0.2,
            childBlocks=[
                detail.makeLabel(parcel, _(u"category"), borderTop=2),
                detail.makeSpacer(parcel, width=8),
                detail.makeEditor(
                    parcel, "category", viewAttribute=u"category", border=RectType(0, 2, 2, 2), readOnly=True
                ),
            ],
        ).install(parcel),
        # URL
        detail.makeArea(
            parcel,
            "LinkArea",
            position=0.3,
            childBlocks=[
                detail.makeLabel(parcel, _(u"link"), borderTop=2),
                detail.makeSpacer(parcel, width=8),
                detail.makeEditor(parcel, "link", viewAttribute=u"link", border=RectType(0, 2, 2, 2), readOnly=True),
            ],
        ).install(parcel),
        # Date area
        detail.makeArea(
            parcel,
            "DateArea",
            position=0.4,
            childBlocks=[
                detail.makeLabel(parcel, _(u"date"), borderTop=2),
                detail.makeSpacer(parcel, width=8),
                detail.makeEditor(
                    parcel,
                    "date",
                    viewAttribute=u"date",
                    border=RectType(0, 2, 2, 2),
                    readOnly=True,
                    stretchFactor=0.0,
                    size=SizeType(90, -1),
                ),
            ],
        ).install(parcel),
        detail.makeSpacer(parcel, height=7, position=0.8999).install(parcel),
        FeedItemDetail.update(
            parcel,
            "ItemBodyArea",
            position=0.9,
            blockName="articletext",
            size=SizeType(100, 50),
            minimumSize=SizeType(100, 50),
        ),
    ]

    # The BranchSubtree ties the blocks to our FeedItem"s Kind.
    detail.makeSubtree(parcel, FeedItem, feedItemRootBlocks)