Exemple #1
0
def installParcel(parcel, old_version=None):
    mainView = schema.ns('osaf.views.main', parcel.itsView)

    dispatchHook = EventLoggingDispatchHook.update(
        parcel, 'EventLoggingHook',
        blockName = 'EventLoggingHook')

    # Event to toggle logging
    ToggleLogging = BlockEvent.update(
        parcel, 'ToggleLogging',
        blockName = 'ToggleLogging',
        dispatchEnum = 'SendToBlockByReference',
        destinationBlockReference = dispatchHook)

    # Add menu item to Chandler
    MenuItem.update(
        parcel, 'StartLogging',
        blockName = 'StartLoggingMenuItem',
        menuItemKind = 'Check',
        title = _(u'Log &user actions'),
        helpString = _(u'Turn on logging and send result to OSAF'),
        event = ToggleLogging,
        eventsForNamedLookup = [ToggleLogging],
        parentBlock = mainView.LoggingMenu)

    # The periodic task that uploads logfiles in the background  
    UploadTask.update(parcel, 'uploadTask',
                      run_at_startup=True,
                      interval=timedelta(minutes=15))
Exemple #2
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 #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)
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)
def installParcel(parcel, old_version=None):
    mainView = schema.ns('osaf.views.main', parcel.itsView)

    dispatchHook = EventLoggingDispatchHook.update(
        parcel, 'EventLoggingHook', blockName='EventLoggingHook')

    # Event to toggle logging
    ToggleLogging = BlockEvent.update(parcel,
                                      'ToggleLogging',
                                      blockName='ToggleLogging',
                                      dispatchEnum='SendToBlockByReference',
                                      destinationBlockReference=dispatchHook)

    # Add menu item to Chandler
    MenuItem.update(parcel,
                    'StartLogging',
                    blockName='StartLoggingMenuItem',
                    menuItemKind='Check',
                    title=_(u'Log &user actions'),
                    helpString=_(u'Turn on logging and send result to OSAF'),
                    event=ToggleLogging,
                    eventsForNamedLookup=[ToggleLogging],
                    parentBlock=mainView.LoggingMenu)

    # The periodic task that uploads logfiles in the background
    UploadTask.update(parcel,
                      'uploadTask',
                      run_at_startup=True,
                      interval=timedelta(minutes=15))
Exemple #6
0
def installParcel(parcel, oldName=None):

    from osaf.framework.blocks import BlockEvent

    # pref instances
    PreviewPrefs.update(parcel, "previewPrefs")
    CalendarPrefs.update(parcel, "calendarPrefs")

    # events
    for eventName in ('GoToNext', 'GoToPrev', 'GoToToday', 'GoToDate'):
        BlockEvent.template(eventName,
                            dispatchToBlockName='MiniCalendar').install(parcel)

    BlockEvent.template(
        'GoToCalendarItem',
        dispatchToBlockName='MainCalendarControl').install(parcel)

    from CalendarCanvas import ColorChange
    ColorChange.update(parcel, "colorChange")
Exemple #7
0
def installParcel(parcel, oldName=None):

    from osaf.framework.blocks import BlockEvent
    
    # pref instances
    PreviewPrefs.update(parcel, "previewPrefs")
    CalendarPrefs.update(parcel, "calendarPrefs")

    # events
    for eventName in ('GoToNext','GoToPrev','GoToToday','GoToDate'):
        BlockEvent.template(eventName,
                            dispatchToBlockName='MiniCalendar'
                            ).install(parcel)

    BlockEvent.template('GoToCalendarItem',
                        dispatchToBlockName='MainCalendarControl'
                        ).install(parcel)


    from CalendarCanvas import ColorChange
    ColorChange.update(parcel, "colorChange")
