Exemple #1
0
def MakePie(setToolAction):

    ########################################################################
    # Make pie menus.

    pie = piemenu.PieMenu(header="Cell Tools",
                          fixedRadius=50,
                          neutralDescription="Select a Cell tool.")

    ########################################################################
    # Populate pie menus.

    for params in (
        {
            'pie': pie,
            'description': 'Cell 0',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/icquery.png',
            'iconHilite': 'images/icqueryhi.png',
            'action': lambda item: setToolAction('0'),
        },
        {
            'pie': pie,
            'description': 'Cell 1',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/icquery.png',
            'iconHilite': 'images/icqueryhi.png',
            'action': lambda item: setToolAction('1'),
        },
    ):

        piemenu.PieItem(*(), **params)

    return pie
def MakePie(setToolAction):

    ########################################################################
    # Make pie menus.

    # top
    topPie = piemenu.PieMenu(header="Micropolis Menu",
                             fixedRadius=50,
                             neutralDescription="Select an option.")

    # top/tool
    toolPie = piemenu.PieMenu(
        header="Micropolis Tools",
        fixedRadius=50,
        neutralDescription=
        "Select a Micropolis editing tool,\nor the zone or build submenu.")

    # top/tool/zone
    zonePie = piemenu.PieMenu(header="Zone",
                              fixedRadius=50,
                              neutralDescription="Select a zoning tool.")

    # top/zone/build
    buildPie = piemenu.PieMenu(header="Build",
                               fixedRadius=50,
                               neutralDescription="Select a building tool.")

    # top/control
    controlPie = piemenu.PieMenu(header="Control",
                                 fixedRadius=50,
                                 neutralDescription="Select a control.")

    # top/foo
    fooPie = piemenu.PieMenu(header="Foo",
                             fixedRadius=50,
                             neutralDescription="Select a foo.")

    # top/view
    viewPie = piemenu.PieMenu(header="View",
                              fixedRadius=50,
                              neutralDescription="Select a view option.")

    ########################################################################
    # Populate pie menus.

    for params in (
        {
            'pie': toolPie,
            'label': 'Zone...',
            'description': "Submenu of zoning tools.",
            'subPie': zonePie,
        },
        {
            'pie': zonePie,
            'description': 'Commercial\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/iccom.png',
            'iconHilite': 'images/micropolisEngine/iccomhi.png',
            'action': lambda item: setToolAction('Commercial'),
        },
        {
            'pie': zonePie,
            'description': 'Industrial\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icind.png',
            'iconHilite': 'images/micropolisEngine/icindhi.png',
            'action': lambda item: setToolAction('Industrial'),
        },
        {
            'pie': zonePie,
            'description': 'Police station\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icpol.png',
            'iconHilite': 'images/micropolisEngine/icpolhi.png',
            'action': lambda item: setToolAction('PoliceStation'),
        },
        {
            'pie': zonePie,
            'description': 'Query zone\ntool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icqry.png',
            'iconHilite': 'images/micropolisEngine/icqryhi.png',
            'action': lambda item: setToolAction('Query'),
        },
        {
            'pie': zonePie,
            'description': 'Fire station\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icfire.png',
            'iconHilite': 'images/micropolisEngine/icfirehi.png',
            'action': lambda item: setToolAction('FireStation'),
        },
        {
            'pie': zonePie,
            'description': 'Residential\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icres.png',
            'iconHilite': 'images/micropolisEngine/icreshi.png',
            'action': lambda item: setToolAction('Residential'),
        },
        {
            'pie': toolPie,
            'description': 'Bulldozer editing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icdozr.png',
            'iconHilite': 'images/micropolisEngine/icdozrhi.png',
            'action': lambda item: setToolAction('Bulldozer'),
        },
        {
            'pie': toolPie,
            'description': 'Road editing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icroad.png',
            'iconHilite': 'images/micropolisEngine/icroadhi.png',
            'action': lambda item: setToolAction('Road'),
        },
        {
            'pie': toolPie,
            'description': 'Eraser drawing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icersr.png',
            'iconHilite': 'images/micropolisEngine/icersrhi.png',
            'action': lambda item: setToolAction('Eraser'),
        },
        {
            'pie': toolPie,
            'label': 'Build...',
            'description': 'Submenu of building tools.',
            'subPie': buildPie,
        },
        {
            'pie': buildPie,
            'description': 'Park building tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icpark.png',
            'iconHilite': 'images/micropolisEngine/icparkhi.png',
            'action': lambda item: setToolAction('Park'),
        },

            #        {
            #            'pie': buildPie,
            #            'description': 'Forest building tool.',
            #            'loliteFillColor': None,
            #            'loliteStrokeColor': None,
            #            'linear': True,
            #            'linearDirection': 'n',
            #            'icon': 'images/micropolisEngine/icpark.png',
            #            'iconHilite': 'images/micropolisEngine/icparkhi.png',
            #            'action': lambda item: setToolAction('Forest'),
            #        },

            #        {
            #            'pie': buildPie,
            #            'description': 'Land building tool.',
            #            'loliteFillColor': None,
            #            'loliteStrokeColor': None,
            #            'linear': True,
            #            'linearDirection': 'n',
            #            'icon': 'images/micropolisEngine/icpark.png',
            #            'iconHilite': 'images/micropolisEngine/icparkhi.png',
            #            'action': lambda item: setToolAction('Land'),
            #        },

            #        {
            #            'pie': buildPie,
            #            'description': 'Water building tool.',
            #            'loliteFillColor': None,
            #            'loliteStrokeColor': None,
            #            'linear': True,
            #            'linearDirection': 'n',
            #            'icon': 'images/micropolisEngine/icpark.png',
            #            'iconHilite': 'images/micropolisEngine/icparkhi.png',
            #            'action': lambda item: setToolAction('Water'),
            #        },
        {
            'pie': buildPie,
            'description': 'Seaport building tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icseap.png',
            'iconHilite': 'images/micropolisEngine/icseaphi.png',
            'action': lambda item: setToolAction('Seaport'),
        },
        {
            'pie': buildPie,
            'description': 'Nuclear power plant\nbuilding tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icnuc.png',
            'iconHilite': 'images/micropolisEngine/icnuchi.png',
            'action': lambda item: setToolAction('NuclearPowerPlant'),
        },
        {
            'pie': buildPie,
            'description': 'Airport building tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icairp.png',
            'iconHilite': 'images/micropolisEngine/icairphi.png',
            'action': lambda item: setToolAction('Airport'),
        },
        {
            'pie': buildPie,
            'description': 'Coal power plant\nbuilding tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/iccoal.png',
            'iconHilite': 'images/micropolisEngine/iccoalhi.png',
            'action': lambda item: setToolAction('CoalPowerPlant'),
        },
        {
            'pie': buildPie,
            'description': 'Stadium building tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icstad.png',
            'iconHilite': 'images/micropolisEngine/icstadhi.png',
            'action': lambda item: setToolAction('Stadium'),
        },
        {
            'pie': toolPie,
            'description': 'Chalk drawing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icchlk.png',
            'iconHilite': 'images/micropolisEngine/icchlkhi.png',
            'action': lambda item: setToolAction('Chalk'),
        },
        {
            'pie': toolPie,
            'description': 'Rail editing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icrail.png',
            'iconHilite': 'images/micropolisEngine/icrailhi.png',
            'action': lambda item: setToolAction('Rail'),
        },
        {
            'pie': toolPie,
            'description': 'Wire editing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icwire.png',
            'iconHilite': 'images/micropolisEngine/icwirehi.png',
            'action': lambda item: setToolAction('Wire'),
        },
    ):

        piemenu.PieItem(*(), **params)

    #return topPie
    return toolPie
