MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / register

Method register

web/pgadmin/utils/preferences.py:410–471  ·  view source on GitHub ↗

register Register/Refer the particular preference in this module. :param category: name of the category, in which this preference/option will be displayed. :param name: name of the preference/option :param label: Display name

(
        self, category, name, label, _type, default, **kwargs
    )

Source from the content-addressed store, hash-verified

408 return res
409
410 def register(
411 self, category, name, label, _type, default, **kwargs
412 ):
413 """
414 register
415 Register/Refer the particular preference in this module.
416
417 :param category: name of the category, in which this preference/option
418 will be displayed.
419 :param name: name of the preference/option
420 :param label: Display name of the preference
421 :param _type: [optional] Type of the options.
422 It is an optional argument, only if this
423 option/preference is registered earlier.
424 :param default: [optional] Default value of the options
425 It is an optional argument, only if this
426 option/preference is registered earlier.
427 :param min_val:
428 :param max_val:
429 :param options:
430 :param help_str:
431 :param category_label:
432 :param select: select control extra options
433 :param fields: field schema (if preference has more than one field to
434 take input from user e.g. keyboardshortcut preference)
435 :param allow_blanks: Flag specify whether to allow blank value.
436 :param disabled: Flag specify whether to disable the setting or not.
437 """
438 min_val = kwargs.get('min_val', None)
439 max_val = kwargs.get('max_val', None)
440 options = kwargs.get('options', None)
441 help_str = kwargs.get('help_str', None)
442 control_props = kwargs.get('control_props', {})
443 category_label = kwargs.get('category_label', None)
444 select = kwargs.get('select', None)
445 fields = kwargs.get('fields', None)
446 hidden = kwargs.get('hidden', None)
447 allow_blanks = kwargs.get('allow_blanks', None)
448 disabled = kwargs.get('disabled', False)
449 dependents = kwargs.get('dependents', None)
450
451 cat = self.__category(category, category_label)
452 if name in cat['preferences']:
453 return (cat['preferences'])[name]
454
455 assert label is not None, "Label for a preference cannot be none!"
456 assert _type is not None, "Type for a preference cannot be none!"
457 assert _type in (
458 'boolean', 'integer', 'numeric', 'date', 'datetime',
459 'options', 'multiline', 'switch', 'node', 'text', 'radioModern',
460 'keyboardshortcut', 'select', 'selectFile', 'threshold'
461 ), "Type cannot be found in the defined list!"
462
463 (cat['preferences'])[name] = res = _Preference(
464 cat['id'], name, label, _type, default, help_str=help_str,
465 min_val=min_val, max_val=max_val, options=options,
466 select=select, fields=fields, allow_blanks=allow_blanks,
467 disabled=disabled, dependents=dependents,

Callers 2

register_preferencesMethod · 0.95
register_preferenceMethod · 0.95

Calls 3

__categoryMethod · 0.95
_PreferenceClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected