Templates for configuring program function

Every program definition must inherit from the ProgDef class

class Progs.template.ProgDef(*args, **kwargs)

Template for program definitions.

Program definitions should inherit from this class and should define settings in the config dictionary (see already written definitions for example implementation).

If a program definition needs special handling, you may override the set() method.


Save the file and run pre/post-save hooks.

find_rules(key, rules)

Return an array of rule objects that contain key.


Generate and print a diff of the change in config file.


Returns the config rule tree.

Can be overridden if necessary


Return the path to use for configuration.

This method must be overridden.


Check if filebuffer exists. If not, one is created.


Get file path from Settings. If not found there, get from default path.


Returns the name of the program. Class name by default.

Can be overridden if necessary

get_proper_buffer(initial_buffer, rule_obj)

Return rule_objs scope portion of initial_buffer.

init(*args, **kwargs)

Define rules for configuration.

This method must set the self.config variable, which must be of type common.ConfigElement. Usage is defined under the Common and Example sections.

This method must be overridden.


Check if the program is installed on the target system.

Returns a boolean.

This method must be overridden.


Save the old contents to a backup file

narrow_buffer(section_obj, initial_buffer, recur=False, recpos=0, recdepth=0, excludes=None)

Return a tuple for the start and end of the scope.

Returns a tuple the start and end positions of the scope within the initial_buffer: (startpos, endpos).

Exclude rule format: (depth, startpos, endpos).


Pre-init defaults. If you absolutely have to override __init__ then you must at least include pre_init in __init__.


Save the file.

This method must be overridden.

set(key, value, section)

Set value to key.

Can be overridden if there are specific needs.