Allow customisation of the CodeMirror font size. Fixes #1565

This commit is contained in:
Dave Page 2016-08-17 13:20:05 +01:00
parent 9ec05d6bb1
commit b3f25cb4bb

View File

@ -193,6 +193,14 @@ class BrowserModule(PgAdminModule):
category_label=gettext('Display')
)
self.sql_font_size = self.preference.register(
'display', 'sql_font_size',
gettext("Font size"), 'text', '1em',
category_label=gettext('Display'),
help_str=gettext('The font size (and unit) to use for the SQL text boxes and editors. '
'Specify a value and unit; for example "1.2em" for 1.2x the primary font size '
'or "12px" for 12 pixels. Use of "em" units is highly recommended.')
)
blueprint = BrowserModule(MODULE_NAME, __name__)
@ -557,6 +565,16 @@ def collection_js():
def browser_css():
"""Render and return CSS snippets from the nodes and modules."""
snippets = []
# Get configurable options
prefs = Preferences.module('browser')
sql_font_size_pref = prefs.preference('sql_font_size')
sql_font_size = sql_font_size_pref.get()
if sql_font_size != '':
snippets.append('.CodeMirror { font-size: %s; }' % sql_font_size)
for submodule in blueprint.submodules:
snippets.extend(submodule.csssnippets)
return make_response(