1
0
mirror of https://github.com/gryf/wmdocklib.git synced 2025-12-19 12:28:10 +01:00

1577063: fonts are hard coded

added -F, --font option to some examples.
This commit is contained in:
mfrasca
2006-10-15 12:49:19 +00:00
parent c49cd494a8
commit f469f22b59
5 changed files with 25 additions and 162 deletions

View File

@@ -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

View File

@@ -31,6 +31,7 @@ Available options are:
-h, --help print this help
-f, --foreground <color> set the foreground color
-b, --background <color> set the background color
-F, --font <file> set the font name
-t, --timeformat <format> set the time format
-d, --dateformat <format> set the date format
-y, --weekdayformat <format> 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)

View File

@@ -28,6 +28,7 @@ Available options are:
-h, --help print this help
-t, --text <color> set the text color
-b, --background <color> set the background color
-F, --font <file> set the font name
-r, --rgbfile <file> set the rgb file to get color codes from
-c, --configfile <file> 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)

View File

@@ -44,6 +44,7 @@ Available options are:
-f, --barfgcolor <color> set the foregroundcolor of the act. bar
-g, --barbgcolor <color> set the background color of the act. bar
-b, --background <color> set the background color
-F, --font <file> set the font name
-r, --rgbfile <file> set the rgb file to get color codes from
-c, --configfile <file> set the config file to use
-p, --procstat <file> 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)

View File

@@ -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': [
" %% %% %% %% %% %% %% % %%%% %% %% %% ",
" %% %% %% %% %% %%%%% %% %% %% %% %% %% %% %% %% %% %%",
" %% %% %% %%%%%%%% %% %% %%%% %% %% %% %%%% %% %% ",
" %% %% %% %%%% %% %%% %% %% %%%%%%%% %%%%%% %%%%%% %% ",
" %%%%%%%% %% %% %% %%% %% %% %%%% %% %% ",
" %% %% %%%%% %% %% %% %% %% %% %% %% %% %% %% %% ",
" %% %% %% %% % %% %%%%%% %% %% %% %% %% ",
" %% ",
" %%%% %% %%%% %%%% %% %%%%%% %%%% %%%%%% %%%% %%%% %%% %%% %%%% ",
" %% %% %% %% %% %% %% %%% %% %% %% %% %% %% %% %% %% %% %% %% %% ",
" %% %%% %%% %% %% %%%% %%%%% %% %% %% %% %% %% %% %% %% %%%%%% %% %% ",
" %%% %% %% %% %%% %% %% %% %%%%% %% %%%% %%%%% %% %% %% ",
" %% %% %% %% %% %%%%%%% %% %% %% %% %% %% %% %% %%%%%% %% %% ",
" %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% ",
" %%%% %%%%%% %%%%%% %%%% %% %%%% %%%% %% %%%% %%%% %% %%% %%% %% ",
" %% ",
" %%%% %% %%%%% %%%% %%%% %%%%%% %%%%%% %%%% %% %% %%%% %%%% %% %% %% %% %% %% %% %%%% ",
" %% %% %%%% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %%% %%% %%% %% %% %% ",
" %% %%% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %%%% %% %%%%%%% %%%%%% %% %% ",
" %% %%% %%%%%% %%%%% %% %% %% %%%% %%%% %% %%% %%%%%% %% %% %%% %% %% % %% %%%%%% %% %% ",
" %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %%%% %% %% %% %% %%% %% %% ",
" %% % %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% ",
" %%%% %% %% %%%%% %%%% %%%% %%%%%% %% %%%% %% %% %%%% %%% %% %% %%%%%% %% %% %% %% %%%% ",
" ",
" %%%%% %%%% %%%%% %%%% %%%%%% %% %% %% %% %% %% %% %% %% %% %%%%%% %%% %%% ",
" %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% ",
" %% %% %% %% %% %% %% %% %% %% %% %% %% %% %%%% %% %% %% %% %% %% ",
" %%%%% %% %% %%%%% %%%% %% %% %% %% %% %% % %% %% %%%% %% %% %% %% %%% %% ",
" %% %% %% %%%% %% %% %% %% %% %% %%%%%%% %%%% %% %% %% %% %% %% %%% ",
" %% %%%% %% %% %% %% %% %% %% %%%% %%% %%% %% %% %% %% %% %% %% ",
" %% %%% %% %% %%%% %% %%%% %% %% %% %% %% %% %%%%%% %%% %% %%% ",
" ",
" %% ",
" %% %% %% %%% %% %% %% %% %%% ",
" %% %%%% %% %%%% %% %%%% %% %%%%% %% %% %% %% %% %%%%% %%%% ",
" %% %%%%% %% %%%%% %% %% %%%%% %% %% %%%%% %%% %% %% %% %% %%%%%%% %% %% %% %% ",
" %%%%% %% %% %% %% %% %%%%%% %% %% %% %% %% %% %% %%%% %% %%%%%%% %% %% %% %% ",
" %% %% %% %% %% %% %% %% %% %%%%% %% %% %% %% %% %% %% %% % %% %% %% %% %% ",
" %%%%% %%%%% %%%% %%%%% %%%% %% %% %% %% %%%% %% %% %% %%%% %% %% %% %% %%%% ",
" %%%%% %%%% ",
" %%%% %%%% ",
" %% %% %% %% %% ",
" %%%%% %%%%% %%%%% %%%%% %%%%%% %% %% %% %% %% %% %% %% %% %% %%%%%% %% %% %% %%%% ",
" %% %% %% %% %% %% %% %% %% %% %% %% %% % %% %%%% %% %% %% %% %% %% %% %% ",
" %% %% %% %% %% %%%% %% %% %% %% %% %%%%%%% %% %% %% %% %% %% %% ",
" %%%%% %%%%% %% %% %% %% %% %%%% %%%%% %%%% %%%%% %% %% %% %% ",
" %% %% %% %%%%% %%% %%%%% %% %% %% %% %% %% %%%%%% %%%% %% %%%% %%%%%%%%",
" %% %% %%%% ",
],
}