Exemple #1
0
def installParcel(parcel, version=None):

    main = schema.ns('osaf.views.main', parcel)
    handler = fuseHandler.update(parcel,
                                 '_fuse_fuseHandler',
                                 blockName='_fuse_fuseHandler')

    # Add an event for mount/umount
    mountEvent = BlockEvent.update(parcel,
                                   None,
                                   blockName='_fuse_Mount',
                                   dispatchEnum='SendToBlockByReference',
                                   destinationBlockReference=handler)

    # Add a separator to the "Experimental" menu ...
    MenuItem.update(parcel,
                    'menuSeparator',
                    blockName='_fuse_menuSeparator',
                    menuItemKind='Separator',
                    parentBlock=main.ExperimentalMenu)

    # Add a menu item to the "Experimental" menu to mount/umount
    MenuItem.update(parcel,
                    "MountMenuItem",
                    blockName="_fuse_LoginMenuItem",
                    title=_(u"Show Sidebar in Finder"),
                    event=mountEvent,
                    eventsForNamedLookup=[mountEvent],
                    parentBlock=main.ExperimentalMenu)
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 installParcel(parcel, version=None):

    main = schema.ns('osaf.views.main', parcel)
    handler = fuseHandler.update(parcel, '_fuse_fuseHandler',
                                 blockName='_fuse_fuseHandler')

    # Add an event for mount/umount
    mountEvent = BlockEvent.update(parcel, None,
                                   blockName='_fuse_Mount',
                                   dispatchEnum='SendToBlockByReference',
                                   destinationBlockReference=handler)

    # Add a separator to the "Experimental" menu ...
    MenuItem.update(parcel, 'menuSeparator',
                    blockName='_fuse_menuSeparator',
                    menuItemKind='Separator',
                    parentBlock=main.ExperimentalMenu)

    # Add a menu item to the "Experimental" menu to mount/umount
    MenuItem.update(parcel, "MountMenuItem",
                    blockName="_fuse_LoginMenuItem",
                    title=_(u"Show Sidebar in Finder"),
                    event=mountEvent,
                    eventsForNamedLookup=[mountEvent],
                    parentBlock=main.ExperimentalMenu)
Exemple #4
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 #5
0
def installParcel(parcel, version=None):

    toolsMenu = schema.ns('osaf.views.main', parcel).ToolsMenu
    sharingMenu = schema.ns('osaf.views.main', parcel).ShareTestMenu

    MenuItem.update(parcel, None,
                    blockName='_debug_separator_0',
                    menuItemKind='Separator',
                    parentBlock=toolsMenu)

    makeTestMenu(parcel, toolsMenu)
    makeDebugMenu(parcel, toolsMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_separator_1',
                    menuItemKind='Separator',
                    parentBlock=sharingMenu)

    makeMeMenu(parcel, sharingMenu)

    MenuItem.update(parcel, None,
                    blockName='_debug_separator_2',
                    menuItemKind='Separator',
                    parentBlock=sharingMenu)

    makeSharingMenu(parcel, sharingMenu)

    schema.parcel_for_module("debug.scripts", parcel.itsView)
def installParcel(parcel, version=None):

    toolsMenu = schema.ns('osaf.views.main', parcel).ToolsMenu
    sharingMenu = schema.ns('osaf.views.main', parcel).ShareTestMenu

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_separator_0',
                    menuItemKind='Separator',
                    parentBlock=toolsMenu)

    makeTestMenu(parcel, toolsMenu)
    makeDebugMenu(parcel, toolsMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_separator_1',
                    menuItemKind='Separator',
                    parentBlock=sharingMenu)

    makeMeMenu(parcel, sharingMenu)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_separator_2',
                    menuItemKind='Separator',
                    parentBlock=sharingMenu)

    makeSharingMenu(parcel, sharingMenu)

    schema.parcel_for_module("debug.scripts", parcel.itsView)
Exemple #7
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 #8
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)
Exemple #9
0
def makeMeMenu(parcel, sharingMenu):

    handler = MeMenuHandler.update(parcel, None,
                                   blockName='_debug_MeMenuHandler')

    editMyNameEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_EditMyName',
                          dispatchEnum='SendToBlockByReference',
                          commitAfterDispatch=True,
                          destinationBlockReference=handler)
    showMeAddressCollectionDebugWindowEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowMeAddressCollectionDebugWindow',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    showCurrentMeAddressesDebugWindowEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowCurrentMeAddressesDebugWindow',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    showCurrentMeAddressDebugWindowEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowCurrentMeAddressDebugWindow',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    recalculateMeAddressesEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_RecalculateMeAddresses',
                          dispatchEnum='SendToBlockByReference',
                          commitAfterDispatch=True,
                          destinationBlockReference=handler)

    MenuItem.update(parcel, None,
                    blockName='_debug_EditMyName',
                    title=_(u'Edit "Me" &name...'),
                    helpString=_(u'Edit your name'),
                    event=editMyNameEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_ShowMeAddressCollectionDebugWindow',
                    title=_(u'Show "Me" Address &Collection...'),
                    helpString=_(u'Displays all active and old me addresses used to determine the fromMe and toMe attributes on Content Item'),
                    event=showMeAddressCollectionDebugWindowEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_ShowCurrentMeAddressesDebugWindow',
                    title=_(u'Show Current &Me Addresses...'),
                    helpString=_(u'Displays all active me addresses'),
                    event=showCurrentMeAddressesDebugWindowEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_ShowCurrentMeAddressDebugWindow',
                    title=_(u'&Show Current Me Address...'),
                    helpString=_(u'Displays the current me address'),
                    event=showCurrentMeAddressDebugWindowEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_recalculateEmailAddressItem',
                    title=_(u'&Recalculate Me Addresses'),
                    helpString=_(u'Loops through the Incoming and Outgoing Accounts and rebuilds the me addresses current references'),
                    event=recalculateMeAddressesEvent,
                    parentBlock=sharingMenu)