def NewMakePie(setToolAction):

    ########################################################################
    # Make pie menus.

    toolPie = piemenu.PieMenu(
        header="Micropolis Tools",
        fixedRadius=25,
        ringRadius=70,
        maxPieItems=(
            8,
            8,
            16,
        ),
        neutralDescription=
        "Select a Micropolis editing tool,\nor the zone or build submenu.")

    ########################################################################
    # Populate pie menus.


    for params in (

        # Inner Ring

        { # North
            'pie': toolPie,
            'description': 'Commercial\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/iccom.png',
            'iconHilite': 'images/micropolisEngine/iccomhi.png',
            'action': lambda item: setToolAction('Commercial'),
        },

        { # NorthEast
            'pie': toolPie,
            'description': 'Industrial\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icind.png',
            'iconHilite': 'images/micropolisEngine/icindhi.png',
            'action': lambda item: setToolAction('Industrial'),
        },

        { # East
            'pie': toolPie,
            'description': 'Road editing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icroad.png',
            'iconHilite': 'images/micropolisEngine/icroadhi.png',
            'action': lambda item: setToolAction('Road'),
        },

        { # SouthEast
            'pie':pie,
            'description': 'Park building tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icpark.png',
            'iconHilite': 'images/micropolisEngine/icparkhi.png',
            'action': lambda item: setToolAction('Park'),
        },

        { # South
            'pie': toolPie,
            'description': 'Bulldozer editing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icdozr.png',
            'iconHilite': 'images/micropolisEngine/icdozrhi.png',
            'action': lambda item: setToolAction('Bulldozer'),
        },

        { # SoutWest
            'pie': toolPie,
            'description': 'Wire editing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icwire.png',
            'iconHilite': 'images/micropolisEngine/icwirehi.png',
            'action': lambda item: setToolAction('Wire'),
        },

        { # West
            'pie': toolPie,
            'description': 'Rail editing tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icrail.png',
            'iconHilite': 'images/micropolisEngine/icrailhi.png',
            'action': lambda item: setToolAction('Rail'),
        },

        { # NorthWest
            'pie': toolPie,
            'description': 'Residential\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icres.png',
            'iconHilite': 'images/micropolisEngine/icreshi.png',
            'action': lambda item: setToolAction('Residential'),
        },

        # Outer Ring

        { # North
            'pie': toolPie,
            'description': 'Query zone\ntool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icqry.png',
            'iconHilite': 'images/micropolisEngine/icqryhi.png',
            'action': lambda item: setToolAction('Query'),
        },

        { # NorthWest
            'pie': toolPie,
            'description': 'Police station\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icpol.png',
            'iconHilite': 'images/micropolisEngine/icpolhi.png',
            'action': lambda item: setToolAction('PoliceStation'),
        },

        { # West
            'pie': toolPie,
            'description': 'Seaport building tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icseap.png',
            'iconHilite': 'images/micropolisEngine/icseaphi.png',
            'action': lambda item: setToolAction('Seaport'),
        },

        { # SouthWest
            'pie': toolPie,
            'description': 'Nuclear power plant\nbuilding tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icnuc.png',
            'iconHilite': 'images/micropolisEngine/icnuchi.png',
            'action': lambda item: setToolAction('NuclearPowerPlant'),
        },

        { # South
            'pie': toolPie,
            'description': 'Airport building tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icairp.png',
            'iconHilite': 'images/micropolisEngine/icairphi.png',
            'action': lambda item: setToolAction('Airport'),
        },

        { # SouthEast
            'pie': toolPie,
            'description': 'Coal power plant\nbuilding tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/iccoal.png',
            'iconHilite': 'images/micropolisEngine/iccoalhi.png',
            'action': lambda item: setToolAction('CoalPowerPlant'),
        },

        { # East
            'pie': toolPie,
            'description': 'Stadium building tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icstad.png',
            'iconHilite': 'images/micropolisEngine/icstadhi.png',
            'action': lambda item: setToolAction('Stadium'),
        },

        { # NorthEast
            'pie': toolPie,
            'description': 'Fire station\nzoning tool.',
            'loliteFillColor': None,
            'loliteStrokeColor': None,
            'icon': 'images/micropolisEngine/icfire.png',
            'iconHilite': 'images/micropolisEngine/icfirehi.png',
            'action': lambda item: setToolAction('FireStation'),
        },

    ):

        piemenu.PieItem(*(), **params)

    return toolPie