def makeRootStuff(parcel, oldVersion): # The BranchPoint mechanism starts each specific detail view by cloning # this stub. DetailRootBlock.template('DetailRoot', orientationEnum='Vertical', size=SizeType(80, 20), minimumSize=SizeType(80, 40), eventBoundary=True).install(parcel)
def makeRepositoryViewer(parcel): window = FrameWindow.template( 'RepositoryViewerFrameWindow', size=SizeType(768, 512), windowTitle=_(u"Repository Viewer"), eventBoundary=True, childBlocks=[ SplitterWindow.template( 'RepositoryView', displayName=u'Repository Viewer', eventBoundary=True, splitPercentage=0.5, childBlocks=[ Tree.template( 'RepositoryTree', elementDelegate= 'debug.repositoryviewer.Repository.RepositoryDelegate', hideRoot=False, noLines=False, columns=[ Column.update(parcel, 'RepositoryViewColItemName', heading='ItemName', width=160), Column.update(parcel, 'RepositoryViewColDisplayName', heading='Display Name', width=110), Column.update(parcel, 'RepositoryViewColKind', heading='Kind', width=70), Column.update(parcel, 'RepositoryViewColUUID', heading='UUID', width=245), Column.update(parcel, 'RepositoryViewColPath', heading='Path', width=155), ], size=SizeType(600, 200), minimumSize=SizeType(400, 100)), BoxContainer.template('RepositoryItemDetailContainer', border=RectType(4, 0, 0, 0), childBlocks=[ RepositoryItemDetail.template( 'RepositoryItemDetail', size=SizeType(-1, -1)) ]) ]) ]).install(parcel) return window
def makeBlockViewer(parcel): window = FrameWindow.template( 'BlockViewerFrameWindow', size=SizeType(768, 512), windowTitle=_(u"Block Viewer"), eventBoundary=True, childBlocks=[ SplitterWindow.template( 'Splitter', eventBoundary=True, splitPercentage=0.5, childBlocks=[ Tree.template( 'Tree', elementDelegate= 'debug.blockviewer.blockviewer.BlockDelegate', hideRoot=False, noLines=False, columns=[ Column.update(parcel, 'ColumnBlockName', heading='BlockName', width=350), Column.update(parcel, 'ColumnKind', heading='Kind', width=100), Column.update(parcel, 'ColumnWidget', heading='Widget', width=280), Column.update(parcel, 'ColumnUUID', heading='UUID', width=40), ]), BoxContainer.template('BlockItemDetailContainer', border=RectType(4, 0, 0, 0), childBlocks=[ BlockItemDetail.template( 'BlockItemDetail', size=SizeType(-1, -1)) ]) ]) ]).install(parcel) return window
def installParcel(parcel, oldVersion=None): repositoryView = parcel.itsView blocksParcel = schema.ns('osaf.framework.blocks', repositoryView) aePresentationStyle = blocks.ControlBlocks.PresentationStyle.update( parcel, 'presentationStyle', format = 'static') attributeEditorBlock = blocks.ControlBlocks.AEBlock.update( parcel, 'attributeEditorBlock', blockName = 'HeadlineBlock', alignmentEnum = 'alignTopCenter', viewAttribute = 'displayName', presentationStyle = aePresentationStyle) button = blocks.ControlBlocks.Button.update( parcel, 'button', minimumSize = SizeType (40, 20), alignmentEnum = 'alignTopLeft', stretchFactor = 0.0, title = u'Play') view = blocks.BoxContainer.update( parcel, 'HelloWorldBoxContainer', orientationEnum = 'Horizontal', eventBoundary = True, childBlocks=[button, attributeEditorBlock]) blocks.BranchPoint.ViewableKind(MP3.getKind(repositoryView)).detailView = view song = MP3.update(parcel, "French Rock", about = "French Rock")
class ToolBarItem(BaseItem): selected = schema.One(schema.Boolean, defaultValue=False) size = schema.One(SizeType, defaultValue=SizeType(0, 0)) toggle = schema.One(schema.Boolean, defaultValue=False) bitmap = schema.One(schema.Text, defaultValue="") disabledBitmap = schema.One(schema.Text, defaultValue="") toolBarItemKind = schema.One(toolBarItemKindEnumType, defaultValue="Button") text = schema.One( schema.Text) # optional text for the ToolBarItem, e.g. QuickEntry text lastText = schema.One( schema.Text ) # optional lastText for the ToolBarItem, e.g. QuickEntry last command lastSearch = schema.One( schema.Text ) # optional lastSearch for the ToolBarItem, e.g. QuickEntry last search def instantiateWidget(self): if self.toolBarItemKind == 'QuickEntry': control = wxQuickEntry(self.parentBlock.widget, self.getWidgetID(), style=wx.TE_PROCESS_ENTER) # On platforms other than macintosh the text control is a child of the wxSearchCtrl. if wx.Platform == '__WXMAC__': textCtrl = control else: textCtrl = control.GetChildren()[0] textCtrl.SetName(self.blockName) # Apparently on Macintosh the selection starts out random, which causes it to crash # when setting text because it trys to delete characters that don't exist control.SetSelection(0, 0) control.blockItem = self widget = wx.ToolBarToolWithControl(None, control) widget.__class__ = wxToolBarTool else: kind = wx.ITEM_NORMAL if self.toolBarItemKind == 'Separator': id = wx.ID_SEPARATOR else: id = self.getWidgetID() if self.toggle: kind = wx.ITEM_CHECK elif self.toolBarItemKind == 'Radio': kind = wx.ITEM_RADIO widget = wxToolBarTool(None, id=id, kind=kind) return widget
def makeConflictBar(parcel, oldVersion): blocks = schema.ns('osaf.framework.blocks', parcel.itsView) conflictButton = ConflictWarningButton.template( 'ConflictButton', title=u'', characterStyle=blocks.DetailConflictStyle, buttonKind='TextImage', # need a better icon icon=u'MailErrorRolloverSelected.png', minimumSize=SizeType(225, 19)) return makeArea(parcel, 'ConflictBar', position=0.08, childBlocks=[ conflictButton, ]).install(parcel)
def makeSpacer(parcel, size=None, width=-1, height=-1, name=None, baseClass=ControlBlocks.StaticText, **kwds): """ Make a spacer block template for use in the detail view. Call .install(parcel) on the resulting template, either directly or after building up a list of templates, to actually instantiate the item in the parcel. @param parcel: The parcel that the spacer block will go into @type parcel: Parcel @param size: The size of the spacer block (handy if you want to specify both dimensions) @type size: Size @param width: The width of the spacer block (handy if you want the default height) @type width: Integer @param height: The height of the spacer block (handy if you want the default width) @type height: Integer @param name: A unique name within this parcel for the spacer block. One will be automatically generated if you don't specify one. @type name: String @param baseClass: Optionally, specify the base class of the new block; defaults to StaticText, but a subclass of SynchronizedSpacerBlock can be used if the spacer's visibility needs to be conditioned on data in the item being displayed. @type baseClass: class @return: The new spacer block template. """ blocks = schema.ns("osaf.framework.blocks", parcel.itsView) size = size or SizeType(width, height) return baseClass.template(name or uniqueName(parcel, 'Spacer'), title=u'', characterStyle=blocks.LabelStyle, stretchFactor=0.0, minimumSize=size, **kwds)
def makeLabel(parcel, label=u'', borderTop=5, border=None, width=60, baseClass=StaticText, textAlignmentEnum=None, **kwds): """ Make a StaticText label template for use in the detail view. Call .install(parcel) on the resulting template, either directly or after building up a list of templates, to actually instantiate the item in the parcel. @param parcel: The parcel that the label block will go into @type parcel: Parcel @param label: The label to be displayed (usually specified as "_(u'something')" to allow internationalization) @type label: Unicode @param borderTop: Optionally, specify a top border of 5, with 0 border on the other sides @type borderTop: Integer @param border: Optionally, specify all four sides of the border on the new label block. @type border: Rect @param width: Optionally, override the default width (60) (eventually, this'll be ignored and the label will measure itself). @type width: Integer @return: The new label block template. """ blocks = schema.ns("osaf.framework.blocks", parcel.itsView) border = border or RectType(borderTop, 0, 0, 0) textAlignmentEnum = textAlignmentEnum or 'Right' return baseClass.template(uniqueName(parcel, 'Label'), title=label, characterStyle=blocks.LabelStyle, textAlignmentEnum=textAlignmentEnum, stretchFactor=0.0, minimumSize=SizeType(width, -1), border=border, **kwds)
def makeArea(parcel, name, stretchFactor=None, border=None, minimumSize=None, baseClass=ContentItemDetail, **kwds): """ Make a block template that'll contain one horizontal slice of the detail view. Call .install(parcel) on the resulting template, either directly or after building up a list of templates, to actually instantiate the item in the parcel. @param parcel: The parcel that the block will go into @type parcel: Parcel @param name: A unique name for this block @type name: String @param stretchFactor: Optionally, override the default stretchFactor on the new block @type stretchFactor: float @param border: Optionally, override the default border on the new block @type border: Rect @param minimumSize: Optionally, override the default minimumSize of the new block @type minimumSize: Size @param baseClass: Optionally, specify the base class of the new block; defaults to ContentItemDetail. @type baseClass: class @return: The new block template. """ return baseClass.template(name, stretchFactor=stretchFactor or 0.0, minimumSize=minimumSize or SizeType(300, 24), border=border or RectType(0, 0, 0, 6), **kwds)
def installParcel(parcel, oldVersion=None): """ This function defines the feed parcel detail view layout. """ detail = schema.ns("osaf.views.detail", parcel) blocks = schema.ns("osaf.framework.blocks", parcel) main = schema.ns("osaf.views.main", parcel) feeds = schema.ns("feeds", parcel) # Create an AddFeedCollectionEvent that adds an RSS collection to the sidebar. addFeedCollectionEvent = AddFeedCollectionEvent.update( parcel, "addFeedCollectionEvent", blockName = "addFeedCollectionEvent") # Add a separator to the "Collection" menu ... feedsMenu = blocks.Menu.update(parcel, "feedsDemoMenu", blockName = "feedsDemoMenu", title = _(u'&Feeds'), helpString = _(u'RSS reader'), childrenBlocks = [ ], parentBlock = main.ExperimentalMenu) # ... and, below it, a menu item to subscribe to a RSS feed. blocks.MenuItem.update(parcel, "newFeedChannel", blockName = "newFeedChannel", title = _(u"&Create new feed channel..."), event = addFeedCollectionEvent, eventsForNamedLookup = [addFeedCollectionEvent], parentBlock = feedsMenu, ) # The hierarchy of UI elements for the FeedItem detail view feedItemRootBlocks = [ # The markup bar detail.MarkupBar, detail.makeSpacer(parcel, height=6, position=0.01).install(parcel), # Author area detail.makeArea(parcel, "AuthorArea", position=0.19, childBlocks = [ detail.makeLabel(parcel, _(u"author"), borderTop=2), detail.makeSpacer(parcel, width=8), #field("AuthorAttribute", title=u"author"), detail.makeEditor(parcel, "author", viewAttribute=u"author", border=RectType(0,2,2,2), readOnly=True), ] ).install(parcel), # Category detail.makeArea(parcel, "CategoryArea", position=0.2, childBlocks = [ detail.makeLabel(parcel, _(u"category"), borderTop=2), detail.makeSpacer(parcel, width=8), detail.makeEditor(parcel, "category", viewAttribute=u"category", border=RectType(0,2,2,2), readOnly=True), ] ).install(parcel), # URL detail.makeArea(parcel, "LinkArea", position=0.3, childBlocks = [ detail.makeLabel(parcel, _(u"link"), borderTop=2), detail.makeSpacer(parcel, width=8), detail.makeEditor(parcel, "link", viewAttribute=u"link", border=RectType(0,2,2,2), readOnly=True), ], ).install(parcel), # Date area detail.makeArea(parcel, "DateArea", position=0.4, childBlocks = [ detail.makeLabel(parcel, _(u"date"), borderTop=2), detail.makeSpacer(parcel, width=8), detail.makeEditor(parcel, "date", viewAttribute=u"date", border=RectType(0,2,2,2), readOnly=True, stretchFactor=0.0, size=SizeType(90, -1)), ], ).install(parcel), detail.makeSpacer(parcel, height=7, position=0.8999).install(parcel), FeedItemDetail.update(parcel, "ItemBodyArea", position=0.9, blockName="articletext", size=SizeType(100,50), minimumSize=SizeType(100,50), ), ] # The BranchSubtree ties the blocks to our FeedItem"s Kind. detail.makeSubtree(parcel, FeedItem, feedItemRootBlocks)
def makeMainView(parcel): repositoryView = parcel.itsView globalBlocks = schema.ns("osaf.framework.blocks", repositoryView) main = schema.ns("osaf.views.main", repositoryView) app_ns = schema.ns("osaf.app", repositoryView) pim_ns = schema.ns("osaf.pim", repositoryView) # these reference each other... ugh! RTimer = ReminderTimer.template('ReminderTimer').install(parcel) main.ReminderTime.destinationBlockReference = RTimer # Default size for Chandler's main window # Note: (1024,720) is arguably better with the current design of the toolbar but # this has the bad side effect of starting Chandler "full screen" on some laptops with small # screens which is against Apple GUI Guidelines as reported in bug 6503. # So we're moving to a smaller default size. See bug 4718 for complete discussion. defaultChandlerSize = SizeType (970, 685) SidebarBranchPointDelegateInstance = SidebarBranchPointDelegate.update( parcel, 'SidebarBranchPointDelegateInstance', calendarTemplatePath = 'osaf.views.main.CalendarSummaryViewTemplate', dashboardTemplatePath = 'osaf.views.main.DashboardSummaryViewTemplate', searchResultsTemplatePath = 'osaf.views.main.SearchResultsViewTemplate') IconButton = SSSidebarIconButton.update( parcel, 'IconButton', buttonName = 'Icon', buttonOffsets = [0,21,19]) SharingButton = SSSidebarSharingButton.update( parcel, 'SharingIcon', buttonName = 'SharingIcon', buttonOffsets = [-17,-1,16]) sidebarSelectionCollection = pim.IndexedSelectionCollection.update( parcel, 'sidebarSelectionCollection', source = app_ns.sidebarCollection) initialSelectedCollection = pim_ns.allCollection if len(app_ns.sidebarCollection) > 4: initialSelectedCollection = list(app_ns.sidebarCollection)[4] else: initialSelectedCollection = pim_ns.allCollection Sidebar = SidebarBlock.template( 'Sidebar', characterStyle = globalBlocks.SidebarRowStyle, columns = [Column.update(parcel, 'SidebarColName', heading = u'', scaleColumn = wx.grid.Grid.GRID_COLUMN_SCALABLE, attributeName = u'displayName')], scaleWidthsToFit = True, rowHeight = 19, border = RectType(0, 0, 4, 0), editRectOffsets = [22, -17, 0], buttons = [IconButton, SharingButton], contents = sidebarSelectionCollection, elementDelegate = 'osaf.views.main.SideBar.SidebarElementDelegate', hideColumnHeadings = True, defaultEditableAttribute = u'displayName', filterClass = MissingClass, disallowOverlaysForFilterClasses = [MissingClass, osaf.pim.mail.MailStamp, osaf.pim.tasks.TaskStamp], contextMenu = "SidebarContextMenu", ).install(parcel) Sidebar.contents.selectItem(initialSelectedCollection) miniCal = MiniCalendar.template( 'MiniCalendar', contents = pim_ns.allCollection, calendarContainer = None, stretchFactor = 0.0).install(parcel) # customize for Linux, where toolbar items are extra-wide if wx.Platform != '__WXGTK__': quickEntryWidth = 440 else: quickEntryWidth = 350 appBarBlocks = [ ToolBarItem.template('ApplicationBarAllButton', event = main.ApplicationBarAll, bitmap = 'ApplicationBarAll.png', title = _(u"All"), selected = True, toolBarItemKind = 'Radio', helpString = _(u'View all items')), ToolBarItem.template('ApplicationBarTaskButton', event = main.ApplicationBarTask, bitmap = 'ApplicationBarTask.png', title = _(u'Starred'), toolBarItemKind = 'Radio', helpString = _(u'View starred')), ToolBarItem.template('ApplicationBarEventButton', event = main.ApplicationBarEvent, bitmap = 'ApplicationBarEvent.png', title = _(u'Calendar'), toolBarItemKind = 'Radio', helpString = _(u'View events')), ToolBarItem.template('ApplicationBarSyncButton', event = main.SyncAll, bitmap = 'ApplicationBarSync.png', title = _(u'Sync'), helpString = _(u'Sync all shared collections and download new messages')), ToolBarItem.template('ApplicationBarQuickEntry', event = main.QuickEntry, text = u"", # text value displayed in the control toolBarItemKind = 'QuickEntry', size = SizeType (quickEntryWidth,-1), helpString = _(u"Create new note.")), ToolBarItem.template('TriageButton', event = main.Triage, title = _(u"Clean up"), bitmap = 'ApplicationBarTriage.png', helpString = _(u'Sort items by triage status')), SendToolBarItem.template('ApplicationBarSendButton', event = main.SendShareItem, bitmap = 'ApplicationBarSend.png', title = messages.SEND, viewAttribute='modifiedFlags', helpString = _(u'Send selected message')), ] ApplicationBar = ToolBar.template( 'ApplicationBar', stretchFactor = 0.0, toolSize = SizeType(32, 32), buttonsLabeled = True, separatorWidth = 20, childBlocks = appBarBlocks ) # ToolBar ApplicationBar MainViewInstance = MainView.template( 'MainView', size = defaultChandlerSize, orientationEnum='Vertical', eventBoundary = True, bufferedDraw = True, # This does not require localization displayName = u'Chandler\'s MainView', eventsForNamedLookup=[ main.RequestSelectSidebarItem, main.SendMail, main.SelectedDateChanged, main.DayMode, main.WeekStartChanged, main.ApplicationBarEvent, main.ApplicationBarTask, main.ApplicationBarAll, main.DisplayMailMessage, main.EditItems, ], childBlocks = [ main.MenuBar, main.SidebarContextMenu, main.ItemContextMenu, main.DragAndDropTextCtrlContextMenu, StatusBar.template('StatusBar'), ReminderTimer.template('ReminderTimer', event = main.ReminderTime, contents=pim_ns.allReminders), ApplicationBar, SplitterWindow.template('SidebarSplitterWindow', border = RectType(4, 0, 0, 0), splitPercentage = 0.15234375, orientationEnum = 'Vertical', splitController = miniCal, childBlocks = [ SplitterWindow.template('SidebarContainer', stretchFactor = 0.0, border = RectType(0, 0, 0, 4.0), splitPercentage = 0.42, splitController = miniCal, childBlocks = [ Sidebar, BoxContainer.template('PreviewAndMiniCalendar', orientationEnum = 'Vertical', childBlocks = [ PreviewArea.template('PreviewArea', contents = pim_ns.allCollection, calendarContainer = None, timeCharacterStyle = \ CharacterStyle.update(parcel, 'PreviewTimeStyle', fontSize = 10, fontStyle = 'bold'), eventCharacterStyle = \ CharacterStyle.update(parcel, 'PreviewEventStyle', fontSize = 11), linkCharacterStyle = \ CharacterStyle.update(parcel, 'PreviewLinkStyle', fontSize = 11, fontStyle = 'underline'), stretchFactor = 0.0, miniCalendar = miniCal), miniCal ]) # BoxContainer PreviewAndMiniCalendar ]), # SplitterWindow SidebarContainer SidebarBranchPointBlock.template('SidebarBranchPoint', delegate = SidebarBranchPointDelegateInstance, detailItem = initialSelectedCollection, selectedItem = initialSelectedCollection, detailItemCollection = initialSelectedCollection, setFocus = True), ]) # SplitterWindow SidebarSplitterWindow ]).install(parcel) # MainViewInstance MainView MainBranchPointDelegate = BranchPointDelegate.update(parcel, 'MainBranchPointDelegate') MainBranchPointBlock = BranchPointBlock.template( 'MainBranchPointBlock', detailItem = MainViewInstance, selectedItem = MainViewInstance, childBlocks = [MainViewInstance], delegate = MainBranchPointDelegate).install(parcel) FrameWindow.update( parcel, 'MainViewRoot', blockName = 'MainViewRoot', windowTitle = u"Chandler", size = defaultChandlerSize, eventBoundary=True, views = {'MainView' : MainViewInstance}, theActiveView = MainViewInstance, childBlocks = [MainBranchPointBlock]) # Add certstore UI schema.synchronize(repositoryView, "osaf.framework.certstore.blocks") return MainViewInstance
def installParcel(parcel, oldVersion=None): blocks = schema.ns("osaf.framework.blocks", parcel) main = schema.ns("osaf.views.main", parcel) # The following trick finds the location of the directory containing # this file. This allows us to move the parcel to a new location without # editing any code in it. certstore = schema.ns(__name__[:__name__.rfind('.')], parcel) detail = schema.ns("osaf.views.detail", parcel) certificateCollection = KindCollection.update( parcel, 'CertificateStore', displayName = _(u"Certificate Store"), kind = certstore.Certificate.getKind(parcel.itsView), recursive = True) #setting the preferredClass to MissingClass is a hint to display it in the All View UserCollection (certificateCollection).preferredClass = MissingClass addCertificateToSidebarEvent = Block.AddToSidebarEvent.update( parcel, 'addCertificateToSidebarEvent', blockName = 'addCertificateToSidebarEvent', item = certificateCollection, copyItems = False, disambiguateDisplayName = False) certMenu = blocks.Menu.update( parcel, "CertificateTestMenu", blockName = "CertificateTestMenu", title = _(u"&Certificates"), parentBlock = main.ToolsMenu) blocks.MenuItem.update( parcel, "CertificateView", blockName = "CertificateView", title = _(u"&Manage Certificates"), event = addCertificateToSidebarEvent, eventsForNamedLookup = [addCertificateToSidebarEvent], parentBlock = certMenu, ) # Import importCertificateEvent = ImportCertificateEvent.update( parcel, 'importCertificateEvent', blockName = 'importCertificateEvent', collection = certificateCollection, collectionAddEvent = addCertificateToSidebarEvent, classParameter = certstore.Certificate) blocks.MenuItem.update( parcel, "CertificateImport", blockName = "CertificateImport", title = _(u"&Import Certificate..."), event = importCertificateEvent, eventsForNamedLookup = [importCertificateEvent], parentBlock = certMenu, ) purposeArea = detail.makeArea(parcel, "PurposeArea", position = 0.1, childBlocks = [ detail.makeLabel(parcel, _(u'purpose')), detail.makeSpacer(parcel, width=8), detail.makeEditor(parcel, 'PurposeAttribute', viewAttribute=u'purpose', stretchFactor=0.0, size=SizeType(60, -1) )]).install(parcel) trustArea = detail.makeArea(parcel, "TrustArea", position = 0.2, childBlocks = [ detail.makeLabel(parcel, _(u"trust")), detail.makeSpacer(parcel, width=8), detail.makeEditor(parcel, "TrustAttribute", viewAttribute="trust", stretchFactor=0.0, size=SizeType(60, -1) )]).install(parcel) fingerprintArea = detail.makeArea(parcel, "FingerprintArea", position = 0.3, childBlocks = [ detail.makeLabel(parcel, _(u"fingerprint")), detail.makeSpacer(parcel, width=8), detail.makeEditor(parcel, "FingerprintLabel", viewAttribute=u"fingerprint", stretchFactor = 0, size=SizeType(180, -1) )]).install(parcel) fingerprintAlgArea = detail.makeArea(parcel, "FingerprintAlgArea", position = 0.4, childBlocks = [ detail.makeLabel(parcel, _(u"algorithm")), detail.makeSpacer(parcel, width=8), detail.makeEditor(parcel, "FingerprintAlgLabel", viewAttribute=u"fingerprintAlgorithm", stretchFactor = 0, size=SizeType(60, -1) )]).install(parcel) #XXX [i18n] Rather than getting all as text which cannot be localized, #XXX [i18n] make a field for each attribute in the certificate. These #XXX [i18n] can be localized easily. There is one blocker: there are a lot #XXX [i18n] of fields that should only appear if the cert has that field, #XXX [i18n] but there does not seem to be a way to implement that yet. asTextEditor = detail.makeEditor(parcel, 'AsTextAttribute', position = 0.9, viewAttribute=u'asTextAsString', presentationStyle={'lineStyleEnum': 'MultiLine' }, ).install(parcel) detail.makeSubtree(parcel, certstore.Certificate, [ detail.MarkupBar, detail.makeSpacer(parcel, height=6, position=0.01).install(parcel), purposeArea, trustArea, fingerprintArea, fingerprintAlgArea, asTextEditor, ])
def installParcel(parcel, version=None): controller = AmazonController.update(parcel, "controller") blocks = schema.ns('osaf.framework.blocks', parcel) main = schema.ns('osaf.views.main', parcel) detail = schema.ns('osaf.views.detail', parcel) amazonMenu = blocks.Menu.update(parcel, 'AmazonDemoMenu', blockName = 'AmazonDemoMenu', title = _(u'Ama&zon'), helpString = _(u'Download wishlists from Amazon'), childrenBlocks = [ ], parentBlock = main.ExperimentalMenu) blocks.MenuItem.update(parcel, "NewAmazonCollection", blockName = "NewAmazonCollectionMenu", title = _(u"Amazon &Keyword Search..."), event = blocks.BlockEvent.update(parcel, "NewAmazonCollectionEvent", blockName = "NewAmazonCollection", dispatchEnum = "SendToBlockByReference", destinationBlockReference = controller, commitAfterDispatch = True, ), eventsForNamedLookup = [parcel["NewAmazonCollectionEvent"]], parentBlock = amazonMenu, ) blocks.MenuItem.update(parcel, "NewAmazonWishList", blockName = "NewAmazonWishListMenu", title = _(u"Amazon &Wish List Search..."), event = blocks.BlockEvent.update(parcel, "NewAmazonWishListEvent", blockName = "NewAmazonWishList", dispatchEnum = "SendToBlockByReference", destinationBlockReference = controller, commitAfterDispatch = True, ), eventsForNamedLookup = [parcel["NewAmazonWishListEvent"]], parentBlock = amazonMenu, ) makeSubtree(parcel, AmazonItem, [ detail.MarkupBar, AmazonDetailBlock.update(parcel, "amazonDetail", blockName = "amazonDetail", size = SizeType(100,50), minimumSize = SizeType(100,50), ), ]) DisplayNamesItem.update(parcel, "displayNames", namesDictionary = {'ProductName': _(u'Product Name'), 'ProductDescription': _(u'Product Description'), 'Author': _(u'Author(s)'), 'Media': _(u'Media'), 'ReleaseDate': _(u'Release Date'), 'ImageURL': _(u'image path'), 'ProductURL': _(u'product url'), 'NewPrice': _(u'New Price'), 'UsedPrice': _(u'Used Price'), 'Availability': _(u'Availability'), 'Manufacturer': _(u'Manufacturer'), 'AverageCustomerRating': _(u'Average Customer Review'), 'NumberOfReviews': _(u'Number of people who reviewed the item')}) LicenseTask.update(parcel, "licenseTask", run_at_startup=True, interval=timedelta(days=1))
def makeNoteSubtree(parcel, oldVersion): """ Build the subtree (and related stuff) for Note. """ blocks = schema.ns("osaf.framework.blocks", parcel.itsView) bylineArea = \ makeArea(parcel, 'BylineArea', baseClass=BylineAreaBlock, childBlocks=[ makeEditor(parcel, 'BylineBlock', baseClass=BylineAEBlock, viewAttribute='byline', presentationStyle={'format' : 'static'})], position=0.4, border=RectType(0, 6, 6, 6)).install(parcel) errorArea = \ makeArea(parcel, 'ErrorArea', baseClass=ErrorAEBlock, childBlocks=[ makeEditor(parcel, 'ErrorArea', viewAttribute='error', presentationStyle={'format' : 'static'})], position=0.4, border=RectType(0, 0, 6, 6)).install(parcel) # First, the headline AEBlock and the area it sits in headlineAEBlock = makeEditor(parcel, 'HeadlineBlock', viewAttribute=u'displayName', characterStyle=blocks.BigTextStyle, presentationStyle={ 'sampleText': _(u'title'), 'editInPlace': True }) headlineArea = \ makeArea(parcel, 'HeadlineArea', childBlocks = [ makeSpacer(parcel, SizeType(0,22)), headlineAEBlock], position=0.5, border=RectType(0,6,0,6)).install(parcel) # Next, three rows of reminder stuff: # alarm {none/before/after/custom popup} # [units] {minutes/hours/days popup} # [date] at [time] reminderTypeArea = \ makeArea(parcel, 'ReminderTypeArea', baseClass=ReminderTypeAreaBlock, childBlocks=[ makeLabel(parcel, _(u'alar&m'), borderTop=5), makeSpacer(parcel, width=8), makeEditor(parcel, 'EditReminderType', baseClass=ReminderAEBlock, viewAttribute=pim.Remindable.reminders.name, presentationStyle={ 'format': 'reminderType' }, stretchFactor=0.0, minimumSize=SizeType(100, -1))], position=0.81).install(parcel) reminderRelativeArea = \ makeArea(parcel, 'ReminderRelativeArea', baseClass=ReminderRelativeAreaBlock, childBlocks=[ makeLabel(parcel, u'', borderTop=5), makeSpacer(parcel, width=8), makeEditor(parcel, 'EditReminderUnits', baseClass=ReminderAEBlock, viewAttribute=pim.EventStamp.userReminderInterval.name, presentationStyle={ 'format': 'reminderUnits' }, stretchFactor=0.0, size=SizeType(35, -1)), makeSpacer(parcel, width=4), makeEditor(parcel, 'EditReminderScale', baseClass=ReminderAEBlock, viewAttribute=pim.EventStamp.userReminderInterval.name, presentationStyle={ 'format': 'reminderScale' }, stretchFactor=0.0, minimumSize=SizeType(80, -1)), ], position=0.82).install(parcel) reminderAbsoluteArea = \ makeArea(parcel, 'ReminderAbsoluteArea', baseClass=ReminderAbsoluteAreaBlock, childBlocks=[ makeLabel(parcel, u'', borderTop=4), makeSpacer(parcel, width=8), makeEditor(parcel, 'EditReminderDate', baseClass=AbsoluteReminderAEBlock, viewAttribute=pim.Remindable.userReminderTime.name, presentationStyle={'format': 'dateOnly'}, stretchFactor=0.0, size=SizeType(75, -1)), StaticTextLabelBlock.template('ReminderAtLabel', title=_(u'at'), characterStyle=blocks.LabelStyle, textAlignmentEnum='Center', stretchFactor=0.0, border=RectType(4, 4, 0, 4)), makeEditor(parcel, 'EditReminderTime', baseClass=AbsoluteReminderAEBlock, viewAttribute=pim.Remindable.userReminderTime.name, presentationStyle={'format': 'timeOnly'}, stretchFactor=0.0, size=SizeType(85, -1)), ], position=0.82).install(parcel) # The Note AEBlock notesBlock = makeEditor(parcel, 'NotesBlock', viewAttribute=u'body', presentationStyle={ 'lineStyleEnum': 'MultiLine' }, position=0.9).install(parcel) # Appears in block appearsInArea = \ makeArea(parcel, 'AppearsInArea', viewAttribute=u'appearsIn', border=RectType(0,0,0,0), childBlocks=[ # (the label is added as part of the string for now) #makeLabel(parcel, _(u'appears in'), borderTop=2), #makeSpacer(parcel, width=8), makeEditor(parcel, 'AppearsIn', baseClass=AppearsInAEBlock, viewAttribute=u'appearsIn', border=RectType(0,2,2,2), presentationStyle={'format': 'appearsIn'})], position=0.9999).install(parcel) # A timer block we use for triggering "unread' -> 'read' unreadTimeout = BlockEvent.template( 'UnreadTimeout', dispatchEnum='SendToSender').install(parcel) unreadTimer = UnreadTimerBlock.template("unreadTimerBlock", event=unreadTimeout, position=0.999).install(parcel) # Make the ConflictBar conflictBar = makeConflictBar(parcel, oldVersion) # Finally, the subtree. Note that the actual vertical ordering will be # determined by the 'position' attribute of each thing in the list. makeSubtree(parcel, osaf.pim.Note, [ conflictBar, makeSpacer(parcel, height=10, baseClass=ConflictSpacerBlock, position=0.089999).install(parcel), parcel['MarkupBar'], makeSpacer(parcel, height=6, position=0.01).install(parcel), bylineArea, errorArea, headlineArea, makeSpacer( parcel, height=7, baseClass=ReminderSpacerBlock, position=0.809999).install(parcel), reminderTypeArea, reminderRelativeArea, reminderAbsoluteArea, makeSpacer(parcel, height=7, position=0.8999).install(parcel), makeCalendarArea(parcel, oldVersion), makeMailArea(parcel, oldVersion), notesBlock, appearsInArea, unreadTimer, ])
def makeMarkupBar(parcel, oldVersion): """ Build the markup bar. """ # Each button just sends this event to itself. buttonPressed = BlockEvent.template( 'ButtonPressed', dispatchEnum='SendToSender', commitAfterDispatch=True).install(parcel) # The buttons. triageStamp = \ DetailTriageButtonBlock.template('TriageStamp', title=messages.STAMP_TRIAGE, icon="TriageDone", helpString=messages.STAMP_TRIAGE_HELP, event=buttonPressed, viewAttribute='_triageStatus', stretchFactor=0.0) markupSpacer1 = ControlBlocks.StaticText.template('MarkupSpacer1', title=u'', stretchFactor=0.0, minimumSize=SizeType( 30, 18)) taskStamp = \ TaskStampButtonBlock.template('TaskStamp', title=messages.STAMP_TASK, icon="MarkupTask", helpString=messages.STAMP_TASK_HELP, unstampedHelpString=messages.UNSTAMP_TASK_HELP, event=buttonPressed, stretchFactor=0.0, minimumSize=SizeType(30, 18)) markupSpacer2 = ControlBlocks.StaticText.template('MarkupSpacer2', title=u'', stretchFactor=0.0, minimumSize=SizeType( 15, 18)) mailMessageButton = \ MailMessageButtonBlock.template('MailMessageButton', title=messages.STAMP_MAIL, icon="MarkupMail", helpString=messages.STAMP_MAIL_HELP, unstampedHelpString=messages.UNSTAMP_MAIL_HELP, event=buttonPressed, stretchFactor=0.0, minimumSize=SizeType(30, 18)) calendarStamp = \ CalendarStampButtonBlock.template('CalendarStamp', title=messages.STAMP_CALENDAR, icon="MarkupEvent", helpString=messages.STAMP_CALENDAR_HELP, unstampedHelpString=messages.UNSTAMP_CALENDAR_HELP, event=buttonPressed, stretchFactor=0.0, minimumSize=SizeType(30, 18)) markupSpacer3 = ControlBlocks.StaticText.template('MarkupSpacer3', title=u'', stretchFactor=0.0, minimumSize=SizeType( 30, 18)) # Per bug 8999, we're hiding this for now. #privateSwitchButton = \ #PrivateSwitchButtonBlock.template('PrivateSwitchButton', #title=messages.PRIVATE, #icon="MarkupPrivate", #helpString=messages.PRIVATE, #unstampedHelpString=messages.NOT_PRIVATE, #viewAttribute=u'private', #event=buttonPressed, #stretchFactor=0.0, #minimumSize=SizeType(30, 18)) #markupSpacer4 = ControlBlocks.StaticText.template('MarkupSpacer3', #title=u'') readOnlyIcon = \ ReadOnlyIconBlock.template('ReadOnlyIcon', title=messages.READONLY, icon="MarkupReadOnly", helpString=messages.READONLY, event=buttonPressed, stretchFactor=0.0, minimumSize=SizeType(30, 18)) markupSpacer5 = NewDetailSpacer.template('MarkupSpacer5', stretchFactor=1.0, title=u'') newDetailViewButton = NewDetailViewButton.template( 'NewDetailView', title=u'', icon='MarkupWindow', helpString=_(u'Edit Item Details in Separate Window'), stretchFactor=0.0, aligmentEnum='alignTopRight', minimumSize=SizeType(30, 18), event=schema.ns("osaf.framework.blocks", parcel.itsView).InspectSelection) markupSpacer6 = NewDetailSpacer.template( 'MarkupSpacer6', stretchFactor=0.0, title=u'', minimumSize=SizeType(8, 15), ) markupBar = ControlBlocks.ContentItemDetail.template( 'MarkupBar', childBlocks=[ triageStamp, markupSpacer1, taskStamp, markupSpacer2, mailMessageButton, calendarStamp, markupSpacer3, # hidden per bug 8999 #privateSwitchButton, #markupSpacer4, readOnlyIcon, markupSpacer5, newDetailViewButton, markupSpacer6, ], position=0.09, toolSize=SizeType(30, 18), separatorWidth=16, stretchFactor=0.0).install(parcel)
def makeCalendarArea(parcel, oldVersion): blocks = schema.ns("osaf.framework.blocks", parcel.itsView) locationArea = \ CalendarLocationAreaBlock.template('CalendarLocationArea', childBlocks=[ makeSpacer(parcel, SizeType(0, 22)), makeEditor(parcel, 'CalendarLocation', viewAttribute=pim.EventStamp.location.name, presentationStyle={'sampleText': _(u'location'), 'editInPlace': True})], stretchFactor=0.0, minimumSize=SizeType(300,10), border=RectType(0, 6, 0, 6)) if wx.Platform == "__WXMSW__": allDaySpacerWidth = 8 else: allDaySpacerWidth = 6 allDayArea = \ makeArea(parcel, 'CalendarAllDayArea', baseClass=CalendarAllDayAreaBlock, childBlocks=[ makeLabel(parcel, _(u'&all-day'), borderTop=4), makeSpacer(parcel, width=allDaySpacerWidth), makeEditor(parcel, 'EditAllDay', viewAttribute=pim.EventStamp.allDay.name, stretchFactor=0.0, minimumSize=SizeType(16,-1))]) startTimeArea = \ makeArea(parcel, 'CalendarStartTimeArea', childBlocks=[ makeLabel(parcel, _(u'sta&rts'), borderTop=4), makeSpacer(parcel, width=8), makeEditor(parcel, 'EditCalendarStartDate', viewAttribute=pim.EventStamp.startTime.name, presentationStyle={'format': 'calendarDateOnly'}, stretchFactor=0.0, size=SizeType(75, -1)), CalendarConditionalLabelBlock.template('CalendarStartAtLabel', title=_(u'at'), characterStyle=blocks.LabelStyle, textAlignmentEnum='Center', stretchFactor=0.0, border=RectType(4, 4, 0, 4)), makeEditor(parcel, 'EditCalendarStartTime', baseClass=CalendarTimeAEBlock, viewAttribute=pim.EventStamp.startTime.name, presentationStyle={'format': 'calendarTimeOnly'}, stretchFactor=0.0, size=SizeType(85, -1))]) endTimeArea = \ makeArea(parcel, 'CalendarEndTimeArea', childBlocks=[ makeLabel(parcel, _(u'en&ds'), borderTop=4), makeSpacer(parcel, width=8), makeEditor(parcel, 'EditCalendarEndDate', viewAttribute=pim.EventStamp.endTime.name, presentationStyle={'format': 'calendarDateOnly'}, stretchFactor=0.0, size=SizeType(75, -1)), CalendarConditionalLabelBlock.template('CalendarEndAtLabel', title=_(u'at'), characterStyle=blocks.LabelStyle, textAlignmentEnum='Center', stretchFactor=0.0, border=RectType(4, 4, 0, 4)), makeEditor(parcel, 'EditCalendarEndTime', baseClass=CalendarTimeAEBlock, viewAttribute=pim.EventStamp.endTime.name, presentationStyle={'format': 'calendarTimeOnly'}, stretchFactor=0.0, size=SizeType(85, -1))]) startAndEndTimeArea = \ makeArea(parcel, 'CalendarTimeArea', orientationEnum='Vertical', childBlocks=[ startTimeArea, makeSpacer(parcel, height=1), endTimeArea]) timeZoneArea = \ makeArea(parcel, 'CalendarTimeZoneArea', baseClass=CalendarTimeZoneAreaBlock, childBlocks=[ makeLabel(parcel, _(u'time &zone')), makeSpacer(parcel, width=8), makeEditor(parcel, 'EditTimeZone', baseClass=CalendarTimeZoneAEBlock, viewAttribute=pim.EventStamp.startTime.name, presentationStyle={'format': 'timeZoneOnly'}, stretchFactor=0.0, minimumSize=SizeType(180, -1))]) transparencyArea = \ makeArea(parcel, 'CalendarTransparencyArea', baseClass=CalendarTransparencyAreaBlock, childBlocks=[ makeLabel(parcel, _(u'stat&us')), makeSpacer(parcel, width=8), makeEditor(parcel, 'EditTransparency', viewAttribute=pim.EventStamp.transparency.name, presentationStyle={ 'format': 'popup', # It'd be nice to not maintain the transparency choices # separately from the enum values; currently, the # choices must match the enum's items and ordering. # @@@ XXX i18n! 'choices': [_(u'Confirmed'), _(u'Tentative'), _(u'FYI')]}, stretchFactor=0.0, minimumSize=SizeType(100, -1))]) recurrencePopupArea = \ makeArea(parcel, 'CalendarRecurrencePopupArea', baseClass=CalendarRecurrencePopupAreaBlock, childBlocks=[ makeLabel(parcel, _(u'&occurs')), makeSpacer(parcel, width=8), makeEditor(parcel, 'EditRecurrence', baseClass=CalendarFrequencyAEBlock, viewAttribute=pim.EventStamp.rruleset.name, presentationStyle={ 'format': 'occurs', # These choices must match the enumerated indexes in the # RecurrenceAttributeEditor python code 'choices': [ _(u'Once'), _(u'Daily'), _(u'Weekdays'), _(u'Weekly'), _(u'Biweekly'), _(u'Monthly'), _(u'Yearly'), _(u'Custom...') ] }, stretchFactor=0.0, minimumSize=SizeType(100, -1))]) recurrenceCustomArea = \ makeArea(parcel, 'CalendarRecurrenceCustomArea', baseClass=CalendarRecurrenceCustomAreaBlock, childBlocks=[ makeLabel(parcel, u'', borderTop=2), # leave label blank. makeSpacer(parcel, width=8), makeEditor(parcel, 'CalCustomValue', baseClass=CalendarRecurrenceAEBlock, viewAttribute=pim.EventStamp.rruleset.name, presentationStyle={'format': 'custom'}, minimumSize=SizeType(300, -1))]) recurrenceEndArea = \ makeArea(parcel, 'CalendarRecurrenceEndArea', baseClass=CalendarRecurrenceEndAreaBlock, childBlocks=[ makeLabel(parcel, _(u'ends')), makeSpacer(parcel, width=8), makeEditor(parcel, 'EditRecurrenceEnd', baseClass=CalendarUntilAEBlock, viewAttribute=pim.EventStamp.rruleset.name, presentationStyle={'format': 'ends'}, stretchFactor=0.0, size=SizeType(75, -1))]) timeDescriptionArea = \ makeArea(parcel, 'CalendarTimeDescriptionArea', childBlocks=[ makeLabel(parcel, _(u'when'), borderTop=2), makeSpacer(parcel, width=8), makeEditor(parcel, 'TimeDescription', viewAttribute=pim.EventStamp.timeDescription.name, readOnly=True, )]) timeEditArea = \ makeArea(parcel, 'CalendarTimeEditArea', orientationEnum='Vertical', childBlocks=[ allDayArea, makeSpacer(parcel, height=4), startAndEndTimeArea, makeSpacer(parcel, height=7, baseClass=CalendarTimeZoneSpacerBlock), timeZoneArea, makeSpacer(parcel, height=7, baseClass=CalendarTransparencySpacerBlock), transparencyArea, makeSpacer(parcel, height=7, baseClass=CalendarRecurrencePopupSpacerBlock), recurrencePopupArea, makeSpacer(parcel, height=1, baseClass=CalendarRecurrenceCustomSpacerBlock), recurrenceCustomArea, recurrenceEndArea, ]) return makeArea( parcel, 'CalendarDetails', baseClass=EventAreaBlock, orientationEnum='Vertical', position=0.8, childBlocks=[ locationArea, makeSpacer(parcel, height=4), #timeDescriptionArea, timeEditArea ]).install(parcel)