/usr/share/pyshared/mayavi/action/modules.py is in mayavi2 4.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | """Actions to start various modules.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2008, Enthought, Inc.
# License: BSD Style.
import new
# Local imports.
from mayavi.core.registry import registry
from mayavi.core.metadata import ModuleMetadata
from mayavi.core.pipeline_info import PipelineInfo
from mayavi.action.filters import FilterAction
######################################################################
# `ModuleAction` class.
######################################################################
class ModuleAction(FilterAction):
###########################################################################
# 'Action' interface.
###########################################################################
def perform(self, event):
""" Performs the action. """
callable = self.metadata.get_callable()
obj = callable()
mv = self.mayavi
mv.add_module(obj)
mv.engine.current_selection = obj
######################################################################
# `AddModuleManager` class.
######################################################################
class AddModuleManager(ModuleAction):
""" An action that adds a ModuleManager to the tree. """
tooltip = "Add a ModuleManager to the current source/filter"
description = "Add a ModuleManager to the current source/filter"
metadata = ModuleMetadata(id="AddModuleManager",
class_name="mayavi.core.module_manager.ModuleManager",
menu_name="&Add ModuleManager",
tooltip="Add a ModuleManager to the current source/filter",
description="Add a ModuleManager to the current source/filter",
input_info = PipelineInfo(datasets=['any'],
attribute_types=['any'],
attributes=['any'])
)
def perform(self, event):
""" Performs the action. """
from mayavi.core.module_manager import ModuleManager
mm = ModuleManager()
mv = self.mayavi
mv.add_module(mm)
mv.engine.current_selection = mm
######################################################################
# Creating the module actions automatically.
for module in registry.modules:
d = {'tooltip': module.tooltip,
'description': module.desc,
'metadata': module}
action = new.classobj(module.id, (ModuleAction,), d)
globals()[module.id] = action
|