def _createMenuModel(self, actionContext): #@UnusedVariable menuModel = ZMenuModel() editor = actionContext.getEditor() zblogDocument = editor.getDocument() blogInfos = zblogDocument.getBlogInfoList() for blogInfo in blogInfos: blog = getBlogFromBlogInfo(blogInfo) menuModel.addMenuItemWithAction(blog.getName(), 0, ZBlogPostViewOnlineAction(blog.getId())) return menuModel
def _createMenuModel(self, actionContext): #@UnusedVariable menuModel = ZMenuModel() editor = actionContext.getEditor() zblogDocument = editor.getDocument() blogInfos = zblogDocument.getBlogInfoList() for blogInfo in blogInfos: blog = getBlogFromBlogInfo(blogInfo) menuModel.addMenuItemWithAction( blog.getName(), 0, ZBlogPostViewOnlineAction(blog.getId())) return menuModel
def onPanelMenuButton(self, event): menuModel = ZMenuModel() for panelName in self.detailsContainer.getPanelNames(): action = ZSummarySwitchDetailAction(self, panelName) menuId = menuModel.addMenuItemWithAction(panelName, 0, action) menuModel.setMenuItemCheckbox(menuId, True) menu = ZModelBasedMenu(menuModel, None, self) h = self.panelMenuButton.GetSizeTuple()[1] x = self.panelMenuButton.GetPositionTuple()[0] pos = wx.Point(x, h) self.PopupMenu(menu, pos) event.Skip()
def _createImportMenuModel(self): menuModel = ZMenuModel() zbwId = menuModel.addMenuItemWithAction(_extstr(u"manager.FromZBW"), 0, ZImportFromZBWAction(self, self.model), None) #$NON-NLS-1$ menuModel.setMenuItemBitmap(zbwId, getResourceRegistry().getBitmap(u"images/common/zbw/BlogWriter.ico")) #$NON-NLS-1$ wlwId = menuModel.addMenuItemWithAction(_extstr(u"manager.FromWLW"), 0, ZImportFromWLWAction(self, self.model), None) #$NON-NLS-1$ menuModel.setMenuItemBitmap(wlwId, getResourceRegistry().getBitmap(u"images/common/wlw/LiveWriter.png")) #$NON-NLS-1$ return menuModel
def _createChoiceMenuModel(self): model = ZMenuModel() for (label, bitmap, id) in self.choices: action = ZTextBoxChoiceAction(id) menuId = model.addMenuItemWithAction(label, 0, action) model.setMenuItemCheckbox(menuId, True) model.setMenuItemBitmap(menuId, bitmap) return model
def _createContextMenuModel(self): menuModel = ZMenuModel() validSizes = self.contentProvider.getToolBitmapSizes() if len(validSizes) > 1: subMenuID = menuModel.addMenu(_extstr(u"toolbar.ToolSize"), 0) #$NON-NLS-1$ for vsize in validSizes: menuID = menuModel.addMenuItemWithAction( u"%d x %d" % (vsize, vsize), 0, ZResizeToolbarAction(vsize), subMenuID) #$NON-NLS-1$ menuModel.setMenuItemCheckbox(menuID, True) menuModel.addSeparator(0) menuID = menuModel.addMenuItemWithAction( _extstr(u"toolbar.ShowText"), 0, ZShowTextMenuAction()) #$NON-NLS-1$ menuModel.setMenuItemCheckbox(menuID, True) return menuModel