def makeGdataMenu(parcel, parentMenu):

    handler = GdataMenuHandler.update(parcel,
                                      None,
                                      blockName='_gdata_GdataMenuHandler')

    showCalendarListEvent = BlockEvent.update(
        parcel,
        None,
        blockName='_gdata_ShowCalendarList',
        dispatchEnum='SendToBlockByReference',
        destinationBlockReference=handler)

    gdataMenu = Menu.update(parcel,
                            None,
                            blockName='_gdata_gdataMenu',
                            title="&Google",
                            parentBlock=parentMenu)

    MenuItem.update(
        parcel,
        None,
        blockName='_gdata_ShowCalendarListItem',
        title=_(u"&Subscribe to Google Calendar..."),
        helpString=_(u"Brings up a list of Google calendars to sync with"),
        event=showCalendarListEvent,
        parentBlock=gdataMenu)
Exemple #2
0
def makeGdataMenu(parcel, parentMenu):

    handler = GdataMenuHandler.update(parcel, None,
        blockName='_gdata_GdataMenuHandler')

    showCalendarListEvent = BlockEvent.update(parcel, None,
        blockName='_gdata_ShowCalendarList',
        dispatchEnum='SendToBlockByReference',
        destinationBlockReference=handler)

    gdataMenu = Menu.update(parcel, None, blockName='_gdata_gdataMenu',
        title="&Google",
        parentBlock=parentMenu)

    MenuItem.update(parcel, None, blockName='_gdata_ShowCalendarListItem',
        title=_(u"&Subscribe to Google Calendar..."),
        helpString=_(u"Brings up a list of Google calendars to sync with"),
        event=showCalendarListEvent,
        parentBlock=gdataMenu)
Exemple #3
0
def makeDebugMenu(parcel, toolsMenu):

    handler = DebugMenuHandler.update(parcel, None,
                                      blockName='_debug_DebugMenuHandler')

    showPyShellEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowPyShell',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    showPyCrustEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowPyCrust',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    showWidgetInspectorEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowWidgetInspector',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    reloadStylesEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ReloadStyles',
                          dispatchEnum='SendToBlockByReference',
                          commitAfterDispatch=True,
                          destinationBlockReference=handler)

    wxTestHarnessEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_WxTestHarness',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    showI18nManagerDebugWindowEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowI18nManagerDebugWindow',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    
    showBlockViewerEvent = \
        NewBlockWindowEvent.update(parcel, None,
                                   blockName='_debug_ShowBlockViewer',
                                   treeOfBlocks=makeBlockViewer(parcel))

    showRepositoryViewerEvent = \
        NewBlockWindowEvent.update(parcel, None,
                                   blockName='_debug_ShowRepositoryViewer',
                                   treeOfBlocks=makeRepositoryViewer(parcel))

    restartAppEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_RestartApp',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    debugMenu = Menu.update(parcel, None,
                            blockName='_debug_debugMenu',
                            title=_(u'&Debug'),
                            parentBlock=toolsMenu)

    MenuItem.update(parcel, None, 
                    blockName='_debug_ShowPyShellItem',
                    title=_(u'&Show Python shell...'),
                    helpString=_(u'Brings up an interactive Python shell'),
                    event=showPyShellEvent,
                    parentBlock=debugMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_ShowPyCrustItem',
                    title=_(u'Show Python shell with &object browser...'),
                    helpString=_(u'Brings up an interactive Python shell and object browser'),
                    event=showPyCrustEvent,
                    parentBlock=debugMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_ShowWidgetInspectorItem',
                    title=_(u'Show widget &inspection tool...'),
                    helpString=_(u'Displays the widget inspection tool, showing all current widgets and sizers'),
                    event=showWidgetInspectorEvent,
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_debug_separator_1',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_ReloadStylesItem',
                    title=_(u'Reload St&yles'),
                    helpString=_(u'Reloads styles'),
                    event=reloadStylesEvent,
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_debug_separator_2',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_WxTestHarnessItem',
                    title=_(u'W&x Test Harness'),
                    helpString=_(u'invoke the current flavor of wx debugging'),
                    event=wxTestHarnessEvent,
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_debug_separator_3',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_ShowI18nManagerDebugItem',
                    title=_(u'Show I18nManager &debug window...'),
                    helpString=_(u'Displays a tree of projects, locales, resources, and gettext localizations'),
                    event=showI18nManagerDebugWindowEvent,
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_debug_separator_4',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_ShowBlockViewerItem',
                    title=_(u'Show &Block Viewer...'),
                    helpString=_(u'Opens the Block Viewer'),
                    event = showBlockViewerEvent,
                    eventsForNamedLookup = [showBlockViewerEvent],
                    parentBlock=debugMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_ShowRepositoryViewerItem',
                    title=_(u'Show &Repository Viewer...'),
                    helpString=_(u'Opens the Repository Viewer'),
                    event=showRepositoryViewerEvent,
                    eventsForNamedLookup=[showRepositoryViewerEvent],
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_debug_separator_5',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_RestartApp',
                    title=_(u'Restart &Chandler'),
                    helpString=_(u'Restarts Chandler'),
                    event=restartAppEvent,
                    parentBlock=debugMenu)
