Gnumed.wxpython.gmMacro.gmPlaceholderHandler

Package Gnumed :: Package wxpython :: Module gmMacro :: Class gmPlaceholderHandler |
[frames] | no frames]

# Class gmPlaceholderHandler

source code

               object --+
                        |
    pycommon.gmBorg.cBorg --+
                            |
                           gmPlaceholderHandler

    Returns values for placeholders.

    - patient related placeholders operate on the currently active patient
    - is passed to the forms handling code, for example

    Return values when .debug is False:
    - errors with placeholders return None
    - placeholders failing to resolve to a value return an empty string

    Return values when .debug is True:
    - errors with placeholders return an error string
    - placeholders failing to resolve to a value return a warning string

    There are several types of placeholders:

    injectable placeholders
            - they must be set up before use by set_placeholder()
            - they should be removed after use by unset_placeholder()
            - the syntax is like extended static placeholders
            - known ones are listed in known_injectable_placeholders
            - per-form ones can be used but must exist before
              the form is processed

    variant placeholders
            - those are listed in known_variant_placeholders
            - they are parsed into placeholder, data, and maximum length
            - the length is optional
            - data is passed to the handler

    Note that this cannot be called from a non-gui thread unless
    wrapped in wx.CallAfter().

Instance Methods
__init__(self, *args, **kwargs) x.__init__(...) initializes x; see help(type(x)) for signature | source code
set_placeholder(self, key=None, value=None, known_only=True) | source code
unset_placeholder(self, key=None) | source code
set_cache_value(self, key=None, value=None) | source code
unset_cache_value(self, key=None) | source code
__getitem__(self, placeholder) Map self['placeholder'] to self.placeholder. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods
Inherited from `pycommon.gmBorg.cBorg`: `__new__`

Class Variables
| escape_style = `property(lambda x: x, _set_escape_style)`
| escape_function = `property(lambda x: x, _set_escape_function)`
| ellipsis = `property(lambda x: self.__ellipsis, _set_ellipsis)`
| arguments_divider = `property(lambda x: self.__args_divider, _s`...``
| data_encoding = `property(lambda x: self.__data_encoding, _set_`...``
| placeholder_regex = `property(lambda x: default_placeholder_reg`...``
| first_pass_placeholder_regex = `property(lambda x: first_pass_p`...``
| second_pass_placeholder_regex = `property(lambda x: second_pass`...``
| third_pass_placeholder_regex = `property(lambda x: third_pass_p`...``

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, *args, **kwargs) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Overrides: object.__init__ (inherited documentation)

### __getitem__(self, placeholder) (Indexing operator) | source code
Map self['placeholder'] to self.placeholder. This is useful for replacing placeholders parsed out of documents as strings. Unknown/invalid placeholders still deliver a result but it will be glaringly obvious if debugging is enabled.

Class Variable Details

  ### arguments_divider Value:
      property(lambda x: self.__args_divider, _set_arguments_divider)

  ### data_encoding Value:
      property(lambda x: self.__data_encoding, _set_data_encoding)

  ### placeholder_regex Value:
      property(lambda x: default_placeholder_regex, lambda x: x)

  ### first_pass_placeholder_regex Value:
      property(lambda x: first_pass_placeholder_regex, lambda x: x)

  ### second_pass_placeholder_regex Value:
      property(lambda x: second_pass_placeholder_regex, lambda x: x)

  ### third_pass_placeholder_regex Value:
      property(lambda x: third_pass_placeholder_regex, lambda x: x)