Package peppy :: Package plugins :: Module tutorial_plugin :: Class InsertHelloWorld
[frames] | no frames]

Class InsertHelloWorld

      object --+        
               |        
debug.debugmixin --+    
                   |    
actions.SelectAction --+
                       |
                      InsertHelloWorld

Simple example of an action that modifies the buffer

This is an action that depends on the current buffer being a text file, and inserts the string "Hello, world" into the text at the current position

Instance Methods
 
isEnabled(self)
Override this to provide the enable/disable state of the item.
 
action(self, index=-1, multiplier=1)
Override this to provide the functionality of the action.

Inherited from actions.SelectAction: __call__, __init__, getMenuItemName, getSubIds, getTooltip, initPostHook, initPreHook, insertIntoMenu, insertIntoToolbar, showEnable

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Methods
 
worksWithMajorMode(cls, mode)
This action requires that we're editing using something with the ability to insert a string.

Inherited from actions.SelectAction: getHelp, setAcceleratorText

Inherited from debug.debugmixin: dprint

Class Variables
  alias = 'insert-hello-world'
This alias holds an emacs style name that is used during M-X processing.
  name = 'Hello World Action'
This is the name of the menu entry as it appears in the menu bar.
  tooltip = 'Insert \'Hello, world\' at the current cursor posit...
Tooltip that is displayed when the mouse is hovering over the menu entry.
  icon = None
If there is an icon associated with this action, name it here.
  default_menu = ('&Help/Tests', -801)
The default menu location is specified here as a tuple containing the menu path (separated by / characters) and a number between 1 and 1000 representing the position within the menu.
  key_bindings = {'emacs': 'C-F9 C-F9', 'win': 'Ctrl-F9'}
Map of platform to default keybinding.

Inherited from actions.SelectAction: default_toolbar, global_id, keyboard, stock_id

Inherited from debug.debugmixin: debuglevel

Properties

Inherited from object: __class__

Method Details

worksWithMajorMode(cls, mode)
Class Method

 

This action requires that we're editing using something with the ability to insert a string.

Parameters:
  • mode - the major mode instance
Returns:
True if the action is allowed to be associated with the major mode
Overrides: actions.SelectAction.worksWithMajorMode

isEnabled(self)

 

Override this to provide the enable/disable state of the item.

The menu system will call this method before the menu is drawn (or periodically during idle time for toolbar items) to determine whether or not the item should be disabled (grayed out).

Default is to always enable the item.

Overrides: actions.SelectAction.isEnabled
(inherited documentation)

action(self, index=-1, multiplier=1)

 

Override this to provide the functionality of the action.

This method gets called when the user initiates the action, whether it be from the menu bar, toolbar, or keyboard.

Parameters:
  • index - The index of the item in the list. This is only useful for list or radio items.
  • multiplier - the multiplier supplied by the keyboard handler. The keyboard handler allows for emacs-style repeat commands. For some actions, it makes sense to allow repetition of the command. For instance, in a command that uppercases words, the multiplier could be 4, would mean that the next 4 words get uppercased. The default is 1.
Overrides: actions.SelectAction.action
(inherited documentation)

Class Variable Details

tooltip

Tooltip that is displayed when the mouse is hovering over the menu entry. If the tooltip is None, the tooltip is taken from the first line of the docstring, if it exists.

Value:
'Insert \'Hello, world\' at the current cursor position'