From b3f25cb4bb5027eaba483eceb4e425fdadb63910 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Wed, 17 Aug 2016 13:20:05 +0100 Subject: [PATCH] Allow customisation of the CodeMirror font size. Fixes #1565 --- web/pgadmin/browser/__init__.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py index 65503c94f..567ed67c4 100644 --- a/web/pgadmin/browser/__init__.py +++ b/web/pgadmin/browser/__init__.py @@ -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(