From f469f22b59e49d0115fdb9acfc537dba79558da7 Mon Sep 17 00:00:00 2001 From: mfrasca <> Date: Sun, 15 Oct 2006 12:49:19 +0000 Subject: [PATCH] 1577063: fonts are hard coded added -F, --font option to some examples. --- MANIFEST | 1 + examples/pywmdatetime.py | 11 ++- examples/pywmgeneric.py | 11 ++- examples/pywmhdmon.py | 11 ++- wmdocklib/pywmhelpers.py | 153 --------------------------------------- 5 files changed, 25 insertions(+), 162 deletions(-) diff --git a/MANIFEST b/MANIFEST index 136358b..1d51281 100644 --- a/MANIFEST +++ b/MANIFEST @@ -12,6 +12,7 @@ examples/sample.pywmhdmonrc examples/sample.pywmsetirc wmdocklib/5x7.xpm wmdocklib/6x8.xpm +wmdocklib/6x8orig.xpm wmdocklib/6x8slant.xpm wmdocklib/7x8zx.xpm wmdocklib/8x8.xpm diff --git a/examples/pywmdatetime.py b/examples/pywmdatetime.py index e571020..6801825 100755 --- a/examples/pywmdatetime.py +++ b/examples/pywmdatetime.py @@ -31,6 +31,7 @@ Available options are: -h, --help print this help -f, --foreground set the foreground color -b, --background set the background color +-F, --font set the font name -t, --timeformat set the time format -d, --dateformat set the date format -y, --weekdayformat set the weekday format @@ -100,9 +101,9 @@ def calculateWeek(localTime): def parseCommandLine(argv): """Parse the commandline. Return a dictionary with options and values.""" - shorts = 'hf:b:t:d:e:y:r:c:' + shorts = 'hf:b:t:d:e:y:r:c:F:' longs = ['help', 'foreground=', 'background=', 'timeformat=', 'dateformat=', - 'weekdayformat=', 'weekformat=', 'rgbfile=', 'configfile='] + 'weekdayformat=', 'weekformat=', 'rgbfile=', 'configfile=', 'font='] try: opts, nonOptArgs = getopt.getopt(argv[1:], shorts, longs) except getopt.GetoptError, e: @@ -116,6 +117,8 @@ def parseCommandLine(argv): sys.exit(0) if o in ('-f', '--foreground'): d['foreground'] = a + if o in ('-F', '--font'): + d['font'] = a if o in ('-b', '--background'): d['background'] = a if o in ('-t', '--timeformat'): @@ -214,8 +217,10 @@ def main(): palette[0] = clConfig.get('background', 'black') palette[2] = clConfig.get('foreground', 'cyan3') + font = clConfig.get('font', '6x8orig') + global char_width, char_height - char_width, char_height = wmdocklib.initPixmap(font_name='6x8', + char_width, char_height = wmdocklib.initPixmap(font_name=font, bg=0, fg=2, palette=palette) wmdocklib.openXwindow(sys.argv, width, height) mainLoop(timeFmt, dateFmt, dayFmt, weekFmt) diff --git a/examples/pywmgeneric.py b/examples/pywmgeneric.py index b0a81c2..530c06e 100644 --- a/examples/pywmgeneric.py +++ b/examples/pywmgeneric.py @@ -28,6 +28,7 @@ Available options are: -h, --help print this help -t, --text set the text color -b, --background set the background color + -F, --font set the font name -r, --rgbfile set the rgb file to get color codes from -c, --configfile set the config file to use """ @@ -516,8 +517,8 @@ class PywmGeneric: def parseCommandLine(argv): """Parse the commandline. Return a dictionary with options and values.""" - shorts = 'ht:b:r:c:' - longs = ['help', 'text=', 'background=', 'rgbfile=', 'configfile='] + shorts = 'ht:b:r:c:F:' + longs = ['help', 'text=', 'background=', 'rgbfile=', 'configfile=', 'font='] try: opts, nonOptArgs = getopt.getopt(argv[1:], shorts, longs) except getopt.GetoptError, e: @@ -533,6 +534,8 @@ def parseCommandLine(argv): d['textcolor'] = a if o in ('-b', '--background'): d['background'] = a + if o in ('-F', '--font'): + d['font'] = a if o in ('-r', '--rgbfile'): d['rgbfile'] = a if o in ('-c', '--configfile'): @@ -651,6 +654,8 @@ def main(): palette['_'] = clConfig.get('background', '#000000000000') palette['%'] = clConfig.get('text', '#2081B2CAAEBA') + font = clConfig.get('font', '6x8') + configFile = clConfig.get('configfile', defaultConfigFile) if not configFile.count(os.sep): configFile = os.sep.join(sys.argv[0].split(os.sep)[:-1]) + os.sep + configFile @@ -664,7 +669,7 @@ def main(): global char_width, char_height char_width, char_height = wmdocklib.initPixmap(background, - font_name='8x8', + font_name=font, bg='f', fg='9', palette=palette) diff --git a/examples/pywmhdmon.py b/examples/pywmhdmon.py index 349cfce..125ba4d 100755 --- a/examples/pywmhdmon.py +++ b/examples/pywmhdmon.py @@ -44,6 +44,7 @@ Available options are: -f, --barfgcolor set the foregroundcolor of the act. bar -g, --barbgcolor set the background color of the act. bar -b, --background set the background color +-F, --font set the font name -r, --rgbfile set the rgb file to get color codes from -c, --configfile set the config file to use -p, --procstat set the location of /proc/stat @@ -299,10 +300,10 @@ def handler(num, frame): def parseCommandLine(argv): """Parse the commandline. Return a dictionary with options and values.""" - shorts = 'ht:f:g:b:r:c:p:s:' + shorts = 'ht:f:g:b:r:c:p:s:F:' longs = ['help', 'textcolor=', 'background=', 'barfgcolor=', 'rgbfile=', 'configfile=', 'barbgcolor=', 'procstat=', - 'skipconf='] + 'skipconf=','font='] try: opts, nonOptArgs = getopt.getopt(argv[1:], shorts, longs) except getopt.GetoptError, e: @@ -324,6 +325,8 @@ def parseCommandLine(argv): d['configfile'] = a if o in ('-g', '--barbgcolor'): d['barbgcolor'] = a + if o in ('-F', '--font'): + d['font'] = a if o in ('-f', '--barfgcolor'): d['barfgcolor'] = a if o in ('-p', '--procstat'): @@ -404,9 +407,11 @@ def main(): palette[8] = clConfig.get('barbgcolor', 'cyan4') palette[5] = clConfig.get('activitycolor', 'cyan2') + font = clConfig.get('font', '6x8') + global char_width, char_height char_width, char_height = wmdocklib.initPixmap(background, - font_name='6x8', + font_name=font, palette=palette, bg=0, fg=2) diff --git a/wmdocklib/pywmhelpers.py b/wmdocklib/pywmhelpers.py index 8ab6eb8..01cd8f0 100644 --- a/wmdocklib/pywmhelpers.py +++ b/wmdocklib/pywmhelpers.py @@ -328,157 +328,4 @@ def getColorCode(colorName, rgbFileName=None): rgbstr = '#%02x%02x%02x' % (r,g,b) return rgbstr return None - -char_defs = { - '5x7': [ -" % % % % % % % % % %% %%%% % %%%% %% %%%% %% ", -" % % % % % %%% % % % % % % % % % % % % %% % % % %% % % % % % ", -" % % % %%%%%% % % % % % % % % % % % % % % %% % % %%% %%% % %% ", -" % % % %%% % % % % %%% %%%%% %%%% % % % % % % %%%% % % % % % % ", -" %%%%% % %% % % % % % % % %% %% % % % % % % % % % % % % % % % ", -" % % % %%% % % % % % % % % % %% % %%% %%%% %% % %% %% % %% ", -" % ", -" %% % %% %% %%% %% %%% %%%% %%%% %% % % %%% % % % % % % % % %% %%% %% ", -"% % %% %% % % % % % % % % % % % % % % % % % % % % % % % % % %%%% %% % % % % % % % ", -"% % %% %% % %%%% % % % %% % % %%% % % % %%% %%% % %%%% % % %% % %%%% %% % % % % % % % ", -" %%% % % % % %% %%%% % % % % % % % % %% % % % % %% % % % % %% % % %%% % % ", -" % %% %% % %%%% % % % % % % % % % % % % % % % % % % % % % % % % % %% % % % %% % ", -" %% %% % % % % %% % % %%% %% %%% %%%% % %%% % % %%% %% % % %%%% % % % % %% % %% ", -" % % ", -"%%% %% %%% % % % % % % % % % % %%%% %%% %%% % % % % % % % % ", -"% % % % % % % % % % % % % % % % % % % % % % % % % % % ", -"% % % % % % % % % % %% % % % % % % %%% %%% %% %%% %% % %%% %%% %% % ", -"%%% % % % % % % %%%% %% % % % % % % % % % % % % % %% %%% % % % % % % ", -"% % % % % % % %% %%%% % % % % % % % % %% % % % % % %% % %% % % % % ", -"% % %% % %% %% % % % % % %%%% %%% %%% %%%% % % %%% %% %%% %% % % % % %%% % % ", -" %%% % ", -"% %% % % % % % % ", -"% % % % % % % % % % % ", -"% % % % % %%% %% %%% %%% %%% %%% %%% % % % % % % % % % % %%%% %% % %% ", -"%% % %%%% % % % % % % % % % % %% % % % % % % % %% % % % % % % % % ", -"% % % % % % % % % % % % % % %% % % % % % %%%% %% % % % % % % ", -"% % %%% % % % % %% %%% %%% % %%% %% %%% % %%%% % % % %%%% % % % % % % ", -" % % % ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", - ], - '6x8': [ -" % % % % % % % % %% % % % %%% % %%% %%% % ", -" % % % % % %%%% % % % % % % % % % % % % %% % % % % %% ", -" % % % %%%%% % % %% % % % % % % % % %% % % % % % ", -" % % % %%% % % % % %%%%% %%%%% %%%%% % % % % % %% %% % % ", -" %%%%% % % % % % % % % % % % %% % % % % %%%%% ", -" % % %%%% % % % % % % % % % % %% % % % % % % % % ", -" % % % % % % %% % % % % %% % %%% %%% %%%%% %%% % ", -" % ", -"%%%%% %%% %%%%% %%% %%% %% %% %%% %%% % %%%% %%% %%% %%%%% %%%%% %%% % % %%% ", -"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ", -"%%%% % % % % % % % % % %%%%% % % % %%% % % % % % % % % % % % % % ", -" % %%%% % %%% %%%% % % % % % % %%%%% %%%% % % % %%%% %%% % %% %%%%% % ", -" % % % % % % % % %%%%% % % % %%% % % % % % % % % % % % % % % ", -"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % ", -" %%% %%% % %%% %%% % %% %% % %%% % % %%%% %%% %%% %%%%% % %%% % % %%% ", -" % ", -" %%% % % % % % % % %%% %%%% %%% %%%% %%% %%%%% % % % % % % % % % % %%%%% %%% %%% % ", -" % % % % %% %% % % % % % % % % % % % % % % % % % % % % % % % % % % % % ", -" % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % % % % % % % ", -" % %% % % % % % % % % %%%% % % %%%% %%% % % % % % % % % % % % % % % ", -" % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % % % ", -"% % % % % % % % % % % % %%% % % % % % % % % % %% %% % % % % % % % ", -" %% % % %%%%% % % % % %%% % %% % % %%% % %%% % % % % % % %%%%% %%% % %%% ", -" ", -" % % % %% % % % %% ", -" % % % % % % % ", -" % %%% % %%%% % %%% % %%%% % %% %% % % %% % %%%% %%% %%%% %%%% %%%% %%%% ", -" % %%%% % %%%% % % %%%% % % %%%% % % % %% % % % % % % % % % % % % % % % ", -" %%%% % % % % % %%%%% % % % % % % % %% % % % % % % % % % % % % % %%% ", -" % % % % % % % % % %%%% % % % % % % % % % % % % % % %%%% %%%% % % ", -" %%%% %%%% %%%% %%%% %%% % % % % %%% % % %% %%% % % % % % %%% % % % %%%% ", -"%%%%% %%%% %%% % % ", -" %%% % %%% ", -" % % % % ", -"%%%%% % % % % % % % % % % %%%%% % % % ", -" % % % % % % % % % % % % % % % % %% % ", -" % % % % % % % % % % % % % % % % %% ", -" % % % % % % % % % % %%%% % % % % ", -" %% %%%% % % % % % % %%%%% %%% % %%% ", -" %%% ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", - ], - '8x8': [ -" %% %% %% %% %% %% %% % %%%% %% %% %% ", -" %% %% %% %% %% %%%%% %% %% %% %% %% %% %% %% %% %% %%", -" %% %% %% %%%%%%%% %% %% %%%% %% %% %% %%%% %% %% ", -" %% %% %% %%%% %% %%% %% %% %%%%%%%% %%%%%% %%%%%% %% ", -" %%%%%%%% %% %% %% %%% %% %% %%%% %% %% ", -" %% %% %%%%% %% %% %% %% %% %% %% %% %% %% %% %% ", -" %% %% %% %% % %% %%%%%% %% %% %% %% %% ", -" %% ", -" %%%% %% %%%% %%%% %% %%%%%% %%%% %%%%%% %%%% %%%% %%% %%% %%%% ", -" %% %% %% %% %% %% %% %%% %% %% %% %% %% %% %% %% %% %% %% %% %% ", -" %% %%% %%% %% %% %%%% %%%%% %% %% %% %% %% %% %% %% %% %%%%%% %% %% ", -" %%% %% %% %% %%% %% %% %% %%%%% %% %%%% %%%%% %% %% %% ", -" %% %% %% %% %% %%%%%%% %% %% %% %% %% %% %% %% %%%%%% %% %% ", -" %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% ", -" %%%% %%%%%% %%%%%% %%%% %% %%%% %%%% %% %%%% %%%% %% %%% %%% %% ", -" %% ", -" %%%% %% %%%%% %%%% %%%% %%%%%% %%%%%% %%%% %% %% %%%% %%%% %% %% %% %% %% %% %% %%%% ", -" %% %% %%%% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %%% %%% %%% %% %% %% ", -" %% %%% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %%%% %% %%%%%%% %%%%%% %% %% ", -" %% %%% %%%%%% %%%%% %% %% %% %%%% %%%% %% %%% %%%%%% %% %% %%% %% %% % %% %%%%%% %% %% ", -" %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %%%% %% %% %% %% %%% %% %% ", -" %% % %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% ", -" %%%% %% %% %%%%% %%%% %%%% %%%%%% %% %%%% %% %% %%%% %%% %% %% %%%%%% %% %% %% %% %%%% ", -" ", -" %%%%% %%%% %%%%% %%%% %%%%%% %% %% %% %% %% %% %% %% %% %% %%%%%% %%% %%% ", -" %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% ", -" %% %% %% %% %% %% %% %% %% %% %% %% %% %% %%%% %% %% %% %% %% %% ", -" %%%%% %% %% %%%%% %%%% %% %% %% %% %% %% % %% %% %%%% %% %% %% %% %%% %% ", -" %% %% %% %%%% %% %% %% %% %% %% %%%%%%% %%%% %% %% %% %% %% %% %%% ", -" %% %%%% %% %% %% %% %% %% %% %%%% %%% %%% %% %% %% %% %% %% %% ", -" %% %%% %% %% %%%% %% %%%% %% %% %% %% %% %% %%%%%% %%% %% %%% ", -" ", -" %% ", -" %% %% %% %%% %% %% %% %% %%% ", -" %% %%%% %% %%%% %% %%%% %% %%%%% %% %% %% %% %% %%%%% %%%% ", -" %% %%%%% %% %%%%% %% %% %%%%% %% %% %%%%% %%% %% %% %% %% %%%%%%% %% %% %% %% ", -" %%%%% %% %% %% %% %% %%%%%% %% %% %% %% %% %% %% %%%% %% %%%%%%% %% %% %% %% ", -" %% %% %% %% %% %% %% %% %% %%%%% %% %% %% %% %% %% %% %% % %% %% %% %% %% ", -" %%%%% %%%%% %%%% %%%%% %%%% %% %% %% %% %%%% %% %% %% %%%% %% %% %% %% %%%% ", -" %%%%% %%%% ", -" %%%% %%%% ", -" %% %% %% %% %% ", -" %%%%% %%%%% %%%%% %%%%% %%%%%% %% %% %% %% %% %% %% %% %% %% %%%%%% %% %% %% %%%% ", -" %% %% %% %% %% %% %% %% %% %% %% %% %% % %% %%%% %% %% %% %% %% %% %% %% ", -" %% %% %% %% %% %%%% %% %% %% %% %% %%%%%%% %% %% %% %% %% %% %% ", -" %%%%% %%%%% %% %% %% %% %% %%%% %%%%% %%%% %%%%% %% %% %% %% ", -" %% %% %% %%%%% %%% %%%%% %% %% %% %% %% %% %%%%%% %%%% %% %%%% %%%%%%%%", -" %% %% %%%% ", - ], - }