Exemple #4
0
def makeTestMenu(parcel, toolsMenu):

    handler = TestMenuHandler.update(parcel, None,
                                     blockName='_debug_TestMenuHandler')

    generateDataEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_GenerateData',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    generateDataFromFileEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_GenerateDataFromFile',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    generateDataFromDialogEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_GenerateDataFromDialog',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    mimeTestEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_MimeTest',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    i18nMailTestEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_i18nMailTest',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    testMenu = Menu.update(parcel, None,
                           blockName='_debug_testMenu',
                           title=_(u'&Test'),
                           parentBlock=toolsMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_GenerateSomeDataItem',
                    title=_(u'&Generate Data'),
                    helpString=_(u'generates a few items of each kind'),
                    event=generateDataEvent,
                    parentBlock=testMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_GenerateMuchDataItem',
                    title=_(u'G&enerate Lots of Data'),
                    helpString=_(u'generates many items of each kind'),
                    event=generateDataEvent,
                    parentBlock=testMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_GenerateDataItemFromFile',
                    title=_(u'Generate Items from a &File'),
                    helpString=_(u'generates items from a file'),
                    event=generateDataFromFileEvent,
                    parentBlock=testMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_GenerateDataFromDialog',
                    title=_(u'Generate Items from a &Dialog'),
                    helpString=_(u'choose items to generate from a dialog'),
                    event=generateDataFromDialogEvent,
                    parentBlock=testMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_test_separator_1',
                    menuItemKind='Separator',
                    parentBlock=testMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_MimeTest',
                    title=_(u'Load MIME &Torture Tests'),
                    helpString=_(u'Loads real world complex / broken mime message examples provided by Anthony Baxter'),
                    event=mimeTestEvent,
                    parentBlock=testMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_i18nMailTest',
                    title=_(u'Load i18n &Mail Tests'),
                    helpString=_(u'Loads mail messages containing a variety of Charsets and Languages'),
                    event=i18nMailTestEvent,
                    parentBlock=testMenu)
