Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install dolmen.menu

How to install dolmen.menu

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install dolmen.menu
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.5 Available View build log
0.4 Available View build log
0.3 Available View build log
Windows (64-bit)
0.5 Available View build log
0.4 Available View build log
0.3 Available View build log
Mac OS X (10.5+)
0.5 Available View build log
0.4 Available View build log
0.3 Available View build log
Linux (32-bit)
0.5 Available View build log
0.4 Available View build log
0.3 Available View build log
Linux (64-bit)
0.5 Available View build log
0.4 Available View build log
0.3 Available View build log
 
License
GPL
Lastest release
version 0.5 on Feb 1st, 2011

dolmen.menu aims to provide the most flexible and explicit way to create and manage menus and their entries with Grok.

You have to know that...

  • dolmen.menu only works on Python 2.6.
  • dolmen.menu does not support sub-menus, out of the box. The implementation is left to your discretion.

Components

dolmen.menu provides two components:

  • Menu : the menu implementation is based on the zope "content provider" notion and is using the grokcore.viewlet package.
  • Entry: a menu item is called an entry. It's a multi adapter that is registered for a Menu component.
Examples

A menu component:

>>> from dolmen import menu

>>> class MyMenu(menu.Menu):
...     menu.title('My nice menu')

A menu entry:

>>> class MyMenuEntry(menu.Entry):
...     menu.order(1)
...     menu.name('a_direct_entry')
...     menu.title('My Entry')
...     menu.menu(MyMenu)

Registration

In order to use base Grok component as menu entries, we get two registration ways.

class decorator

A class decorator allows you to decorate any class, in order to register it as a menu entry:

>>> import grokcore.view

>>> @menu.menuentry(MyMenu)
... class TestEntry(grokcore.view.View):
...    def render(self):
...        return u"A simple entry"
Module level martian directive

A martian directive allows you register classes you can't decorate (from a foreign package, for instance), explicitly:

>>> class SomeView(grokcore.view.View):
...    def render(self):
...        return u"I'm a view and I want to be a menu entry"

>>> menu.global_menuentry(SomeView, MyMenu, order=2)

Changes

0.5 (2011-01-31)
  • dolmen.menu now works on the latest martian. The treatment of the decorator has been deferred by the use of a module annotation. The registration is now done by a global grokker.
0.4 (2010-12-24)
  • It is now possible to define a menu context, that is different of the rendering context. This allow delegated rendering, such as Root menus or other object-specific menus.
0.3 (2010-06-04)
  • Corrected a bug where 'zope.Public' was evaluated as a "normal" permission. Now, the manager converts the permission into a CheckerPublic marker.
  • the filter method is now a generator.
0.2 (2010-03-05)
  • Changed the way to fetch the menu CSS id.
0.1 (2010-03-03)
  • Initial release.

Subscribe to package updates

Last updated Feb 1st, 2011

Download Stats

Last month:6

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.