Package peppy :: Package actions :: Module base :: Class RegionMutateAction
[frames] | no frames]

Class RegionMutateAction

           object --+        
                    |        
BufferBusyActionMixin --+    
                        |    
       object --+       |    
                |       |    
 debug.debugmixin --+   |    
                    |   |    
         SelectAction --+    
                        |    
   TextModificationAction --+
                            |
                           RegionMutateAction
Known Subclasses:

Mixin class to operate only on a selected region.

Instance Methods
 
isActionAvailable(self)
The action is only available if a region is selected.
 
mutate(self, txt)
Operate on specified text and return new text.
 
mutateSelection(self, s)
Change the highlighted region.
 
action(self, index=-1, multiplier=1)
Override this to provide the functionality of the action.

Inherited from BufferBusyActionMixin: isEnabled

Inherited from 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

Inherited from TextModificationAction: worksWithMajorMode

Inherited from SelectAction: getHelp, setAcceleratorText

Inherited from debug.debugmixin: dprint

Class Variables

Inherited from SelectAction: alias, default_menu, default_toolbar, global_id, icon, key_bindings, keyboard, name, stock_id, tooltip

Inherited from debug.debugmixin: debuglevel

Properties

Inherited from object: __class__

Method Details

isActionAvailable(self)

 

The action is only available if a region is selected.

Overrides: BufferBusyActionMixin.isActionAvailable

mutate(self, txt)

 

Operate on specified text and return new text.

Method designed to be overridden by subclasses to provide the text operation desired by the subclass.

Parameters:
  • txt - input text
Returns:
text resulting from the desired processing

mutateSelection(self, s)

 

Change the highlighted region.

Perform some text operation on the region. If a region is not active in the STC, the action will not be performed.

The operation is performed by the mutate method, which subclasses will override to provide the functionality.

Side effect: moves the cursor to the end of the region.

Parameters:
  • s - styled text control

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: SelectAction.action
(inherited documentation)