def installParcel(parcel, oldVersion=None):
    """
    Creates Items that live in the initial repository. 

    Run at repository buildtime. 
    """

    # A KindCollection of all FlickPhoto kinds. The flickrIDIndex is used to
    # lookup photos by flickrID quickly.
    flickrPhotosCollection = KindCollection.update(
        parcel,
        'flickrPhotosCollection',
        kind=FlickrPhotoMixin.getKind(parcel.itsView),
        recursive=True)

    if not flickrPhotosCollection.hasIndex('flickrIDIndex'):
        flickrPhotosCollection.addIndex('flickrIDIndex',
                                        'attribute',
                                        attribute='flickrID',
                                        compare="__cmp__")

    # A NewFlickrCollectionEvent that adds a "Owner" collection to the sidebar
    addFlickrCollectionByOwnerEvent = AddFlickrCollectionEvent.update(
        parcel,
        'addFlickrCollectionByOwnerEvent',
        blockName='addFlickrCollectionByOwnerEvent',
        collectionType='Owner')

    # A NewFlickrCollectionEvent that adds a "Tag" collection to the sidebar
    addFlickrCollectionByTagEvent = AddFlickrCollectionEvent.update(
        parcel,
        'addFlickrCollectionByTagEvent',
        blockName='addFlickrCollectionByTagEvent',
        collectionType='Tag')

    handler = FlickrHandler.update(parcel,
                                   'flickrHandler',
                                   blockName='_flickr_flickrHandler')

    # A BlockEvent that tickles the background update task to run
    # Add an event for managing p2p access to collections
    updateEvent = BlockEvent.update(parcel,
                                    None,
                                    blockName='_flickr_UpdateFlickrNow',
                                    dispatchEnum='SendToBlockByReference',
                                    destinationBlockReference=handler)

    # Add menu items to Chandler
    demoMenu = schema.ns('osaf.views.main', parcel).ExperimentalMenu

    flickrMenu = Menu.update(parcel,
                             'FlickrDemoMenu',
                             blockName='FlickrDemoMenu',
                             title=_(u'F&lickr'),
                             helpString=_(u'Download Flickr photos'),
                             childrenBlocks=[],
                             parentBlock=demoMenu)

    MenuItem.update(parcel,
                    'NewFlickrCollectionByOwner',
                    blockName='NewFlickrCollectionByOwnerMenuItem',
                    title=_(u'Create new Flickr collection by &Owner...'),
                    event=addFlickrCollectionByOwnerEvent,
                    eventsForNamedLookup=[addFlickrCollectionByOwnerEvent],
                    parentBlock=flickrMenu)

    MenuItem.update(parcel,
                    'NewFlickrCollectionByTag',
                    blockName='NewFlickrCollectionByTagMenuItem',
                    title=_(u'Create new Flickr collection by &Tag...'),
                    event=addFlickrCollectionByTagEvent,
                    eventsForNamedLookup=[addFlickrCollectionByTagEvent],
                    parentBlock=flickrMenu)

    MenuItem.update(parcel,
                    'UpdateFlickrNow',
                    blockName='UpdateFlickrNowMenuItem',
                    title=_(u'&Update Flickr collections'),
                    event=updateEvent,
                    eventsForNamedLookup=[updateEvent],
                    parentBlock=flickrMenu)

    # The periodic task that adds new photos to the collection in the background
    UpdateTask.update(parcel,
                      'updateTask',
                      run_at_startup=True,
                      interval=timedelta(minutes=60))

    # The periodic task that sets the Flickr's API key
    LicenseTask.update(parcel,
                       "licenseTask",
                       run_at_startup=True,
                       interval=timedelta(days=1))

    # The detail view used to display a flickrPhoto
    blocks = schema.ns('osaf.framework.blocks', parcel)
    detail = schema.ns('osaf.views.detail', parcel)

    detail.makeSubtree(parcel, FlickrPhoto, [
        detail.makeArea(
            parcel,
            'AuthorArea',
            position=0.6,
            childBlocks=[
                detail.makeLabel(parcel, _(u'author'), borderTop=4),
                detail.makeSpacer(parcel, width=6),
                detail.makeEditor(parcel,
                                  'AuthorAttribute',
                                  viewAttribute=u'owner',
                                  presentationStyle={'format': 'static'}),
            ]).install(parcel)
    ])
