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

Method register_preferences

web/pgadmin/misc/__init__.py:46–179  ·  view source on GitHub ↗

Register preferences for this module.

(self)

Source from the content-addressed store, hash-verified

44 LABEL = gettext('Miscellaneous')
45
46 def register_preferences(self):
47 """
48 Register preferences for this module.
49 """
50 lang_options = []
51 for lang in config.LANGUAGES:
52 lang_options.append(
53 {
54 'label': config.LANGUAGES[lang],
55 'value': lang
56 }
57 )
58
59 # Register options for the User language settings
60 self.preference.register(
61 'user_interface', 'user_language',
62 gettext("Language"), 'options', 'en',
63 category_label=PREF_LABEL_USER_INTERFACE,
64 options=lang_options,
65 control_props={
66 'allowClear': False,
67 }
68 )
69
70 theme_options = []
71
72 for theme, theme_data in (get_all_themes()).items():
73 theme_options.append({
74 'label': theme_data['disp_name']
75 .replace('_', ' ')
76 .replace('-', ' ')
77 .title(),
78 'value': theme,
79 'preview_src': 'js/generated/img/' + theme_data['preview_img']
80 if 'preview_img' in theme_data else None
81 })
82
83 self.preference.register(
84 'user_interface', 'theme',
85 gettext("Theme"), 'options', 'system',
86 category_label=PREF_LABEL_USER_INTERFACE,
87 options=theme_options,
88 control_props={
89 'allowClear': False,
90 'creatable': False,
91 },
92 help_str=gettext(
93 'Click the save button to apply the theme. Below is the '
94 'preview of the theme.'
95 )
96 )
97 self.preference.register(
98 'user_interface', 'layout',
99 gettext("Layout"), 'options', 'workspace',
100 category_label=PREF_LABEL_USER_INTERFACE,
101 options=[{'label': gettext('Classic'), 'value': 'classic'},
102 {'label': gettext('Workspace'), 'value': 'workspace'}],
103 control_props={

Callers

nothing calls this directly

Calls 4

get_all_themesFunction · 0.90
gettextFunction · 0.85
appendMethod · 0.80
registerMethod · 0.45

Tested by

no test coverage detected