def makeSharingMenu(parcel, sharingMenu):

    handler = SharingMenuHandler.update(parcel, None,
                                        blockName='_debug_SharingMenuHandler')

    backgroundSyncAllEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_BackgroundSyncAll',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    backgroundSyncGetOnlyEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_BackgroundSyncGetOnly',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    toggleReadOnlyModeEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ToggleReadOnlyMode',
                          dispatchEnum='SendToBlockByReference',
                          commitAfterDispath=True,
                          destinationBlockReference=handler)
    inMemoryPublishEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_InMemoryPublish',
                          dispatchEnum='SendToBlockByReference',
                          commitAfterDispath=True,
                          destinationBlockReference=handler)
    convertExportFileEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ConvertExportFile',
                          dispatchEnum='SendToBlockByReference',
                          commitAfterDispath=True,
                          destinationBlockReference=handler)

    # handled in PimBlocks
    createConflictEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_CreateConflict',
                          dispatchEnum='FocusBubbleUp',
                          commitAfterDispath=True)

    MenuItem.update(parcel, None,
                    blockName='_debug_BackgroundSyncAll',
                    title=_(u'Start a &background sync now'),
                    helpString=_(u'Initiates a single background sync'),
                    event=backgroundSyncAllEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_BackgroundSyncGetOnly',
                    title=_(u'Start a &GET-only background sync of current collection'),
                    helpString=_(u'Initiates a single background sync without writing to server'),
                    event=backgroundSyncGetOnlyEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_ToggleReadOnlyMode',
                    title=_(u'Read-onl&y sharing mode'),
                    helpString=_(u'Forces all sharing to be done in read-only mode'),
                    menuItemKind='Check',
                    event=toggleReadOnlyModeEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel, None,
                    blockName="_debug_InMemoryPublish",
                    title=_(u"&Publish In-memory"),
                    helpString=_(u'Publish a collection in-memory'),
                    event=inMemoryPublishEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_CreateConflict',
                    title=_(u"Crea&te Conflict"),
                    helpString=_(u'Create an artificial conflict for the selected items'),
                    event=createConflictEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel, None,
                    blockName='_debug_ConvertExportFile',
                    title=_(u"Convert e&xport file"),
                    helpString=_(u'Convert an export file to a more readable text file'),
                    event=convertExportFileEvent,
                    parentBlock=sharingMenu)
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)
    ])
Exemple #12
0
def makeMeMenu(parcel, sharingMenu):

    handler = MeMenuHandler.update(parcel,
                                   None,
                                   blockName='_debug_MeMenuHandler')

    editMyNameEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_EditMyName',
                          dispatchEnum='SendToBlockByReference',
                          commitAfterDispatch=True,
                          destinationBlockReference=handler)
    showMeAddressCollectionDebugWindowEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowMeAddressCollectionDebugWindow',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    showCurrentMeAddressesDebugWindowEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowCurrentMeAddressesDebugWindow',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    showCurrentMeAddressDebugWindowEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_ShowCurrentMeAddressDebugWindow',
                          dispatchEnum='SendToBlockByReference',
                          destinationBlockReference=handler)
    recalculateMeAddressesEvent = \
        BlockEvent.update(parcel, None,
                          blockName='_debug_RecalculateMeAddresses',
                          dispatchEnum='SendToBlockByReference',
                          commitAfterDispatch=True,
                          destinationBlockReference=handler)

    MenuItem.update(parcel,
                    None,
                    blockName='_debug_EditMyName',
                    title=_(u'Edit "Me" &name...'),
                    helpString=_(u'Edit your name'),
                    event=editMyNameEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(
        parcel,
        None,
        blockName='_debug_ShowMeAddressCollectionDebugWindow',
        title=_(u'Show "Me" Address &Collection...'),
        helpString=
        _(u'Displays all active and old me addresses used to determine the fromMe and toMe attributes on Content Item'
          ),
        event=showMeAddressCollectionDebugWindowEvent,
        parentBlock=sharingMenu)
    MenuItem.update(parcel,
                    None,
                    blockName='_debug_ShowCurrentMeAddressesDebugWindow',
                    title=_(u'Show Current &Me Addresses...'),
                    helpString=_(u'Displays all active me addresses'),
                    event=showCurrentMeAddressesDebugWindowEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(parcel,
                    None,
                    blockName='_debug_ShowCurrentMeAddressDebugWindow',
                    title=_(u'&Show Current Me Address...'),
                    helpString=_(u'Displays the current me address'),
                    event=showCurrentMeAddressDebugWindowEvent,
                    parentBlock=sharingMenu)
    MenuItem.update(
        parcel,
        None,
        blockName='_debug_recalculateEmailAddressItem',
        title=_(u'&Recalculate Me Addresses'),
        helpString=
        _(u'Loops through the Incoming and Outgoing Accounts and rebuilds the me addresses current references'
          ),
        event=recalculateMeAddressesEvent,
        parentBlock=sharingMenu)
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 #14
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)
    ])