def __init__(self, **traits): """ Creates a new application window. """ # Base class constructor. super(MainWindow, self).__init__(**traits) # Add a menu bar. self.menu_bar_manager = MenuBarManager( MenuManager( Action(name='E&xit', on_perform=self.close), name='&File', )) # Add a menu bar at each location. self.add_tool_bar( ToolBarManager(Action(name='Foo'), orientation='horizontal')) self.add_tool_bar(ToolBarManager(Action(name='Bar'), orientation='horizontal'), location='bottom') self.add_tool_bar(ToolBarManager(Action(name='Baz'), orientation='vertical'), location='left') self.add_tool_bar(ToolBarManager(Action(name='Buz'), orientation='vertical'), location='right') return
def _management_actions_default(self): """Return the management actions to manage the policy.""" actions = [] perm = ManagePolicyPermission() act = Action(name='&Role Definitions...', on_perform=role_definition) actions.append(SecureProxy(act, permissions=[perm], show=False)) act = Action(name='&Role Assignments...', on_perform=role_assignment) actions.append(SecureProxy(act, permissions=[perm], show=False)) return actions
def __init__(self, **traits): """ Creates a new application window. """ # Base class constructor. super(MainWindow, self).__init__(**traits) # Add a menu bar. self.menu_bar_manager = MenuBarManager( MenuManager(Action(name='&Open...', on_perform=self._open_file), Action(name='&Save', on_perform=self._save_file), Action(name='E&xit', on_perform=self.close), name='&File')) return
def __init__(self, **traits): """ Creates a new application window. """ # Base class constructor. super(MainWindow, self).__init__(**traits) # Add a menu bar. self.menu_bar_manager = MenuBarManager( MenuManager( Action(name='Start Timer', on_perform=self._start_timer), Action(name='Stop Timer', on_perform=self._stop_timer), Action(name='E&xit', on_perform=self.close), name='&File', )) return
def __init__(self, **traits): """ Creates a new application window. """ # Base class constructor. super(MainWindow, self).__init__(**traits) # Create an action that exits the application. exit_action = Action(name='E&xit', on_perform=self.close) # Add a menu bar. self.menu_bar_manager = MenuBarManager( MenuManager(exit_action, name='&File')) # Add some tool bars. self.tool_bar_managers = [ ToolBarManager(exit_action, name='Tool Bar 1', show_tool_names=False), ToolBarManager(exit_action, name='Tool Bar 2', show_tool_names=False), ToolBarManager(exit_action, name='Tool Bar 3', show_tool_names=False), ] # Add a status bar. self.status_bar_manager = StatusBarManager() self.status_bar_manager.message = 'Example application window' return
def __new_person_action_default(self): """Trait initializer.""" # Create the action and secure it with the appropriate permission. act = Action(name='New Person', on_perform=self._new_person) act = SecureProxy(act, permissions=[NewPersonPerm]) return act
def _actions_default(self): actions = [ Group( Action(tooltip="View the Mayavi pipeline", image=ImageResource('m2', search_path=self.image_search_path), on_perform=self.show_engine, ), ), ] actions.extend(DecoratedScene._actions_default(self)) return actions
def _create_contents(self, parent): """ Creates the window contents. """ actions = [] for i in range(25): actions.append( Action(name='Foo', style='radio', image=ImageResource('document'))) tool_palette = ToolPaletteManager(*actions) return tool_palette.create_tool_palette(parent).control
def _create_action_bars(self): """ Creates the window's menu, tool and status bars. """ # Common actions. highest = Action(name='Highest', style='radio') higher = Action(name='Higher', style='radio', checked=True) lower = Action(name='Lower', style='radio') lowest = Action(name='Lowest', style='radio') self._actions = [highest, higher, lower, lowest] # Menu bar. self.menu_bar_manager = MenuBarManager( MenuManager( ExampleAction(name='Foogle'), Separator(), highest, higher, lower, lowest, Separator(), Action(name='E&xit', on_perform=self.close), name='&File', )) # Tool bar. self.tool_bar_manager = ToolBarManager(ExampleAction(name='Foo'), Separator(), ExampleAction(name='Bar'), Separator(), ExampleAction(name='Baz'), Separator(), highest, higher, lower, lowest) # Status bar. self.status_bar_manager = StatusBarManager() return
def _management_actions_default(self): """Return the list of management actions.""" from enthought.permissions.secure_proxy import SecureProxy user_db = self.user_db actions = [] perm = ManageUsersPermission() if user_db.can_add_user: act = Action(name="&Add a User...", on_perform=user_db.add_user) actions.append(SecureProxy(act, permissions=[perm], show=False)) if user_db.can_modify_user: act = Action(name="&Modify a User...", on_perform=user_db.modify_user) actions.append(SecureProxy(act, permissions=[perm], show=False)) if user_db.can_delete_user: act = Action(name="&Delete a User...", on_perform=user_db.delete_user) actions.append(SecureProxy(act, permissions=[perm], show=False)) return actions
def __init__(self, **traits): """ Creates a new application window. """ # Base class constructor. super(MainWindow, self).__init__(**traits) # Add a menu bar. self.menu_bar_manager = MenuBarManager( MenuManager( Action(name='E&xit', on_perform=self.close), name = '&File', ), MDIWindowMenu(self) ) # Set the size of the window self.size = (640, 480) return
def __exit_action_default(self): """ Trait initialiser. """ return Action(name="E&xit", on_perform=self.workbench.exit)
def _actions_default(self): return [ Group( Action( image=ImageResource( '16x16/x-axis', search_path=[self._get_image_path()], ), tooltip="View along the -X axis", on_perform=self.x_minus_view, ), Action( image=ImageResource( '16x16/x-axis', search_path=[self._get_image_path()], ), tooltip="View along the +X axis", on_perform=self.x_plus_view, ), Action( image=ImageResource( '16x16/y-axis', search_path=[self._get_image_path()], ), tooltip="View along the -Y axis", on_perform=self.y_minus_view, ), Action( image=ImageResource( '16x16/y-axis', search_path=[self._get_image_path()], ), tooltip="View along the +Y axis", on_perform=self.y_plus_view, ), Action( image=ImageResource( '16x16/z-axis', search_path=[self._get_image_path()], ), tooltip="View along the -Z axis", on_perform=self.z_minus_view, ), Action( image=ImageResource( '16x16/z-axis', search_path=[self._get_image_path()], ), tooltip="View along the +Z axis", on_perform=self.z_plus_view, ), Action( image=ImageResource( '16x16/isometric', search_path=[self._get_image_path()], ), tooltip="Obtain an isometric view", on_perform=self.isometric_view, ), ), Group( Action( image=ImageResource( '16x16/parallel', search_path=[self._get_image_path()], ), tooltip='Toggle parallel projection', style="toggle", on_perform=self._toggle_projection, checked=self.parallel_projection, ), Action( image=ImageResource( '16x16/origin_glyph', search_path=[self._get_image_path()], ), tooltip='Toggle axes indicator', style="toggle", enabled=(self.marker is not None), on_perform=self._toggle_axes, checked=self.show_axes, ), Action( image=ImageResource( '16x16/fullscreen', search_path=[self._get_image_path()], ), tooltip= 'Full Screen (press "q" or "e" or ESC to exit fullscreen)', style="push", on_perform=self._full_screen_fired, ), ), Group( Action( image=ImageResource( '16x16/save', search_path=[self._get_image_path()], ), tooltip="Save a snapshot of this scene", on_perform=self._save_snapshot, ), Action( image=ImageResource( '16x16/configure', search_path=[self._get_image_path()], ), tooltip='Configure the scene', style="push", on_perform=self._configure_scene, ), ), ]
def __new_person_action_default(self): """ Trait initializer. """ return Action(name='New Person', on_perform=self._new_person)
# Description: <Enthought pyface package component> #------------------------------------------------------------------------------ # Standard library imports. import os, sys # Put the Enthought library on the Python path. sys.path.append(os.path.abspath(r'..\..\..')) # Local imports. from enthought.pyface.action.api import Action from enthought.pyface.action.api import Group, MenuManager, Separator file_menu = MenuManager( Group( Action(name='New Project...'), Action(name='Open Project...'), id = 'OpenGroup', ), Group( Action(name='Close Project'), Action(name='Close Active Editor'), id = 'CloseGroup' ), Group( Action(name='Export to HTML...'), Action(name='Print...'),