def makeDebugMenu(parcel, toolsMenu):

    handler = DebugMenuHandler.update(parcel,
                                      None,
                                      blockName='_debug_DebugMenuHandler')

    showPyShellEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowPyShell',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    showPyCrustEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowPyCrust',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    showWidgetInspectorEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowWidgetInspector',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    reloadStylesEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ReloadStyles',
                          dispatchEnum='SendToBlockByReference',
                          commitAfterDispatch=True,
                          destinationBlockReference=handler)

    wxTestHarnessEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_WxTestHarness',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    showI18nManagerDebugWindowEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowI18nManagerDebugWindow',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    showBlockViewerEvent = \
        NewBlockWindowEvent.update(parcel, None,
                                   blockName='_debug_ShowBlockViewer',
                                   treeOfBlocks=makeBlockViewer(parcel))

    showRepositoryViewerEvent = \
        NewBlockWindowEvent.update(parcel, None,
                                   blockName='_debug_ShowRepositoryViewer',
                                   treeOfBlocks=makeRepositoryViewer(parcel))

    restartAppEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_RestartApp',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)

    debugMenu = Menu.update(parcel,
                            None,
                            blockName='_debug_debugMenu',
                            title=_(u'&Debug'),
                            parentBlock=toolsMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_ShowPyShellItem',
                    title=_(u'&Show Python shell...'),
                    helpString=_(u'Brings up an interactive Python shell'),
                    event=showPyShellEvent,
                    parentBlock=debugMenu)
    MenuItem.update(
        parcel,
        None,
        blockName='_debug_ShowPyCrustItem',
        title=_(u'Show Python shell with &object browser...'),
        helpString=_(
            u'Brings up an interactive Python shell and object browser'),
        event=showPyCrustEvent,
        parentBlock=debugMenu)
    MenuItem.update(
        parcel,
        None,
        blockName='_debug_ShowWidgetInspectorItem',
        title=_(u'Show widget &inspection tool...'),
        helpString=
        _(u'Displays the widget inspection tool, showing all current widgets and sizers'
          ),
        event=showWidgetInspectorEvent,
        parentBlock=debugMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_debug_separator_1',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_ReloadStylesItem',
                    title=_(u'Reload St&yles'),
                    helpString=_(u'Reloads styles'),
                    event=reloadStylesEvent,
                    parentBlock=debugMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_debug_separator_2',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_WxTestHarnessItem',
                    title=_(u'W&x Test Harness'),
                    helpString=_(u'invoke the current flavor of wx debugging'),
                    event=wxTestHarnessEvent,
                    parentBlock=debugMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_debug_separator_3',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(
        parcel,
        None,
        blockName='_debug_ShowI18nManagerDebugItem',
        title=_(u'Show I18nManager &debug window...'),
        helpString=
        _(u'Displays a tree of projects, locales, resources, and gettext localizations'
          ),
        event=showI18nManagerDebugWindowEvent,
        parentBlock=debugMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_debug_separator_4',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_ShowBlockViewerItem',
                    title=_(u'Show &Block Viewer...'),
                    helpString=_(u'Opens the Block Viewer'),
                    event=showBlockViewerEvent,
                    eventsForNamedLookup=[showBlockViewerEvent],
                    parentBlock=debugMenu)
    MenuItem.update(parcel,
                    None,
                    blockName='_debug_ShowRepositoryViewerItem',
                    title=_(u'Show &Repository Viewer...'),
                    helpString=_(u'Opens the Repository Viewer'),
                    event=showRepositoryViewerEvent,
                    eventsForNamedLookup=[showRepositoryViewerEvent],
                    parentBlock=debugMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_debug_separator_5',
                    menuItemKind='Separator',
                    parentBlock=debugMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_RestartApp',
                    title=_(u'Restart &Chandler'),
                    helpString=_(u'Restarts Chandler'),
                    event=restartAppEvent,
                    parentBlock=debugMenu)