Exemple #8
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)
def installParcel(parcel, old_version=None):
    main = schema.ns('osaf.views.main', parcel.itsView)
    controller = Controller.update(
        parcel, 'RecordingController',
        blockName = 'RecordingController')

    #Define the block events for use with the menu items to be created.

    # Add menu and event to record scripts
    ToggleRecording = BlockEvent.update(
        parcel, 'ToggleRecording',
        blockName = 'ToggleRecording',
        dispatchEnum = 'SendToBlockByReference',
        destinationBlockReference = controller)

    # Add menu and event to include testing in script
    ScriptVerification = BlockEvent.update(
        parcel, 'ScriptVerification',
        blockName = 'ScriptVerification',
        dispatchEnum = 'SendToBlockByReference',
        destinationBlockReference = controller)
    
    # Create a block event that will be used for the dynamic play script menu system
    PlayableSripts = BlockEvent.template('PlayableSripts',
                    dispatchToBlockName = 'ScriptMenu',
                    commitAfterDispatch = True).install(parcel)    
    
    # Add event to play a recording
    #create the block event that will handle the event raised by open script menu item
    BrowseScript = BlockEvent.update(
        parcel, 'BrowseScript',
        blockName = 'BrowseScript',
        dispatchEnum = 'SendToBlockByReference',
        destinationBlockReference = controller)
    
    Menu.template(
        'ScriptingMenuItem',
        title = _(u'Scriptin&g'),
        childBlocks = [
            MenuItem.template(
                'RecordingMenuItem',
                title = _(u'&Record Script'), # see onToggleRecordingEventUpdateUI
                helpString = _(u'Record commands in Chandler'),
                event = ToggleRecording),
            MenuItem.template(
                'ScriptVerificationMenuItem',
                title = _(u'&Verify Script'),
                helpString = _(u"When scripts run, verification ensure that the UI's data matches the state when the script was recorded"),
                menuItemKind = 'Check',
                event = ScriptVerification),
            
            # Create the block for the dynamic menu
            # Add a dynamic menu to display the playable scripts
            ScriptsMenu.template(
                'ScriptMenu',
                title = _(u'Run &Script'),
                event = PlayableSripts,
                childBlocks = [
                    # Add a menu item that allows user to browse for a specific playable script
                    MenuItem.template(
                        'PlayScriptMenuItem',
                        title = _(u'&Browse...'),
                        helpString = _(u'Open a script you recorded to play'),
                        event = BrowseScript)
                ])
            ],
        parentBlock = main.ToolsMenu)#don't .install(parcel)
