def installParcel(parcel, old_version=None): blocks = schema.ns('osaf.framework.blocks', parcel) makeSubtree(parcel, PhotoMixin, [ makeEditor(parcel, "PhotoBody", viewAttribute=u"photoBody", border=RectType(2.0, 2.0, 2.0, 2.0), position=0.86, presentationStyle={ 'format': 'Image' }).install(parcel) ]) # Event to add a new image to the repository newImageEvent = NewImageEvent.update(parcel, 'NewImage', blockName='NewImage', classParameter=Note, allCollection=schema.ns( 'osaf.pim', parcel.itsView).allCollection) # Add menu item to Chandler photosMenu = Menu.update(parcel, 'PhotosDemoMenu', blockName='PhotosDemoMenuItem', title=_(u'&Photos'), helpString=_(u'Import photos'), childrenBlocks=[], parentBlock=schema.ns('osaf.views.main', parcel).ExperimentalMenu) MenuItem.update(parcel, 'ImportImageItem', blockName='ImportImageItemMenuItem', title=_(u'&Import image...'), helpString=_(u'Import an image from disk'), event=newImageEvent, eventsForNamedLookup=[newImageEvent], parentBlock=photosMenu)
def installParcel(parcel, old_version=None): blocks = schema.ns('osaf.framework.blocks', parcel) makeSubtree(parcel, PhotoMixin, [ makeEditor(parcel, "PhotoBody", viewAttribute=u"photoBody", border=RectType(2.0, 2.0, 2.0, 2.0), position=0.86, presentationStyle = { 'format': 'Image' } ).install(parcel) ]) # Event to add a new image to the repository newImageEvent = NewImageEvent.update( parcel, 'NewImage', blockName = 'NewImage', classParameter = Note, allCollection = schema.ns('osaf.pim', parcel.itsView).allCollection) # Add menu item to Chandler photosMenu = Menu.update( parcel, 'PhotosDemoMenu', blockName = 'PhotosDemoMenuItem', title = _(u'&Photos'), helpString = _(u'Import photos'), childrenBlocks = [ ], parentBlock = schema.ns('osaf.views.main', parcel).ExperimentalMenu) MenuItem.update( parcel, 'ImportImageItem', blockName = 'ImportImageItemMenuItem', title = _(u'&Import image...'), helpString = _(u'Import an image from disk'), event = newImageEvent, eventsForNamedLookup = [newImageEvent], parentBlock = photosMenu)
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)