Exemple #7
0
def installParcel(parcel, oldVersion=None):
    """
    Creates Items that live in the initial repository. 

    Run at repository buildtime. 
    """

    # A KindCollection of all FlickPhoto kinds. The flickrIDIndex is used to
    # lookup photos by flickrID quickly.
    flickrPhotosCollection = KindCollection.update(
        parcel, 'flickrPhotosCollection',
        kind = FlickrPhotoMixin.getKind(parcel.itsView),
        recursive = True)

    if not flickrPhotosCollection.hasIndex('flickrIDIndex'):
        flickrPhotosCollection.addIndex('flickrIDIndex', 'attribute',
                                        attribute='flickrID', compare="__cmp__")

    # A NewFlickrCollectionEvent that adds a "Owner" collection to the sidebar
    addFlickrCollectionByOwnerEvent = AddFlickrCollectionEvent.update(
        parcel, 'addFlickrCollectionByOwnerEvent',
        blockName = 'addFlickrCollectionByOwnerEvent',
        collectionType = 'Owner')

    # A NewFlickrCollectionEvent that adds a "Tag" collection to the sidebar
    addFlickrCollectionByTagEvent = AddFlickrCollectionEvent.update(
        parcel, 'addFlickrCollectionByTagEvent',
        blockName = 'addFlickrCollectionByTagEvent',
        collectionType = 'Tag')

    handler = FlickrHandler.update(parcel, 'flickrHandler',
                                   blockName='_flickr_flickrHandler')

    # A BlockEvent that tickles the background update task to run
    # Add an event for managing p2p access to collections
    updateEvent = BlockEvent.update(parcel, None,
                                    blockName='_flickr_UpdateFlickrNow',
                                    dispatchEnum='SendToBlockByReference',
                                    destinationBlockReference=handler)

    # Add menu items to Chandler
    demoMenu = schema.ns('osaf.views.main', parcel).ExperimentalMenu

    flickrMenu = Menu.update(
        parcel, 'FlickrDemoMenu',
        blockName = 'FlickrDemoMenu',
        title = _(u'F&lickr'),
        helpString = _(u'Download Flickr photos'),
        childrenBlocks = [ ],
        parentBlock = demoMenu)

    MenuItem.update(
        parcel, 'NewFlickrCollectionByOwner',
        blockName = 'NewFlickrCollectionByOwnerMenuItem',
        title = _(u'Create new Flickr collection by &Owner...'),
        event = addFlickrCollectionByOwnerEvent,
        eventsForNamedLookup = [addFlickrCollectionByOwnerEvent],
        parentBlock = flickrMenu)
 
    MenuItem.update(
        parcel, 'NewFlickrCollectionByTag',
        blockName = 'NewFlickrCollectionByTagMenuItem',
        title = _(u'Create new Flickr collection by &Tag...'),
        event = addFlickrCollectionByTagEvent,
        eventsForNamedLookup = [addFlickrCollectionByTagEvent],
        parentBlock = flickrMenu)

    MenuItem.update(
        parcel, 'UpdateFlickrNow',
        blockName = 'UpdateFlickrNowMenuItem',
        title = _(u'&Update Flickr collections'),
        event = updateEvent,
        eventsForNamedLookup = [updateEvent],
        parentBlock = flickrMenu)

    # The periodic task that adds new photos to the collection in the background
    UpdateTask.update(parcel, 'updateTask',
                      run_at_startup=True,
                      interval=timedelta(minutes=60))

    # The periodic task that sets the Flickr's API key
    LicenseTask.update(parcel, "licenseTask",
                       run_at_startup=True,
                       interval=timedelta(days=1))

    # The detail view used to display a flickrPhoto
    blocks = schema.ns('osaf.framework.blocks', parcel)
    detail = schema.ns('osaf.views.detail', parcel)

    detail.makeSubtree(parcel, FlickrPhoto, [
        detail.makeArea(parcel, 'AuthorArea',
                        position=0.6,
                        childBlocks=[
                            detail.makeLabel(parcel, _(u'author'), borderTop=4),
                            detail.makeSpacer(parcel, width=6),
                            detail.makeEditor(parcel, 'AuthorAttribute',
                                              viewAttribute=u'owner',
                                              presentationStyle={'format': 'static'}
                                          ),
                        ]).install(parcel)
    ])