From 98eb5e463f2177383de360f222c6b8fbb55450ef Mon Sep 17 00:00:00 2001 From: Dan Drogichen Date: Wed, 18 Jun 2014 14:08:02 -0700 Subject: [PATCH] [developer] Control fontsize of file browser display - #1697 Add user specification of the font size to use for the developer tools file browser display, without affecting any other Chirp displays. This is done with a new chirp.config integer property browser_fontsize in the [developer] section. The default size is unchanged at 10. Values between 4 and 144 are accepted; others result in the default. Add documentation of browser_fontsize to the README.developers file. #1697 --- README.developers | 11 +++++++++++ chirpui/radiobrowser.py | 15 +++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.developers b/README.developers index f993804c..90d35f26 100644 --- a/README.developers +++ b/README.developers @@ -18,6 +18,7 @@ followed by an explanation of each directive: =================================== [developer] diff_fontsize = 16 +browser_fontsize = 13 =================================== @@ -29,3 +30,13 @@ invoked by selecting View -> Developer -> Diff tabs, and then in the The default size is 11. Values less than 4, greater than 144, or not recognized as an integer will result in a log message and the default size will be used. + +======== +browser_fontsize = +This specifies the fontsize used in the file browser, invoked by selecting +the "Browser" tab in the left sidebar, which is visible when the Developer +tools are enabled. + +The default size is 10. Values less than 4, greater than 144, or not +recognized as an integer will result in a log message and the default +size will be used. diff --git a/chirpui/radiobrowser.py b/chirpui/radiobrowser.py index db96b048..68a4307f 100644 --- a/chirpui/radiobrowser.py +++ b/chirpui/radiobrowser.py @@ -5,7 +5,9 @@ import re import os from chirp import bitwise -from chirpui import common +from chirpui import common, config + +CONF = config.get() def do_insert_line_with_tags(b, line): def i(text, *tags): @@ -77,7 +79,16 @@ def bitwise_type(classname): class FixedEntry(gtk.Entry): def __init__(self, *args, **kwargs): super(FixedEntry, self).__init__(*args, **kwargs) - fontdesc = pango.FontDescription("Courier bold 10") + + try: + fontsize = CONF.get_int("browser_fontsize", "developer") + except Exception: + fontsize = 10 + if fontsize < 4 or fontsize > 144: + print "Unsupported browser_fontsize %i. Using 10." % fontsize + fontsize = 11 + + fontdesc = pango.FontDescription("Courier bold %i" % fontsize) self.modify_font(fontdesc) class IntegerEntry(FixedEntry):