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

1575762: initialization of pixmask

removed the definition of defaultRGBFiles from the examples: it is now
hosted in the library.

removed function parseColors from examples.  this is done during initPixmap.

added wmdocklib.defaultRGBFileList

removed wmdocklib.setColor (superseded by wmdocklib.initPixmap)

extended wmdocklib.initPixmap:
 basic 16 colour palette [basic_colours] from rgb.txt (not hard coded)
 alter_palette to (re)define an indexed colour in the xpm.
 bg/fg can be a single character or a number [0..15]
 ' ' as transparent colour.
 some debugging 'if 0:' code.

extended wmdocklib.getColorCode:
 it reads either the given rgb file or the first accessible file from
 defaultRGBFileList

corrected url in setup.py: it used to point to ibo!
This commit is contained in:
mfrasca
2006-10-13 11:58:17 +00:00
parent 6af6969015
commit db4f53d257
4 changed files with 150 additions and 158 deletions

View File

@@ -74,7 +74,6 @@ graphLineStartX = 66
graphLineStartY = 58
defaultConfigFile = os.environ['HOME']+'/.pywmhdmonrc'
defaultRGBFiles = ('/usr/lib/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt')
defaultProcStat = '/proc/stat'
displayModes = ('bar', 'percent', 'free', 'used')
defaultMode = 'bar'
@@ -329,36 +328,6 @@ def parseCommandLine(argv):
d['skipconf'] = a
return d
def parseColors(defaultRGBFileList, config, xpm):
rgbFileName = ''
for fn in defaultRGBFileList:
if os.access(fn, os.R_OK):
rgbFileName = fn
break
rgbFileName = config.get('rgbfile', rgbFileName)
useColors = 1
if not os.access(rgbFileName, os.R_OK):
sys.stderr.write(
"Can't read the RGB file, try setting it differently using -r,\n")
sys.stderr.write(
"Ignoring your color settings, using the defaults.\n")
useColors = 0
if useColors:
# Colors is a list with (<config_key>, <xpm-key>) pairs.
colors = (('barfgcolor', 'graph'),
('barbgcolor', 'graphbg'),
('textcolor', 'text'),
('background', 'background'))
for key, value in colors:
col = config.get(key)
if not col is None:
if col[0] is '#': code=col
else: code = wmdocklib.getColorCode(col, rgbFileName)
if code is None:
sys.stderr.write('Bad colorcode for %s, ignoring.\n' % key)
else:
wmdocklib.setColor(xpm, value, code)
def makeNumDigits(num, numDigits):
"""Make a floating point number a certain number of digits, including
decimal. Return a string containing it.
@@ -423,7 +392,15 @@ def main():
config = fileConfig
for i in clConfig.iteritems():
config[i[0]] = i[1]
#parseColors(defaultRGBFiles, config, xpm)
global char_width, char_height
char_width, char_height = wmdocklib.initPixmap(background,
font_name='6x8',
palette={2:'cyan4',
7:'cyan',
8:'cyan4',
0:'black'},
bg=0, fg=2)
pathsToMonitor = []
for i in range(1,1000):
@@ -472,73 +449,69 @@ def main():
background = \
['0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0044400555002220055500555000000000000000000000000000000000000000',
'0044400555002220055500555000000000000000000000000000000000000000',
'0044400555002220055500555000000000000000000000000000000000000000',
'0044400555005550055500555000000000000000000000000000000000000000',
'0044400555005550055500555000000000000000000000000000000000000000',
'0044400555005550055500555000000000000000000000000000000000000000',
'0044400555005550022200555000000000000000000000000000000000000000',
'0044400555005550022200555000000000000000000000000000000000000000',
'0044400555005550022200555000000000000000000000000000000000000000',
'0044400555005550055500555000000000000000000000000000000000000000',
'0044400555005550055500555000000000000000000000000000000000000000',
'0044400555005550055500555000000000000000000000000000000000000000',
'0044400555005550055500222000000000000000000000000000000000000000',
'0044400555005550055500222000000000000000000000000000000000000000',
'0044400555005550055500222000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044400077777777777777777777777777777777777777777777777777777777',
'0044400077777777777777777777777777777777777777777777777777777777',
'0044400077777777777777777777777777777777777777777777777777777777',
'0044400077777777777777777777777777777777777777777777777777777777',
'0044400000000000000000000000000000000000000000000000000000000000',
'0044444444444444444444444444444444444444444444444444444444444444',
'0044444444444444444444444444444444444444444444444444444444444444',
'0044444444444444444444444444444444444444444444444444444444444444',
'0044444444444444444444444444444444444444444444444444444444444444',
'0077700555002220055500555000000000000000000000000000000000000000',
'0077700555002220055500555000000000000000000000000000000000000000',
'0077700555002220055500555000000000000000000000000000000000000000',
'0077700555005550055500555000000000000000000000000000000000000000',
'0077700555005550055500555000000000000000000000000000000000000000',
'0077700555005550055500555000000000000000000000000000000000000000',
'0077700555005550022200555000000000000000000000000000000000000000',
'0077700555005550022200555000000000000000000000000000000000000000',
'0077700555005550022200555000000000000000000000000000000000000000',
'0077700555005550055500555000000000000000000000000000000000000000',
'0077700555005550055500555000000000000000000000000000000000000000',
'0077700555005550055500555000000000000000000000000000000000000000',
'0077700555005550055500222000000000000000000000000000000000000000',
'0077700555005550055500222000000000000000000000000000000000000000',
'0077700555005550055500222000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077700088888888888888888888888888888888888888888888888888888888',
'0077700088888888888888888888888888888888888888888888888888888888',
'0077700088888888888888888888888888888888888888888888888888888888',
'0077700088888888888888888888888888888888888888888888888888888888',
'0077700000000000000000000000000000000000000000000000000000000000',
'0077777777777777777777777777777777777777777777777777777777777777',
'0077777777777777777777777777777777777777777777777777777777777777',
'0077777777777777777777777777777777777777777777777777777777777777',
'0077777777777777777777777777777777777777777777777777777777777777',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
]
char_width, char_height = wmdocklib.initPixmap(background,
font_name='6x8',
bg='8', fg='a')
if __name__ == '__main__':
main()