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

Class ParagraphOrRegionMutateAction

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

Mixin class to operate on the current paragraph, as defined by the current major mode.

Instance Methods
 
mutateParagraph(self, info)
Operate on the paragraph and return a new list of lines.
 
mutateSelection(self, s)
Change the current paragraph or highlighted region.
 
action(self, index=-1, multiplier=1)
Override this to provide the functionality of the action.

Inherited from BufferBusyActionMixin: isActionAvailable, 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

mutateParagraph(self, info)

 

Operate on the paragraph and return a new list of lines.

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

Parameters:
  • info - ParagraphInfo instance representing the currently selected paragraph
Returns:
array of lines resulting from the desired processing

mutateSelection(self, s)

 

Change the current paragraph or highlighted region.

Perform some text operation on the current line or region. If a region is active in the STC, use it after making sure that it is made up of complete lines; otherwise, use the line as defined by STC_CMD_HOME and STC_CMD_LINEEND.

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

Side effect: moves the cursor to the end of the region if it operated on the region, or to the start of the next line.

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)