예제 #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)
예제 #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)
예제 #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)
예제 #4
0
파일: blocks.py 프로젝트: vogth/chandler
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)
예제 #5
0
def installParcel(parcel, version=None):

    controller = AmazonController.update(parcel, "controller")

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

    amazonMenu = blocks.Menu.update(parcel, 'AmazonDemoMenu',
                                    blockName = 'AmazonDemoMenu',
                                    title = _(u'Ama&zon'),
                                    helpString = _(u'Download wishlists from Amazon'),
                                    childrenBlocks = [ ],
                                    parentBlock = main.ExperimentalMenu)

    blocks.MenuItem.update(parcel, "NewAmazonCollection",
        blockName = "NewAmazonCollectionMenu",
        title = _(u"Amazon &Keyword Search..."),
        event = blocks.BlockEvent.update(parcel, "NewAmazonCollectionEvent",
            blockName = "NewAmazonCollection",
            dispatchEnum = "SendToBlockByReference",
            destinationBlockReference = controller,
            commitAfterDispatch = True,
        ),
        eventsForNamedLookup = [parcel["NewAmazonCollectionEvent"]],
        parentBlock = amazonMenu,
    )

    blocks.MenuItem.update(parcel, "NewAmazonWishList",
        blockName = "NewAmazonWishListMenu",
        title = _(u"Amazon &Wish List Search..."),
        event = blocks.BlockEvent.update(parcel, "NewAmazonWishListEvent",
            blockName = "NewAmazonWishList",
            dispatchEnum = "SendToBlockByReference",
            destinationBlockReference = controller,
            commitAfterDispatch = True,
        ),
        eventsForNamedLookup = [parcel["NewAmazonWishListEvent"]],
        parentBlock = amazonMenu,
    )

    makeSubtree(parcel, AmazonItem, [
        detail.MarkupBar,
        AmazonDetailBlock.update(parcel, "amazonDetail",
            blockName = "amazonDetail",
            size = SizeType(100,50),
            minimumSize = SizeType(100,50),
        ),
    ])

    DisplayNamesItem.update(parcel, "displayNames",
        namesDictionary = {'ProductName': _(u'Product Name'),
                           'ProductDescription': _(u'Product Description'),
                           'Author': _(u'Author(s)'),
                           'Media': _(u'Media'),
                           'ReleaseDate': _(u'Release Date'),
                           'ImageURL': _(u'image path'),
                           'ProductURL': _(u'product url'),
                           'NewPrice': _(u'New Price'),
                           'UsedPrice': _(u'Used Price'),
                           'Availability': _(u'Availability'),
                           'Manufacturer': _(u'Manufacturer'),
                           'AverageCustomerRating': _(u'Average Customer Review'),
                           'NumberOfReviews': _(u'Number of people who reviewed the item')})

    LicenseTask.update(parcel, "licenseTask",
                       run_at_startup=True,
                       interval=timedelta(days=1))