Exemple #10
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 #11
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)
    ])
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 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 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)
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 #16
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)
Exemple #17
0
def makeMainEvents(parcel):

    from application import schema
    import osaf.pim.notes
    import osaf.pim.calendar
    import osaf.pim.mail
    import osaf.pim.tasks
    from osaf import pim, messages

    repositoryView = parcel.itsView

    # NewItemEvent's commitAfterDispatch defaults to True
    NewItemEvent.update(parcel, 'NewItem',
                        blockName = 'NewItem')

    NewItemEvent.update(parcel, 'NewNote',
                        blockName = 'NewNote',
                        classParameter = osaf.pim.notes.Note)

    NewItemEvent.update(parcel, 'NewMailMessage',
                        blockName = 'NewMailMessage',
                        classParameter = osaf.pim.mail.MailStamp)

    NewItemEvent.update(parcel, 'NewStarredNote',
                        blockName = 'NewStarredNote',
                        classParameter = osaf.pim.mail.TaskStamp)

    NewItemEvent.update(parcel, 'NewCalendar',
                        blockName = 'NewCalendar',
                        classParameter = osaf.pim.calendar.Calendar.EventStamp)

    NewItemEvent.update(parcel, 'DisplayMailMessage',
                        blockName = 'DisplayMailMessage',
                        dispatchEnum = 'SendToBlockByName',
                        dispatchToBlockName = 'MainView',
                        collection = schema.ns("osaf.pim", repositoryView).outCollection)

    BlockEvent.template('ReminderTime',
                        dispatchEnum = 'SendToBlockByReference'
                        # destinatinBlockReference is assigned in makeMakeView
                        # because of a circular dependence
                        ).install(parcel)
    
    BlockEvent.template('AddSharingLogToSidebar',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('ResetShare',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('RecordSetDebugging',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('SwitchRepository').install(parcel)

    BlockEvent.template('CreateRepository').install(parcel),

    BlockEvent.template('CompactRepository').install(parcel)

    BlockEvent.template('IndexRepository').install(parcel)

    BlockEvent.template('UnsubscribePublishedCollection',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('UnpublishCollection',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('UnsubscribeCollection',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('ShowHideStatusBar',
                        methodName = 'onShowHideEvent',
                        dispatchToBlockName = 'StatusBar').install(parcel)

    BlockEvent.template('SyncManager',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('EnableTimezones',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('FocusTogglePrivate',
                        dispatchEnum = 'FocusBubbleUp',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('MarkAsRead',
                        dispatchEnum = 'FocusBubbleUp',
                        commitAfterDispatch = True).install(parcel)

    ClassParameterizedEvent.template('FocusStampMessage',
                                     methodName = 'onFocusStampEvent',
                                     classParameter = osaf.pim.mail.MailStamp,
                                     dispatchEnum = 'FocusBubbleUp',
                                     commitAfterDispatch = True).install(parcel)

    ClassParameterizedEvent.template('FocusStampTask',
                                     methodName = 'onFocusStampEvent',
                                     classParameter = osaf.pim.tasks.TaskStamp,
                                     dispatchEnum = 'FocusBubbleUp',
                                     commitAfterDispatch = True).install(parcel)

    ClassParameterizedEvent.template('FocusStampCalendar',
                                     methodName = 'onFocusStampEvent',
                                     classParameter = osaf.pim.calendar.Calendar.EventStamp,
                                     dispatchEnum = 'FocusBubbleUp',
                                     commitAfterDispatch = True).install(parcel)

    ClassParameterizedEvent.template('ReplyMessage',
                                     methodName = 'onReplyEvent',
                                     classParameter = osaf.pim.mail.MailStamp,
                                     dispatchEnum = 'FocusBubbleUp',
                                     commitAfterDispatch = True).install(parcel)

    ClassParameterizedEvent.template('ReplyAllMessage',
                                     methodName = 'onReplyAllEvent',
                                     classParameter = osaf.pim.mail.MailStamp,
                                     dispatchEnum = 'FocusBubbleUp',
                                     commitAfterDispatch = True).install(parcel)

    ClassParameterizedEvent.template('ForwardMessage',
                                     methodName = 'onForwardEvent',
                                     classParameter = osaf.pim.mail.MailStamp,
                                     dispatchEnum = 'FocusBubbleUp',
                                     commitAfterDispatch = True).install(parcel)

    BlockEvent.template('SubscribeToCollection',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('CheckRepository').install(parcel)

    BlockEvent.template('CheckAndRepairRepository').install(parcel)

    BlockEvent.template('i18nMailTest',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('ShowLogWindow').install(parcel)

    BlockEvent.template('ActivateWebserver').install(parcel)

    BlockEvent.template('ShowActivityViewer').install(parcel)

    BlockEvent.template('GetNewMail',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('ManageSidebarCollection').install(parcel)

    BlockEvent.template('SaveSettings').install(parcel)

    BlockEvent.template('RestoreSettings',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('EditAccountPreferences').install(parcel)

    BlockEvent.template('LocalePicker').install(parcel)

    BlockEvent.template('ConfigureProxies').install(parcel)

    BlockEvent.template('ProtectPasswords',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('ShowHideSidebar',
                        methodName = 'onShowHideEvent',
                        dispatchToBlockName = 'SidebarContainer').install(parcel)

    BlockEvent.template('Triage',
                        dispatchEnum = 'ActiveViewBubbleUp',
                        commitAfterDispatch = True).install(parcel)

    ClassParameterizedEvent.template('ApplicationBarAll',
                                     methodName = 'onClassParameterizedEvent',
                                     dispatchToBlockName = 'Sidebar').install(parcel)

    ClassParameterizedEvent.template('ApplicationBarEvent',
                                     methodName = 'onClassParameterizedEvent',
                                     classParameter = osaf.pim.calendar.Calendar.EventStamp,
                                     dispatchToBlockName = 'Sidebar').install(parcel)

    ClassParameterizedEvent.template('ApplicationBarTask',
                                     methodName = 'onClassParameterizedEvent',
                                     classParameter = osaf.pim.tasks.TaskStamp,
                                     dispatchToBlockName = 'Sidebar').install(parcel)

    BlockEvent.template('PublishCollection').install(parcel)

    BlockEvent.template('SetLoggingLevelCritical').install(parcel)

    BlockEvent.template('SetLoggingLevelError').install(parcel)

    BlockEvent.template('SetLoggingLevelWarning').install(parcel)

    BlockEvent.template('SetLoggingLevelInfo').install(parcel)

    BlockEvent.template('SetLoggingLevelDebug').install(parcel)

    BlockEvent.template('RestoreShares').install(parcel)

    BlockEvent.template('SyncPrefs').install(parcel)

    BlockEvent.template('SyncCollection').install(parcel)

    BlockEvent.template('ToggleMine',
                        dispatchToBlockName = 'Sidebar',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('DumpToFile').install(parcel)

    BlockEvent.template('ObfuscatedDumpToFile').install(parcel)

    BlockEvent.template('ReloadFromFile',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('ShowHideApplicationBar',
                        methodName = 'onShowHideEvent',
                        dispatchToBlockName = 'ApplicationBar').install(parcel)

    BlockEvent.template('SyncAll').install(parcel)

    untitledCollection = pim.SmartCollection.update(parcel,
                                                    'untitledCollection',
                                                    displayName=messages.UNTITLED)

    AddToSidebarEvent.update(
        parcel, 'NewCollection',
        blockName = 'NewCollection',
        editAttributeNamed = 'displayName',
        sphereCollection = schema.ns('osaf.pim', repositoryView).mine,
        item = untitledCollection)
        
    BlockEvent.template('EmptyTrash',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('EditItems',
                        commitAfterDispatch=True).install(parcel)

    BlockEvent.template('SyncWebDAV').install(parcel)

    BlockEvent.template('ImportICalendar').install(parcel)
    BlockEvent.template('ExportICalendar').install(parcel)

    BlockEvent.template('EnableAutoUpdate').install(parcel)
    BlockEvent.template('ResetAutoUpdate').install(parcel)

    BlockEvent.template('CollectionInvite').install(parcel)

    BlockEvent.template('TakeOnlineOffline',
                       commitAfterDispatch = True).install(parcel)

    BlockEvent.template('TakeAllOnlineOffline').install(parcel)
    
    BlockEvent.template('TakeMailOnlineOffline').install(parcel)

    BlockEvent.template('TakeSharesOnlineOffline').install(parcel)

    BlockEvent.template('RequestSelectSidebarItem',
                        dispatchToBlockName = 'Sidebar').install(parcel)
    
    BlockEvent.template('SendMail',
                       commitAfterDispatch = True).install(parcel)

    BlockEvent.template('QuickEntry',
                        dispatchEnum = 'FocusBubbleUp').install(parcel)

    BlockEvent.template('Search',
                        commitAfterDispatch = True,
                        dispatchToBlockName = 'MainView').install(parcel)
                        
    BlockEvent.template('SwitchToQuickEntry',
                        commitAfterDispatch = True,
                        dispatchToBlockName = 'MainView').install(parcel)

    BlockEvent.template('SendShareItem',
                        commitAfterDispatch = True,
                        dispatchEnum = 'FocusBubbleUp').install(parcel)

    BlockEvent.template('SelectedDateChanged',
                        dispatchEnum = 'BroadcastEverywhere').install(parcel)
    
    BlockEvent.template('DayMode',
                        dispatchEnum = 'BroadcastEverywhere').install(parcel)

    BlockEvent.template('WeekStartChanged',
                        dispatchEnum = 'BroadcastEverywhere').install(parcel)
        
    CalendarViewEvent.template('ViewAsDayCalendar',
                               viewTemplatePath = 'osaf.views.main.CalendarSummaryViewTemplate',
                               methodName = 'onCalendarViewEvent',
                               dayMode = 'day',
                               dispatchEnum = 'ActiveViewBubbleUp').install(parcel)

    CalendarViewEvent.template('ViewAsWeekCalendar',
                               viewTemplatePath = 'osaf.views.main.CalendarSummaryViewTemplate',
                               methodName = 'onCalendarViewEvent',
                               dayMode = 'week',
                               dispatchEnum = 'ActiveViewBubbleUp').install(parcel)

    CalendarViewEvent.template('ViewAsMultiWeek',
                       viewTemplatePath = 'osaf.views.main.MultiWeekViewTemplate',
                       methodName = 'onCalendarViewEvent',
                       dayMode = 'multiweek',
                       dispatchEnum = 'ActiveViewBubbleUp').install(parcel)

    ViewEvent.template('ViewAsDashboard',
                       viewTemplatePath = 'Dashboard',
                       methodName = 'onViewEvent',
                       dispatchEnum = 'ActiveViewBubbleUp').install(parcel)

    ViewEvent.template('ViewAsCalendar',
                       viewTemplatePath = 'Calendar',
                       methodName = 'onViewEvent',
                       dispatchEnum = 'ActiveViewBubbleUp').install(parcel)

    BlockEvent.template('DuplicateSidebarSelection',
                        methodName = 'onDuplicateEvent',
                        dispatchToBlockName = 'Sidebar',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('RenameCollection',
                        methodName = 'onRenameEvent',
                        dispatchToBlockName = 'Sidebar',
                        commitAfterDispatch = True).install(parcel),
    
    BlockEvent.template('DeleteCollection',
                        methodName = 'onDeleteEvent',
                        dispatchToBlockName = 'Sidebar',
                        commitAfterDispatch = True).install(parcel),

    BlockEvent.template('DeleteInActiveView',
                        methodName = 'onDeleteEvent',
                        dispatchEnum = 'ActiveViewBubbleUp',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('RemoveInActiveView',
                        dispatchEnum = 'ActiveViewBubbleUp',
                        methodName = 'onRemoveEvent',
                        commitAfterDispatch = True).install(parcel),

    BlockEvent.template('CutInActiveView',
                        dispatchEnum = 'ActiveViewBubbleUp',
                        methodName = 'onCutEvent',
                        commitAfterDispatch = True).install(parcel),

    BlockEvent.template('CopyInActiveView',
                        dispatchEnum = 'ActiveViewBubbleUp',
                        methodName = 'onCopyEvent',
                        commitAfterDispatch = True).install(parcel),

    BlockEvent.template('DuplicateInActiveView',
                        dispatchEnum = 'ActiveViewBubbleUp',
                        methodName = 'onDuplicateEvent',
                        commitAfterDispatch = True).install(parcel),

    BlockEvent.template('PasteInActiveView',
                        dispatchEnum = 'ActiveViewBubbleUp',
                        methodName = 'onPasteEvent',
                        commitAfterDispatch = True).install(parcel),

    BlockEvent.template('BrowsePlugins',
                        dispatchToBlockName = 'PluginsMenu').install(parcel)

    BlockEvent.template('InstallPlugins',
                        dispatchToBlockName = 'PluginsMenu',
                        commitAfterDispatch = True).install(parcel)

    BlockEvent.template('Plugin',
                        dispatchToBlockName = 'PluginsMenu',
                        commitAfterDispatch = True).install(parcel)

    AddToSidebarEvent.update(
        parcel, 'SaveResults',
        blockName = 'SaveResults',
        editAttributeNamed = 'displayName',
        sphereCollection = schema.ns('osaf.pim', repositoryView).mine,
        item = schema.ns('osaf.pim', repositoryView).searchResults)
        
Exemple #18
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 #19
0
def makeMainEvents(parcel):

    from application import schema
    import osaf.pim.notes
    import osaf.pim.calendar
    import osaf.pim.mail
    import osaf.pim.tasks
    from osaf import pim, messages

    repositoryView = parcel.itsView

    # NewItemEvent's commitAfterDispatch defaults to True
    NewItemEvent.update(parcel, "NewItem", blockName="NewItem")

    NewItemEvent.update(parcel, "NewNote", blockName="NewNote", classParameter=osaf.pim.notes.Note)

    NewItemEvent.update(parcel, "NewMailMessage", blockName="NewMailMessage", classParameter=osaf.pim.mail.MailStamp)

    NewItemEvent.update(parcel, "NewStarredNote", blockName="NewStarredNote", classParameter=osaf.pim.mail.TaskStamp)

    NewItemEvent.update(
        parcel, "NewCalendar", blockName="NewCalendar", classParameter=osaf.pim.calendar.Calendar.EventStamp
    )

    NewItemEvent.update(
        parcel,
        "DisplayMailMessage",
        blockName="DisplayMailMessage",
        dispatchEnum="SendToBlockByName",
        dispatchToBlockName="MainView",
        collection=schema.ns("osaf.pim", repositoryView).outCollection,
    )

    BlockEvent.template(
        "ReminderTime",
        dispatchEnum="SendToBlockByReference"
        # destinatinBlockReference is assigned in makeMakeView
        # because of a circular dependence
    ).install(parcel)

    BlockEvent.template("AddSharingLogToSidebar", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("ResetShare", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("RecordSetDebugging", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("SwitchRepository").install(parcel)

    BlockEvent.template("CreateRepository").install(parcel),

    BlockEvent.template("CompactRepository").install(parcel)

    BlockEvent.template("IndexRepository").install(parcel)

    BlockEvent.template("UnsubscribePublishedCollection", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("UnpublishCollection", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("UnsubscribeCollection", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("ShowHideStatusBar", methodName="onShowHideEvent", dispatchToBlockName="StatusBar").install(
        parcel
    )

    BlockEvent.template("SyncManager", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("EnableTimezones", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("FocusTogglePrivate", dispatchEnum="FocusBubbleUp", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("MarkAsRead", dispatchEnum="FocusBubbleUp", commitAfterDispatch=True).install(parcel)

    ClassParameterizedEvent.template(
        "FocusStampMessage",
        methodName="onFocusStampEvent",
        classParameter=osaf.pim.mail.MailStamp,
        dispatchEnum="FocusBubbleUp",
        commitAfterDispatch=True,
    ).install(parcel)

    ClassParameterizedEvent.template(
        "FocusStampTask",
        methodName="onFocusStampEvent",
        classParameter=osaf.pim.tasks.TaskStamp,
        dispatchEnum="FocusBubbleUp",
        commitAfterDispatch=True,
    ).install(parcel)

    ClassParameterizedEvent.template(
        "FocusStampCalendar",
        methodName="onFocusStampEvent",
        classParameter=osaf.pim.calendar.Calendar.EventStamp,
        dispatchEnum="FocusBubbleUp",
        commitAfterDispatch=True,
    ).install(parcel)

    ClassParameterizedEvent.template(
        "ReplyMessage",
        methodName="onReplyEvent",
        classParameter=osaf.pim.mail.MailStamp,
        dispatchEnum="FocusBubbleUp",
        commitAfterDispatch=True,
    ).install(parcel)

    ClassParameterizedEvent.template(
        "ReplyAllMessage",
        methodName="onReplyAllEvent",
        classParameter=osaf.pim.mail.MailStamp,
        dispatchEnum="FocusBubbleUp",
        commitAfterDispatch=True,
    ).install(parcel)

    ClassParameterizedEvent.template(
        "ForwardMessage",
        methodName="onForwardEvent",
        classParameter=osaf.pim.mail.MailStamp,
        dispatchEnum="FocusBubbleUp",
        commitAfterDispatch=True,
    ).install(parcel)

    BlockEvent.template("SubscribeToCollection", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("CheckRepository").install(parcel)

    BlockEvent.template("CheckAndRepairRepository").install(parcel)

    BlockEvent.template("i18nMailTest", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("ShowLogWindow").install(parcel)

    BlockEvent.template("ActivateWebserver").install(parcel)

    BlockEvent.template("ShowActivityViewer").install(parcel)

    BlockEvent.template("GetNewMail", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("ManageSidebarCollection").install(parcel)

    BlockEvent.template("SaveSettings").install(parcel)

    BlockEvent.template("RestoreSettings", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("EditAccountPreferences").install(parcel)

    BlockEvent.template("LocalePicker").install(parcel)

    BlockEvent.template("ConfigureProxies").install(parcel)

    BlockEvent.template("ProtectPasswords", commitAfterDispatch=True).install(parcel)

    BlockEvent.template(
        "ShowHideSidebar", methodName="onShowHideEvent", dispatchToBlockName="SidebarContainer"
    ).install(parcel)

    BlockEvent.template("Triage", dispatchEnum="ActiveViewBubbleUp", commitAfterDispatch=True).install(parcel)

    ClassParameterizedEvent.template(
        "ApplicationBarAll", methodName="onClassParameterizedEvent", dispatchToBlockName="Sidebar"
    ).install(parcel)

    ClassParameterizedEvent.template(
        "ApplicationBarEvent",
        methodName="onClassParameterizedEvent",
        classParameter=osaf.pim.calendar.Calendar.EventStamp,
        dispatchToBlockName="Sidebar",
    ).install(parcel)

    ClassParameterizedEvent.template(
        "ApplicationBarTask",
        methodName="onClassParameterizedEvent",
        classParameter=osaf.pim.tasks.TaskStamp,
        dispatchToBlockName="Sidebar",
    ).install(parcel)

    BlockEvent.template("PublishCollection").install(parcel)

    BlockEvent.template("SetLoggingLevelCritical").install(parcel)

    BlockEvent.template("SetLoggingLevelError").install(parcel)

    BlockEvent.template("SetLoggingLevelWarning").install(parcel)

    BlockEvent.template("SetLoggingLevelInfo").install(parcel)

    BlockEvent.template("SetLoggingLevelDebug").install(parcel)

    BlockEvent.template("RestoreShares").install(parcel)

    BlockEvent.template("SyncPrefs").install(parcel)

    BlockEvent.template("SyncCollection").install(parcel)

    BlockEvent.template("ToggleMine", dispatchToBlockName="Sidebar", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("DumpToFile").install(parcel)

    BlockEvent.template("ObfuscatedDumpToFile").install(parcel)

    BlockEvent.template("ReloadFromFile", commitAfterDispatch=True).install(parcel)

    BlockEvent.template(
        "ShowHideApplicationBar", methodName="onShowHideEvent", dispatchToBlockName="ApplicationBar"
    ).install(parcel)

    BlockEvent.template("SyncAll").install(parcel)

    untitledCollection = pim.SmartCollection.update(parcel, "untitledCollection", displayName=messages.UNTITLED)

    AddToSidebarEvent.update(
        parcel,
        "NewCollection",
        blockName="NewCollection",
        editAttributeNamed="displayName",
        sphereCollection=schema.ns("osaf.pim", repositoryView).mine,
        item=untitledCollection,
    )

    BlockEvent.template("EmptyTrash", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("EditItems", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("SyncWebDAV").install(parcel)

    BlockEvent.template("ImportICalendar").install(parcel)
    BlockEvent.template("ExportICalendar").install(parcel)

    BlockEvent.template("EnableAutoUpdate").install(parcel)
    BlockEvent.template("ResetAutoUpdate").install(parcel)

    BlockEvent.template("CollectionInvite").install(parcel)

    BlockEvent.template("TakeOnlineOffline", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("TakeAllOnlineOffline").install(parcel)

    BlockEvent.template("TakeMailOnlineOffline").install(parcel)

    BlockEvent.template("TakeSharesOnlineOffline").install(parcel)

    BlockEvent.template("RequestSelectSidebarItem", dispatchToBlockName="Sidebar").install(parcel)

    BlockEvent.template("SendMail", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("QuickEntry", dispatchEnum="FocusBubbleUp").install(parcel)

    BlockEvent.template("Search", commitAfterDispatch=True, dispatchToBlockName="MainView").install(parcel)

    BlockEvent.template("SwitchToQuickEntry", commitAfterDispatch=True, dispatchToBlockName="MainView").install(parcel)

    BlockEvent.template("SendShareItem", commitAfterDispatch=True, dispatchEnum="FocusBubbleUp").install(parcel)

    BlockEvent.template("SelectedDateChanged", dispatchEnum="BroadcastEverywhere").install(parcel)

    BlockEvent.template("DayMode", dispatchEnum="BroadcastEverywhere").install(parcel)

    BlockEvent.template("WeekStartChanged", dispatchEnum="BroadcastEverywhere").install(parcel)

    CalendarViewEvent.template(
        "ViewAsDayCalendar",
        viewTemplatePath="osaf.views.main.CalendarSummaryViewTemplate",
        methodName="onCalendarViewEvent",
        dayMode="day",
        dispatchEnum="ActiveViewBubbleUp",
    ).install(parcel)

    CalendarViewEvent.template(
        "ViewAsWeekCalendar",
        viewTemplatePath="osaf.views.main.CalendarSummaryViewTemplate",
        methodName="onCalendarViewEvent",
        dayMode="week",
        dispatchEnum="ActiveViewBubbleUp",
    ).install(parcel)

    CalendarViewEvent.template(
        "ViewAsMultiWeek",
        viewTemplatePath="osaf.views.main.MultiWeekViewTemplate",
        methodName="onCalendarViewEvent",
        dayMode="multiweek",
        dispatchEnum="ActiveViewBubbleUp",
    ).install(parcel)

    ViewEvent.template(
        "ViewAsDashboard", viewTemplatePath="Dashboard", methodName="onViewEvent", dispatchEnum="ActiveViewBubbleUp"
    ).install(parcel)

    ViewEvent.template(
        "ViewAsCalendar", viewTemplatePath="Calendar", methodName="onViewEvent", dispatchEnum="ActiveViewBubbleUp"
    ).install(parcel)

    BlockEvent.template(
        "DuplicateSidebarSelection",
        methodName="onDuplicateEvent",
        dispatchToBlockName="Sidebar",
        commitAfterDispatch=True,
    ).install(parcel)

    BlockEvent.template(
        "RenameCollection", methodName="onRenameEvent", dispatchToBlockName="Sidebar", commitAfterDispatch=True
    ).install(parcel),

    BlockEvent.template(
        "DeleteCollection", methodName="onDeleteEvent", dispatchToBlockName="Sidebar", commitAfterDispatch=True
    ).install(parcel),

    BlockEvent.template(
        "DeleteInActiveView", methodName="onDeleteEvent", dispatchEnum="ActiveViewBubbleUp", commitAfterDispatch=True
    ).install(parcel)

    BlockEvent.template(
        "RemoveInActiveView", dispatchEnum="ActiveViewBubbleUp", methodName="onRemoveEvent", commitAfterDispatch=True
    ).install(parcel),

    BlockEvent.template(
        "CutInActiveView", dispatchEnum="ActiveViewBubbleUp", methodName="onCutEvent", commitAfterDispatch=True
    ).install(parcel),

    BlockEvent.template(
        "CopyInActiveView", dispatchEnum="ActiveViewBubbleUp", methodName="onCopyEvent", commitAfterDispatch=True
    ).install(parcel),

    BlockEvent.template(
        "DuplicateInActiveView",
        dispatchEnum="ActiveViewBubbleUp",
        methodName="onDuplicateEvent",
        commitAfterDispatch=True,
    ).install(parcel),

    BlockEvent.template(
        "PasteInActiveView", dispatchEnum="ActiveViewBubbleUp", methodName="onPasteEvent", commitAfterDispatch=True
    ).install(parcel),

    BlockEvent.template("BrowsePlugins", dispatchToBlockName="PluginsMenu").install(parcel)

    BlockEvent.template("InstallPlugins", dispatchToBlockName="PluginsMenu", commitAfterDispatch=True).install(parcel)

    BlockEvent.template("Plugin", dispatchToBlockName="PluginsMenu", commitAfterDispatch=True).install(parcel)

    AddToSidebarEvent.update(
        parcel,
        "SaveResults",
        blockName="SaveResults",
        editAttributeNamed="displayName",
        sphereCollection=schema.ns("osaf.pim", repositoryView).mine,
        item=schema.ns("osaf.pim", repositoryView).searchResults,
    )