mirror of
https://github.com/gryf/wmdocklib.git
synced 2025-12-19 12:28:10 +01:00
1293224: char font
just preparing for a bigger change... introduced a global font (just one), it is lower case per default. I intend to modify the function for registering the default xpm to something accepting the 64x64 bitmap (application dependent) and insert it into the global pixmap. an other function could be used to register the alfabet pixmap and correspondently setting the variables indicating the position of each character. we would only support monospace alfabets. the 'printing' functions would also be simpler (less arguments), since it would be the library knowing which is the alfabet in use.
This commit is contained in:
@@ -49,25 +49,15 @@ import os
|
|||||||
|
|
||||||
import wmdocklib
|
import wmdocklib
|
||||||
|
|
||||||
|
from wmdocklib import letters, lettersStartX, lettersStartY, letterWidth, letterHeight
|
||||||
|
from wmdocklib import digits, digitsStartX, digitsStartY, digitWidth, digitHeight
|
||||||
|
|
||||||
width = 64
|
width = 64
|
||||||
height = 64
|
height = 64
|
||||||
|
|
||||||
lettersStartX = 0
|
|
||||||
lettersStartY = 74
|
|
||||||
letterWidth = 6
|
|
||||||
letterHeight = 8
|
|
||||||
|
|
||||||
digitsStartX = 0
|
|
||||||
digitsStartY = 64
|
|
||||||
digitWidth = 6
|
|
||||||
digitHeight = 8
|
|
||||||
|
|
||||||
xOffset = 4
|
xOffset = 4
|
||||||
yOffset = 4
|
yOffset = 4
|
||||||
|
|
||||||
letters = 'abcdefghijklmnopqrstuvwxyz'
|
|
||||||
digits = '0123456789:/- '
|
|
||||||
|
|
||||||
timeDefaultFormat = '%H:%M:%S'
|
timeDefaultFormat = '%H:%M:%S'
|
||||||
dateDefaultFormat = '%d-%m-%y'
|
dateDefaultFormat = '%d-%m-%y'
|
||||||
dayDefaultFormat = '%A'
|
dayDefaultFormat = '%A'
|
||||||
@@ -100,9 +90,9 @@ def getVertSpacing(numLines, margin):
|
|||||||
yOffset)
|
yOffset)
|
||||||
|
|
||||||
def calculateWeek(localTime):
|
def calculateWeek(localTime):
|
||||||
'''Calculate the week number as we do, for example in Sweden.
|
"""Calculate the week number as we do, for example in Sweden.
|
||||||
|
|
||||||
That is, add one to the %W format if the year didn't start on a monday.'''
|
That is, add one to the %W format if the year didn't start on a monday."""
|
||||||
day = int(time.strftime('%j', localTime))
|
day = int(time.strftime('%j', localTime))
|
||||||
weekDay = int(time.strftime('%w')) - 1
|
weekDay = int(time.strftime('%w')) - 1
|
||||||
if weekDay == -1:
|
if weekDay == -1:
|
||||||
@@ -113,7 +103,7 @@ def calculateWeek(localTime):
|
|||||||
return int(time.strftime('%W')) + 1
|
return int(time.strftime('%W')) + 1
|
||||||
|
|
||||||
def parseCommandLine(argv):
|
def parseCommandLine(argv):
|
||||||
'''Parse the commandline. Return a dictionary with options and values.'''
|
"""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:'
|
||||||
longs = ['help', 'foreground=', 'background=', 'timeformat=', 'dateformat=',
|
longs = ['help', 'foreground=', 'background=', 'timeformat=', 'dateformat=',
|
||||||
'weekdayformat=', 'weekformat=', 'rgbfile=', 'configfile=']
|
'weekdayformat=', 'weekformat=', 'rgbfile=', 'configfile=']
|
||||||
@@ -266,108 +256,73 @@ xpm = \
|
|||||||
'#\tc #9E79A2899E79',
|
'#\tc #9E79A2899E79',
|
||||||
'$\tc #410341034103',
|
'$\tc #410341034103',
|
||||||
'/\tc #2020b2b2aaaa s graph',
|
'/\tc #2020b2b2aaaa s graph',
|
||||||
'X\tc #000000000000 s background',
|
'_\tc #000000000000 s background',
|
||||||
'%\tc #2081B2CAAEBA s text',
|
'%\tc #2081B2CAAEBA s text',
|
||||||
' ................................................................................................',
|
' ................................................................................................',
|
||||||
' ..///...........................................................................................',
|
' ..///...........................................................................................',
|
||||||
' ..///...........................................................................................',
|
' ..///...........................................................................................',
|
||||||
' ..///...........................................................................................',
|
' ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...............................',
|
' ________________________________________________________ ..///....________________________________________________________...............................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...............................',
|
' ________________________________________________________ ..///....________________________________________________________...............................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...............................',
|
' ________________________________________________________ ..///....________________________________________________________...............................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...............................',
|
' ________________________________________________________ ..///....________________________________________________________...............................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...............................',
|
' ________________________________________________________ ..///....________________________________________________________...............................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...............................',
|
' ________________________________________________________ ..///....________________________________________________________...............................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...............................',
|
' ________________________________________________________ ..///....________________________________________________________...............................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...............................',
|
' ________________________________________________________ ..///....________________________________________________________...............................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///...........................................................................................',
|
' ________________________________________________________ ..///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ ..///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ..///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ ..///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' ..///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ..///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' ................................................................................................',
|
' ................................................................................................',
|
||||||
' ................................................................................................',
|
' ................................................................................................',
|
||||||
' ................................................................................................',
|
' ................................................................................................',
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
] + wmdocklib.alfabet
|
||||||
'X%%%%%XXX%XXX%%%%%X%%%%%X%XXX%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%XXXXXXXXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XX%%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%%%%%XX%%%%X%%%%%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXXXXXX%XXX%%%%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XXXXXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XX%%XXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%%%%%XX%%%XX%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XX%%XXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'XX%%%XX%%%%XXX%%%%X%%%%XX%%%%XX%%%%%X%%%%%X%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%XXX%X%%%%XX%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%%%%%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%%X%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%X%XXX%X%XXX%XXXXX%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%X%X%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%XX%X%XX%XXX%XXXX%XXXXX',
|
|
||||||
'X%%%%%X%%%%XX%XXXXX%XXX%X%%%%XX%%%%XX%X%%%X%%%%%XXX%XXXXXXX%X%%%XXX%XXXXX%XXX%X%XXX%X%XXX%X%%%%%X%%XX%X%%%%XX%%%%%XXX%XXX%XXX%X%XXX%X%XXX%XXX%XXX%%%%%XXX%XXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%X%X%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%X%X%XX%X%XXXXXX%XX%XXXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXX%XXX%X%XXX%X%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%XX%%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%%X%%X%XXX%XXXXX%X%XXXXXXXX',
|
|
||||||
'X%XXX%X%%%%XXX%%%%X%%%%XX%%%%XX%XXXXX%%%%%X%XXX%XXX%XXXX%%%XX%XXX%X%%%%XX%XXX%X%XXX%X%%%%%X%XXXXX%%%%%X%XXX%X%%%%%XXX%XXXX%%%%XX%%%XX%XXX%X%XXX%X%%%%%X%%%%%XXXX',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................']
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
'''pywmgeneric.py
|
"""pywmgeneric.py
|
||||||
|
|
||||||
WindowMaker dockapp to display the output from an external program, or the
|
WindowMaker dockapp to display the output from an external program, or the
|
||||||
string returned from a python function. Mouse actions can be associated with
|
string returned from a python function. Mouse actions can be associated with
|
||||||
@@ -21,16 +21,16 @@ Additional error checking around string interpolations from cfg file.
|
|||||||
|
|
||||||
2003-06-27 Kristoffer Erlandsson
|
2003-06-27 Kristoffer Erlandsson
|
||||||
First working version
|
First working version
|
||||||
'''
|
"""
|
||||||
|
|
||||||
usage = '''pywmgeneric.py [options]
|
usage = """pywmgeneric.py [options]
|
||||||
Available options are:
|
Available options are:
|
||||||
-h, --help print this help
|
-h, --help print this help
|
||||||
-t, --text <color> set the text color
|
-t, --text <color> set the text color
|
||||||
-b, --background <color> set the background color
|
-b, --background <color> set the background color
|
||||||
-r, --rgbfile <file> set the rgb file to get color codes from
|
-r, --rgbfile <file> set the rgb file to get color codes from
|
||||||
-c, --configfile <file> set the config file to use
|
-c, --configfile <file> set the config file to use
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
@@ -42,6 +42,9 @@ import popen2
|
|||||||
|
|
||||||
import wmdocklib
|
import wmdocklib
|
||||||
|
|
||||||
|
from wmdocklib import letters, lettersStartX, lettersStartY, letterWidth, letterHeight
|
||||||
|
from wmdocklib import digits, digitsStartX, digitsStartY, digitWidth, digitHeight
|
||||||
|
|
||||||
prevStat = {'user':0,
|
prevStat = {'user':0,
|
||||||
'nice':0,
|
'nice':0,
|
||||||
'sys':0,
|
'sys':0,
|
||||||
@@ -112,19 +115,19 @@ class UserMethods:
|
|||||||
return lambda: 'sys: %s' % temp
|
return lambda: 'sys: %s' % temp
|
||||||
|
|
||||||
def showDnWithoutDescs(self, entry):
|
def showDnWithoutDescs(self, entry):
|
||||||
'''Strip descriptions from some text where the descs are indented.
|
"""Strip descriptions from some text where the descs are indented.
|
||||||
|
|
||||||
Display it in an xmessage.
|
Display it in an xmessage.
|
||||||
'''
|
"""
|
||||||
text = entry.getAllText()
|
text = entry.getAllText()
|
||||||
s = '\n'.join([x for x in text.split('\n') if not x.startswith(' ')])
|
s = '\n'.join([x for x in text.split('\n') if not x.startswith(' ')])
|
||||||
os.system('xmessage "' + s.replace('"', r'\"') + '" &')
|
os.system('xmessage "' + s.replace('"', r'\"') + '" &')
|
||||||
|
|
||||||
def showTvWithoutDescs(self, entry):
|
def showTvWithoutDescs(self, entry):
|
||||||
'''Strip descriptions from some text where the descs are indented.
|
"""Strip descriptions from some text where the descs are indented.
|
||||||
|
|
||||||
Display it in an xmessage.
|
Display it in an xmessage.
|
||||||
'''
|
"""
|
||||||
text = entry.getAllText()
|
text = entry.getAllText()
|
||||||
s='\n'.join([x for x in
|
s='\n'.join([x for x in
|
||||||
text.split('\n')[1:] if not x.startswith(' ')])
|
text.split('\n')[1:] if not x.startswith(' ')])
|
||||||
@@ -137,19 +140,6 @@ height = 64
|
|||||||
xOffset = 4
|
xOffset = 4
|
||||||
yOffset = 4
|
yOffset = 4
|
||||||
|
|
||||||
lettersStartX = 0
|
|
||||||
lettersStartY = 74
|
|
||||||
letterWidth = 6
|
|
||||||
letterHeight = 8
|
|
||||||
|
|
||||||
digitsStartX = 0
|
|
||||||
digitsStartY = 64
|
|
||||||
digitWidth = 6
|
|
||||||
digitHeight = 8
|
|
||||||
|
|
||||||
letters = 'abcdefghijklmnopqrstuvwxyz'
|
|
||||||
digits = '0123456789:/-%. '
|
|
||||||
|
|
||||||
maxChars = 9
|
maxChars = 9
|
||||||
|
|
||||||
defaultConfigFile = '~/.pywmgenericrc'
|
defaultConfigFile = '~/.pywmgenericrc'
|
||||||
@@ -158,7 +148,7 @@ defaultRGBFiles = ('/usr/share/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt')
|
|||||||
err = sys.stderr.write
|
err = sys.stderr.write
|
||||||
|
|
||||||
def addString(s, x, y):
|
def addString(s, x, y):
|
||||||
'''Convenience function around pwymhelpers.addString.'''
|
"""Convenience function around pwymhelpers.addString."""
|
||||||
try:
|
try:
|
||||||
wmdocklib.addString(s, x, y, letterWidth, letterHeight, lettersStartX,
|
wmdocklib.addString(s, x, y, letterWidth, letterHeight, lettersStartX,
|
||||||
lettersStartY, letters, digitWidth, digitHeight,
|
lettersStartY, letters, digitWidth, digitHeight,
|
||||||
@@ -169,12 +159,12 @@ def addString(s, x, y):
|
|||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
def clearLine(y):
|
def clearLine(y):
|
||||||
'''Clear a line of text at position y.'''
|
"""Clear a line of text at position y."""
|
||||||
wmdocklib.copyXPMArea(72, yOffset, width - 2 * xOffset, letterHeight,
|
wmdocklib.copyXPMArea(72, yOffset, width - 2 * xOffset, letterHeight,
|
||||||
xOffset, y + yOffset)
|
xOffset, y + yOffset)
|
||||||
|
|
||||||
def getXY(line):
|
def getXY(line):
|
||||||
'''Return the x and y positions to be used at line line.'''
|
"""Return the x and y positions to be used at line line."""
|
||||||
return 0, line * (letterHeight + 3) + 1
|
return 0, line * (letterHeight + 3) + 1
|
||||||
|
|
||||||
def isTrue(s):
|
def isTrue(s):
|
||||||
@@ -216,9 +206,9 @@ class Entry:
|
|||||||
self._lastActionAt = time.time()
|
self._lastActionAt = time.time()
|
||||||
|
|
||||||
def _parseAction(self, action):
|
def _parseAction(self, action):
|
||||||
'''Parse an action string, return (<action>, <argument string>).
|
"""Parse an action string, return (<action>, <argument string>).
|
||||||
|
|
||||||
Or none if we get an empty action.'''
|
Or none if we get an empty action."""
|
||||||
if action:
|
if action:
|
||||||
whatToDo = action.split()[0]
|
whatToDo = action.split()[0]
|
||||||
argStr = action[len(whatToDo):].lstrip()
|
argStr = action[len(whatToDo):].lstrip()
|
||||||
@@ -226,15 +216,15 @@ class Entry:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def _execExternal(self, command):
|
def _execExternal(self, command):
|
||||||
'''Exec an external command in the background.
|
"""Exec an external command in the background.
|
||||||
|
|
||||||
Return the running process as created by Popen3().'''
|
Return the running process as created by Popen3()."""
|
||||||
proc = popen2.Popen3(command)
|
proc = popen2.Popen3(command)
|
||||||
self._runningProcs.append(proc)
|
self._runningProcs.append(proc)
|
||||||
return proc
|
return proc
|
||||||
|
|
||||||
def _doMouseAction(self, button):
|
def _doMouseAction(self, button):
|
||||||
'''Perform the mouse action associated with a button.'''
|
"""Perform the mouse action associated with a button."""
|
||||||
if len(self._mouseActions) < button:
|
if len(self._mouseActions) < button:
|
||||||
return # Just for safety, shouldn't happen.
|
return # Just for safety, shouldn't happen.
|
||||||
item = self._mouseActions[button - 1]
|
item = self._mouseActions[button - 1]
|
||||||
@@ -261,7 +251,7 @@ class Entry:
|
|||||||
err("Warning: Unknown mouse action: %s, ignoring.\n" % action)
|
err("Warning: Unknown mouse action: %s, ignoring.\n" % action)
|
||||||
|
|
||||||
def _doAction(self):
|
def _doAction(self):
|
||||||
'''Perform the action associated with this entry.'''
|
"""Perform the action associated with this entry."""
|
||||||
if self._action is None:
|
if self._action is None:
|
||||||
return
|
return
|
||||||
action, arg = self._action
|
action, arg = self._action
|
||||||
@@ -288,8 +278,8 @@ class Entry:
|
|||||||
err("Warning: Unknown action: %s, ignoring.\n" % action)
|
err("Warning: Unknown action: %s, ignoring.\n" % action)
|
||||||
|
|
||||||
def _readFromActionProc(self):
|
def _readFromActionProc(self):
|
||||||
'''If our action process is ready, return the output. Otherwise None.
|
"""If our action process is ready, return the output. Otherwise None.
|
||||||
'''
|
"""
|
||||||
if self._actionProc.poll() == -1:
|
if self._actionProc.poll() == -1:
|
||||||
# Wait until the process is ready before we really read the text.
|
# Wait until the process is ready before we really read the text.
|
||||||
return None
|
return None
|
||||||
@@ -298,7 +288,7 @@ class Entry:
|
|||||||
return self._actionProc.fromchild.read()
|
return self._actionProc.fromchild.read()
|
||||||
|
|
||||||
def _reapZombies(self):
|
def _reapZombies(self):
|
||||||
'''Poll all running childs. This will reap all zombies.'''
|
"""Poll all running childs. This will reap all zombies."""
|
||||||
i = 0
|
i = 0
|
||||||
for p in self._runningProcs:
|
for p in self._runningProcs:
|
||||||
val = p.poll()
|
val = p.poll()
|
||||||
@@ -307,8 +297,8 @@ class Entry:
|
|||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
def _updateText(self):
|
def _updateText(self):
|
||||||
'''Get the text, update the display if it has changed.
|
"""Get the text, update the display if it has changed.
|
||||||
'''
|
"""
|
||||||
text = ''
|
text = ''
|
||||||
if self._getTextMethod:
|
if self._getTextMethod:
|
||||||
text = self._getTextMethod()
|
text = self._getTextMethod()
|
||||||
@@ -337,11 +327,11 @@ class Entry:
|
|||||||
self._scrollAndDisplay()
|
self._scrollAndDisplay()
|
||||||
|
|
||||||
def _scrollAndDisplay(self):
|
def _scrollAndDisplay(self):
|
||||||
'''Scroll the text one step to the left and redisplay it.
|
"""Scroll the text one step to the left and redisplay it.
|
||||||
|
|
||||||
When reaching the end, paint number of spaces before scrolling in the
|
When reaching the end, paint number of spaces before scrolling in the
|
||||||
same line again from the right.
|
same line again from the right.
|
||||||
'''
|
"""
|
||||||
if self._scrollPos >= \
|
if self._scrollPos >= \
|
||||||
len(self._displayLine) + (maxChars - 4):
|
len(self._displayLine) + (maxChars - 4):
|
||||||
self._scrollPos = 0
|
self._scrollPos = 0
|
||||||
@@ -361,8 +351,8 @@ class Entry:
|
|||||||
self._displayLine[self._scrollPos:])
|
self._displayLine[self._scrollPos:])
|
||||||
|
|
||||||
def tick1(self):
|
def tick1(self):
|
||||||
'''Do things that should be done often.
|
"""Do things that should be done often.
|
||||||
'''
|
"""
|
||||||
self._tickCount += 1
|
self._tickCount += 1
|
||||||
self._reapZombies()
|
self._reapZombies()
|
||||||
self._updateText()
|
self._updateText()
|
||||||
@@ -375,8 +365,8 @@ class Entry:
|
|||||||
self._doAction()
|
self._doAction()
|
||||||
|
|
||||||
def tick2(self):
|
def tick2(self):
|
||||||
'''Do things that should be done a bit less often.
|
"""Do things that should be done a bit less often.
|
||||||
'''
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def translateText(self, text):
|
def translateText(self, text):
|
||||||
@@ -403,8 +393,8 @@ class Entry:
|
|||||||
return self._displayLine
|
return self._displayLine
|
||||||
|
|
||||||
def _expandStr(self, s):
|
def _expandStr(self, s):
|
||||||
'''Expand s, which now should be a line from an on_mouseX field.
|
"""Expand s, which now should be a line from an on_mouseX field.
|
||||||
'''
|
"""
|
||||||
try:
|
try:
|
||||||
res = s % {'allText' : self._allText,
|
res = s % {'allText' : self._allText,
|
||||||
'displayedLine' : self._displayLine,
|
'displayedLine' : self._displayLine,
|
||||||
@@ -422,17 +412,17 @@ class Entry:
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def displayText(self, text):
|
def displayText(self, text):
|
||||||
'''Display text on the entry's line.
|
"""Display text on the entry's line.
|
||||||
|
|
||||||
Remove or translate characters that aren't supported. Truncate the text
|
Remove or translate characters that aren't supported. Truncate the text
|
||||||
to fit in the app.
|
to fit in the app.
|
||||||
'''
|
"""
|
||||||
x, y = getXY(self._line)
|
x, y = getXY(self._line)
|
||||||
clearLine(y)
|
clearLine(y)
|
||||||
addString(self.translateText(text)[:maxChars], x, y)
|
addString(self.translateText(text)[:maxChars], x, y)
|
||||||
|
|
||||||
def mouseClicked(self, button):
|
def mouseClicked(self, button):
|
||||||
'''A mouse button has been clicked, do things.'''
|
"""A mouse button has been clicked, do things."""
|
||||||
if 0 < button < 11:
|
if 0 < button < 11:
|
||||||
self._doMouseAction(button)
|
self._doMouseAction(button)
|
||||||
|
|
||||||
@@ -486,10 +476,10 @@ class PywmGeneric:
|
|||||||
width - 2 * xOffset, y + yOffset + letterHeight)
|
width - 2 * xOffset, y + yOffset + letterHeight)
|
||||||
|
|
||||||
def parseTimeStr(self, timeStr):
|
def parseTimeStr(self, timeStr):
|
||||||
'''Take a string on a form like 10h and return the number of seconds.
|
"""Take a string on a form like 10h and return the number of seconds.
|
||||||
|
|
||||||
Raise ValueError if timeStr is on a bad format.
|
Raise ValueError if timeStr is on a bad format.
|
||||||
'''
|
"""
|
||||||
multipliers = {'s' : 1, 'm' : 60, 'h' : 3600}
|
multipliers = {'s' : 1, 'm' : 60, 'h' : 3600}
|
||||||
timeStr = timeStr.strip()
|
timeStr = timeStr.strip()
|
||||||
if timeStr:
|
if timeStr:
|
||||||
@@ -530,7 +520,7 @@ class PywmGeneric:
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
def parseCommandLine(argv):
|
def parseCommandLine(argv):
|
||||||
'''Parse the commandline. Return a dictionary with options and values.'''
|
"""Parse the commandline. Return a dictionary with options and values."""
|
||||||
shorts = 'ht:b:r:c:'
|
shorts = 'ht:b:r:c:'
|
||||||
longs = ['help', 'text=', 'background=', 'rgbfile=', 'configfile=']
|
longs = ['help', 'text=', 'background=', 'rgbfile=', 'configfile=']
|
||||||
try:
|
try:
|
||||||
@@ -584,11 +574,11 @@ def parseColors(defaultRGBFileList, config, xpm):
|
|||||||
wmdocklib.setColor(xpm, value, code)
|
wmdocklib.setColor(xpm, value, code)
|
||||||
|
|
||||||
def readConfigFile(fileName):
|
def readConfigFile(fileName):
|
||||||
'''Read the config file.
|
"""Read the config file.
|
||||||
|
|
||||||
Return a list with dictionaries with the options and values in sections
|
Return a list with dictionaries with the options and values in sections
|
||||||
[0]-[4].
|
[0]-[4].
|
||||||
'''
|
"""
|
||||||
fileName = os.path.expanduser(fileName)
|
fileName = os.path.expanduser(fileName)
|
||||||
if not os.access(fileName, os.R_OK):
|
if not os.access(fileName, os.R_OK):
|
||||||
err("Can't read the configuration file %s.\n" % fileName)
|
err("Can't read the configuration file %s.\n" % fileName)
|
||||||
@@ -640,108 +630,73 @@ xpm = \
|
|||||||
'o\tc #2020b2b2aaaa s indicator',
|
'o\tc #2020b2b2aaaa s indicator',
|
||||||
'/\tc #2020b2b2aaaa s graph',
|
'/\tc #2020b2b2aaaa s graph',
|
||||||
'-\tc #707070707070 s graphbg',
|
'-\tc #707070707070 s graphbg',
|
||||||
'X\tc #000000000000 s background',
|
'_\tc #000000000000 s background',
|
||||||
'%\tc #2081B2CAAEBA s text',
|
'%\tc #2081B2CAAEBA s text',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX.......................................................................',
|
' .///..___..ooo..___..___.......................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX.......................................................................',
|
' .///..___..ooo..___..___.......................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX.......................................................................',
|
' .///..___..ooo..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................',
|
' ________________________________________________________ .///.._________________________________________________________................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................',
|
' ________________________________________________________ .///.._________________________________________________________................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................',
|
' ________________________________________________________ .///.._________________________________________________________................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................',
|
' ________________________________________________________ .///.._________________________________________________________................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................',
|
' ________________________________________________________ .///.._________________________________________________________................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................',
|
' ________________________________________________________ .///.._________________________________________________________................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................',
|
' ________________________________________________________ .///.._________________________________________________________................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX................................',
|
' ________________________________________________________ .///.._________________________________________________________................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo.......................................................................',
|
' ________________________________________________________ .///..___..___..___..ooo.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo.......................................................................',
|
' ________________________________________________________ .///..___..___..___..ooo.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo.......................................................................',
|
' ________________________________________________________ .///..___..___..___..ooo.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
] + wmdocklib.alfabet
|
||||||
'X%%%%%XXX%XXX%%%%%X%%%%%X%XXX%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%XXXXXXXXXX%XXXXXXXXXX%X%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XX%%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXXX%XXXXXXXXXXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXX%%XXXXXXXXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%%%%%XX%%%%X%%%%%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXXXXXX%XXX%%%%%XXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XXXXXXXX%%XXXXXXXXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XX%%XXXX%XXXXXXXXXXXX%XXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%%%%%XX%%%XX%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XX%%XXXX%XXXXXXXXXXXX%X%XXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'XX%%%XX%%%%XXX%%%%X%%%%XX%%%%XX%%%%%X%%%%%X%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%XXX%X%%%%XX%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%%%%%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%%X%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%X%XXX%X%XXX%XXXXX%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%X%X%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%XX%X%XX%XXX%XXXX%XXXXX',
|
|
||||||
'X%%%%%X%%%%XX%XXXXX%XXX%X%%%%XX%%%%XX%X%%%X%%%%%XXX%XXXXXXX%X%%%XXX%XXXXX%XXX%X%XXX%X%XXX%X%%%%%X%%XX%X%%%%XX%%%%%XXX%XXX%XXX%X%XXX%X%XXX%XXX%XXX%%%%%XXX%XXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%X%X%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%X%X%XX%X%XXXXXX%XX%XXXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXX%XXX%X%XXX%X%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%XX%%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%%X%%X%XXX%XXXXX%X%XXXXXXXX',
|
|
||||||
'X%XXX%X%%%%XXX%%%%X%%%%XX%%%%XX%XXXXX%%%%%X%XXX%XXX%XXXX%%%XX%XXX%X%%%%XX%XXX%X%XXX%X%%%%%X%XXXXX%%%%%X%XXX%X%%%%%XXX%XXXX%%%%XX%%%XX%XXX%X%XXX%X%%%%%X%%%%%XXXX',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................']
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ First working version
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
usage = '''pywmhdmon.py [options]
|
usage = """pywmhdmon.py [options]
|
||||||
Available options are:
|
Available options are:
|
||||||
-h, --help print this help
|
-h, --help print this help
|
||||||
-t, --textcolor <color> set the text color
|
-t, --textcolor <color> set the text color
|
||||||
@@ -48,7 +48,7 @@ Available options are:
|
|||||||
-c, --configfile <file> set the config file to use
|
-c, --configfile <file> set the config file to use
|
||||||
-p, --procstat <file> set the location of /proc/stat
|
-p, --procstat <file> set the location of /proc/stat
|
||||||
-s, --skipconf <num> determines how many configuration items to skip
|
-s, --skipconf <num> determines how many configuration items to skip
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@@ -57,22 +57,15 @@ import os
|
|||||||
|
|
||||||
import wmdocklib
|
import wmdocklib
|
||||||
|
|
||||||
|
from wmdocklib import letters, lettersStartX, lettersStartY, letterWidth, letterHeight
|
||||||
|
from wmdocklib import digits, digitsStartX, digitsStartY, digitWidth, digitHeight
|
||||||
|
|
||||||
width = 64
|
width = 64
|
||||||
height = 64
|
height = 64
|
||||||
|
|
||||||
xOffset = 4
|
xOffset = 4
|
||||||
yOffset = 4
|
yOffset = 4
|
||||||
|
|
||||||
lettersStartX = 0
|
|
||||||
lettersStartY = 74
|
|
||||||
letterWidth = 6
|
|
||||||
letterHeight = 8
|
|
||||||
|
|
||||||
digitsStartX = 0
|
|
||||||
digitsStartY = 64
|
|
||||||
digitWidth = 6
|
|
||||||
digitHeight = 8
|
|
||||||
|
|
||||||
graphStartX = 7
|
graphStartX = 7
|
||||||
graphStartY = 53
|
graphStartY = 53
|
||||||
graphHeight = 4
|
graphHeight = 4
|
||||||
@@ -83,9 +76,6 @@ graphBgStartY = 53
|
|||||||
graphLineStartX = 66
|
graphLineStartX = 66
|
||||||
graphLineStartY = 58
|
graphLineStartY = 58
|
||||||
|
|
||||||
letters = 'abcdefghijklmnopqrstuvwxyz'
|
|
||||||
digits = '0123456789:/-%. '
|
|
||||||
|
|
||||||
defaultConfigFile = os.environ['HOME']+'/.pywmhdmonrc'
|
defaultConfigFile = os.environ['HOME']+'/.pywmhdmonrc'
|
||||||
defaultRGBFiles = ('/usr/lib/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt')
|
defaultRGBFiles = ('/usr/lib/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt')
|
||||||
defaultProcStat = '/proc/stat'
|
defaultProcStat = '/proc/stat'
|
||||||
@@ -145,11 +135,11 @@ class PywmHDMon:
|
|||||||
return (total, free)
|
return (total, free)
|
||||||
|
|
||||||
def paintGraph(self, percentFilled, x, y, w, thin=None):
|
def paintGraph(self, percentFilled, x, y, w, thin=None):
|
||||||
'''Paint a graph with percentFilled percent filled.
|
"""Paint a graph with percentFilled percent filled.
|
||||||
|
|
||||||
Paint at position x, y and with width w.
|
Paint at position x, y and with width w.
|
||||||
if thin == 1, make it a thin line instead of a block.
|
if thin == 1, make it a thin line instead of a block.
|
||||||
'''
|
"""
|
||||||
paintWidth = int(round(percentFilled/100.0 * w))
|
paintWidth = int(round(percentFilled/100.0 * w))
|
||||||
if paintWidth > 0:
|
if paintWidth > 0:
|
||||||
wmdocklib.copyXPMArea(
|
wmdocklib.copyXPMArea(
|
||||||
@@ -311,7 +301,7 @@ def handler(num, frame):
|
|||||||
signal.alarm(10)
|
signal.alarm(10)
|
||||||
|
|
||||||
def parseCommandLine(argv):
|
def parseCommandLine(argv):
|
||||||
'''Parse the commandline. Return a dictionary with options and values.'''
|
"""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:'
|
||||||
longs = ['help', 'textcolor=', 'background=', 'barfgcolor=',
|
longs = ['help', 'textcolor=', 'background=', 'barfgcolor=',
|
||||||
'rgbfile=', 'configfile=', 'barbgcolor=', 'procstat=',
|
'rgbfile=', 'configfile=', 'barbgcolor=', 'procstat=',
|
||||||
@@ -376,9 +366,9 @@ def parseColors(defaultRGBFileList, config, xpm):
|
|||||||
wmdocklib.setColor(xpm, value, code)
|
wmdocklib.setColor(xpm, value, code)
|
||||||
|
|
||||||
def makeNumDigits(num, numDigits):
|
def makeNumDigits(num, numDigits):
|
||||||
'''Make a floating point number a certain number of digits, including
|
"""Make a floating point number a certain number of digits, including
|
||||||
decimal. Return a string containing it.
|
decimal. Return a string containing it.
|
||||||
'''
|
"""
|
||||||
lenOfIntPart = len(str(int(num)))
|
lenOfIntPart = len(str(int(num)))
|
||||||
if lenOfIntPart > numDigits:
|
if lenOfIntPart > numDigits:
|
||||||
# Can't convert a number to less digits then it's integer part...
|
# Can't convert a number to less digits then it's integer part...
|
||||||
@@ -486,7 +476,6 @@ def main():
|
|||||||
hdmon = PywmHDMon(pathsToMonitor, procStat, actMonEnabled, skipping)
|
hdmon = PywmHDMon(pathsToMonitor, procStat, actMonEnabled, skipping)
|
||||||
hdmon.mainLoop()
|
hdmon.mainLoop()
|
||||||
|
|
||||||
|
|
||||||
xpm = \
|
xpm = \
|
||||||
['160 100 13 1',
|
['160 100 13 1',
|
||||||
' \tc #208120812081',
|
' \tc #208120812081',
|
||||||
@@ -500,109 +489,73 @@ xpm = \
|
|||||||
'o\tc #2020b2b2aaaa s indicator',
|
'o\tc #2020b2b2aaaa s indicator',
|
||||||
'/\tc #2020b2b2aaaa s graph',
|
'/\tc #2020b2b2aaaa s graph',
|
||||||
'-\tc #707070707070 s graphbg',
|
'-\tc #707070707070 s graphbg',
|
||||||
'X\tc #000000000000 s background',
|
'_\tc #000000000000 s background',
|
||||||
'%\tc #2081B2CAAEBA s text',
|
'%\tc #2081B2CAAEBA s text',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX.......................................................................',
|
' .///..___..ooo..___..___.......................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX.......................................................................',
|
' .///..___..ooo..___..___.......................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX.......................................................................',
|
' .///..___..ooo..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..ooo..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..ooo..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..ooo..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..ooo..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..ooo..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..ooo..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo.......................................................................',
|
' ________________________________________________________ .///..___..___..___..ooo.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo.......................................................................',
|
' ________________________________________________________ .///..___..___..___..ooo.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo.......................................................................',
|
' ________________________________________________________ .///..___..___..___..ooo.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
] + wmdocklib.alfabet
|
||||||
'X%%%%%XXX%XXX%%%%%X%%%%%X%XXX%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%XXXXXXXXXX%XXXXXXXXXX%X%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XX%%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXXX%XXXXXXXXXXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXX%%XXXXXXXXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%%%%%XX%%%%X%%%%%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXXXXXX%XXX%%%%%XXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XXXXXXXX%%XXXXXXXXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XX%%XXXX%XXXXXXXXXXXX%XXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%%%%%XX%%%XX%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XX%%XXXX%XXXXXXXXXXXX%X%XXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'XX%%%XX%%%%XXX%%%%X%%%%XX%%%%XX%%%%%X%%%%%X%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%XXX%X%%%%XX%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%%%%%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%%X%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%X%XXX%X%XXX%XXXXX%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%X%X%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%XX%X%XX%XXX%XXXX%XXXXX',
|
|
||||||
'X%%%%%X%%%%XX%XXXXX%XXX%X%%%%XX%%%%XX%X%%%X%%%%%XXX%XXXXXXX%X%%%XXX%XXXXX%XXX%X%XXX%X%XXX%X%%%%%X%%XX%X%%%%XX%%%%%XXX%XXX%XXX%X%XXX%X%XXX%XXX%XXX%%%%%XXX%XXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%X%X%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%X%X%XX%X%XXXXXX%XX%XXXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXX%XXX%X%XXX%X%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%XX%%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%%X%%X%XXX%XXXXX%X%XXXXXXXX',
|
|
||||||
'X%XXX%X%%%%XXX%%%%X%%%%XX%%%%XX%XXXXX%%%%%X%XXX%XXX%XXXX%%%XX%XXX%X%%%%XX%XXX%X%XXX%X%%%%%X%XXXXX%%%%%X%XXX%X%%%%%XXX%XXXX%%%%XX%%%XX%XXX%X%XXX%X%%%%%X%%%%%XXXX',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................']
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
'''pywmseti.py
|
"""pywmseti.py
|
||||||
|
|
||||||
WindowMaker dockapp to monitor the progress of your seti@home.
|
WindowMaker dockapp to monitor the progress of your seti@home.
|
||||||
|
|
||||||
@@ -17,8 +17,8 @@ Added event handling for graceful shutdown
|
|||||||
2003-06-17 Kristoffer Erlandsson
|
2003-06-17 Kristoffer Erlandsson
|
||||||
First workingish version
|
First workingish version
|
||||||
|
|
||||||
'''
|
"""
|
||||||
usage = '''pywmseti.py [options]
|
usage = """pywmseti.py [options]
|
||||||
Available options are:
|
Available options are:
|
||||||
-h, --help print this help
|
-h, --help print this help
|
||||||
-t, --textcolor <color> set the text color
|
-t, --textcolor <color> set the text color
|
||||||
@@ -30,7 +30,7 @@ Available options are:
|
|||||||
-n, --nice <value> set the nice value to run seti@home with
|
-n, --nice <value> set the nice value to run seti@home with
|
||||||
-r, --rgbfile <file> set the rgb file to get color codes from
|
-r, --rgbfile <file> set the rgb file to get color codes from
|
||||||
-c, --configfile <file> set the config file to use
|
-c, --configfile <file> set the config file to use
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@@ -39,22 +39,15 @@ import os
|
|||||||
|
|
||||||
import wmdocklib
|
import wmdocklib
|
||||||
|
|
||||||
|
from wmdocklib import letters, lettersStartX, lettersStartY, letterWidth, letterHeight
|
||||||
|
from wmdocklib import digits, digitsStartX, digitsStartY, digitWidth, digitHeight
|
||||||
|
|
||||||
width = 64
|
width = 64
|
||||||
height = 64
|
height = 64
|
||||||
|
|
||||||
xOffset = 4
|
xOffset = 4
|
||||||
yOffset = 4
|
yOffset = 4
|
||||||
|
|
||||||
lettersStartX = 0
|
|
||||||
lettersStartY = 74
|
|
||||||
letterWidth = 6
|
|
||||||
letterHeight = 8
|
|
||||||
|
|
||||||
digitsStartX = 0
|
|
||||||
digitsStartY = 64
|
|
||||||
digitWidth = 6
|
|
||||||
digitHeight = 8
|
|
||||||
|
|
||||||
graphStartX = 7
|
graphStartX = 7
|
||||||
graphStartY = 53
|
graphStartY = 53
|
||||||
graphLength = 50
|
graphLength = 50
|
||||||
@@ -72,9 +65,6 @@ runningIndWidth = 3
|
|||||||
runningIndHeight = 15
|
runningIndHeight = 15
|
||||||
numRunningInds = 4
|
numRunningInds = 4
|
||||||
|
|
||||||
letters = 'abcdefghijklmnopqrstuvwxyz'
|
|
||||||
digits = '0123456789:/-% '
|
|
||||||
|
|
||||||
defaultConfigFile = '~/.pywmsetirc'
|
defaultConfigFile = '~/.pywmsetirc'
|
||||||
defaultRGBFiles = ['/usr/lib/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt']
|
defaultRGBFiles = ['/usr/lib/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt']
|
||||||
|
|
||||||
@@ -112,10 +102,10 @@ class PywmSeti:
|
|||||||
letterHeight, yOffset)
|
letterHeight, yOffset)
|
||||||
|
|
||||||
def getProgress(self, lines):
|
def getProgress(self, lines):
|
||||||
'''Return the progess of the current workunit.
|
"""Return the progess of the current workunit.
|
||||||
|
|
||||||
Supply the lines of the statefile as argument.
|
Supply the lines of the statefile as argument.
|
||||||
'''
|
"""
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.startswith('prog='):
|
if line.startswith('prog='):
|
||||||
try:
|
try:
|
||||||
@@ -126,10 +116,10 @@ class PywmSeti:
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
def getNumResults(self, lines):
|
def getNumResults(self, lines):
|
||||||
'''Return the number of results produced.
|
"""Return the number of results produced.
|
||||||
|
|
||||||
Supply the lines in the user info file as argument.
|
Supply the lines in the user info file as argument.
|
||||||
'''
|
"""
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.startswith('nresults='):
|
if line.startswith('nresults='):
|
||||||
try:
|
try:
|
||||||
@@ -143,14 +133,14 @@ class PywmSeti:
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
def pidIsRunning(self, pid):
|
def pidIsRunning(self, pid):
|
||||||
'''Determine if the process with PID pid is running.
|
"""Determine if the process with PID pid is running.
|
||||||
|
|
||||||
Return 1 if it is running.
|
Return 1 if it is running.
|
||||||
Return 0 if it is not running.
|
Return 0 if it is not running.
|
||||||
Return -1 if we do not have permission to signal the process
|
Return -1 if we do not have permission to signal the process
|
||||||
This could be slightly non-portal, but I can not find any better
|
This could be slightly non-portal, but I can not find any better
|
||||||
way to do it.
|
way to do it.
|
||||||
'''
|
"""
|
||||||
try:
|
try:
|
||||||
os.kill(pid, 0)
|
os.kill(pid, 0)
|
||||||
except OSError, e:
|
except OSError, e:
|
||||||
@@ -169,8 +159,8 @@ class PywmSeti:
|
|||||||
|
|
||||||
|
|
||||||
def paintCurrentRunningIndicator(self):
|
def paintCurrentRunningIndicator(self):
|
||||||
'''Paint the running indicator.
|
"""Paint the running indicator.
|
||||||
'''
|
"""
|
||||||
indX = runningIndX + self._currentRunningInd * \
|
indX = runningIndX + self._currentRunningInd * \
|
||||||
(runningIndWidth + 2)
|
(runningIndWidth + 2)
|
||||||
indY = runningIndY
|
indY = runningIndY
|
||||||
@@ -181,12 +171,12 @@ class PywmSeti:
|
|||||||
wmdocklib.copyXPMArea(indX, indY, w, h, targX, targY)
|
wmdocklib.copyXPMArea(indX, indY, w, h, targX, targY)
|
||||||
|
|
||||||
def updateRunning(self):
|
def updateRunning(self):
|
||||||
'''Update the information regarding if we got seti@home running or not.
|
"""Update the information regarding if we got seti@home running or not.
|
||||||
|
|
||||||
Return a tuple with (running, startStopenabled).
|
Return a tuple with (running, startStopenabled).
|
||||||
startStopEnabled is 1 if we own the process and got the permissions
|
startStopEnabled is 1 if we own the process and got the permissions
|
||||||
to start and stop it, or if there is no process running.
|
to start and stop it, or if there is no process running.
|
||||||
'''
|
"""
|
||||||
pidFile = self.openFileRead(self._pidPath)
|
pidFile = self.openFileRead(self._pidPath)
|
||||||
if pidFile is None:
|
if pidFile is None:
|
||||||
sys.stderr.write("Can't read pid file")
|
sys.stderr.write("Can't read pid file")
|
||||||
@@ -222,7 +212,7 @@ class PywmSeti:
|
|||||||
self.paintCurrentRunningIndicator()
|
self.paintCurrentRunningIndicator()
|
||||||
|
|
||||||
def updateProgress(self):
|
def updateProgress(self):
|
||||||
'''Update the progress on the current workunit.'''
|
"""Update the progress on the current workunit."""
|
||||||
stateFile = self.openFileRead(self._statePath)
|
stateFile = self.openFileRead(self._statePath)
|
||||||
if stateFile is None:
|
if stateFile is None:
|
||||||
# Can't open file, probably in progress of gettin a new workunit.
|
# Can't open file, probably in progress of gettin a new workunit.
|
||||||
@@ -242,7 +232,7 @@ class PywmSeti:
|
|||||||
self.addString((str(percent) + '%').ljust(4), 4, 32)
|
self.addString((str(percent) + '%').ljust(4), 4, 32)
|
||||||
|
|
||||||
def updateNumResults(self):
|
def updateNumResults(self):
|
||||||
'''Update the number of workunits done.'''
|
"""Update the number of workunits done."""
|
||||||
uinfoFile = self.openFileRead(self._uinfoPath)
|
uinfoFile = self.openFileRead(self._uinfoPath)
|
||||||
numResults = self.getNumResults(uinfoFile.readlines())
|
numResults = self.getNumResults(uinfoFile.readlines())
|
||||||
if self._lastNumResults == -1:
|
if self._lastNumResults == -1:
|
||||||
@@ -259,11 +249,11 @@ class PywmSeti:
|
|||||||
self.addString(str(numResults)[:7], 4, 4)
|
self.addString(str(numResults)[:7], 4, 4)
|
||||||
|
|
||||||
def updateTime(self):
|
def updateTime(self):
|
||||||
'''Update the time line.
|
"""Update the time line.
|
||||||
|
|
||||||
We display the time that we have been on the current work unit, since
|
We display the time that we have been on the current work unit, since
|
||||||
either the last one was done or since we started the program.
|
either the last one was done or since we started the program.
|
||||||
'''
|
"""
|
||||||
timeSpent = time.time() - self._lastTime
|
timeSpent = time.time() - self._lastTime
|
||||||
hours = int(timeSpent / 3600)
|
hours = int(timeSpent / 3600)
|
||||||
mins = int((timeSpent - hours * 3600) / 60)
|
mins = int((timeSpent - hours * 3600) / 60)
|
||||||
@@ -288,7 +278,7 @@ class PywmSeti:
|
|||||||
os.system(self._execCmd) # Use fork instead?
|
os.system(self._execCmd) # Use fork instead?
|
||||||
|
|
||||||
def _checkForEvents(self):
|
def _checkForEvents(self):
|
||||||
'''Check for, and handle, X events.'''
|
"""Check for, and handle, X events."""
|
||||||
event = wmdocklib.getEvent()
|
event = wmdocklib.getEvent()
|
||||||
while not event is None:
|
while not event is None:
|
||||||
if event['type'] == 'buttonrelease':
|
if event['type'] == 'buttonrelease':
|
||||||
@@ -318,7 +308,7 @@ class PywmSeti:
|
|||||||
|
|
||||||
|
|
||||||
def parseCommandLine(argv):
|
def parseCommandLine(argv):
|
||||||
'''Parse the commandline. Return a dictionary with options and values.'''
|
"""Parse the commandline. Return a dictionary with options and values."""
|
||||||
shorts = 'ht:b:n:d:r:c:p:g:i:'
|
shorts = 'ht:b:n:d:r:c:p:g:i:'
|
||||||
longs = ['help', 'textcolor=', 'background=', 'setidir=', 'nice=',
|
longs = ['help', 'textcolor=', 'background=', 'setidir=', 'nice=',
|
||||||
'rgbfile=', 'configfile=', 'progressbarcolor=', 'barbgcolor=',
|
'rgbfile=', 'configfile=', 'progressbarcolor=', 'barbgcolor=',
|
||||||
@@ -443,108 +433,73 @@ xpm = \
|
|||||||
'o\tc #2020b2b2aaaa s indicator',
|
'o\tc #2020b2b2aaaa s indicator',
|
||||||
'/\tc #2020b2b2aaaa s graph',
|
'/\tc #2020b2b2aaaa s graph',
|
||||||
'-\tc #707070707070 s graphbg',
|
'-\tc #707070707070 s graphbg',
|
||||||
'X\tc #000000000000 s background',
|
'_\tc #000000000000 s background',
|
||||||
'%\tc #2081B2CAAEBA s text',
|
'%\tc #2081B2CAAEBA s text',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX.......................................................................',
|
' .///..___..ooo..___..___.......................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX.......................................................................',
|
' .///..___..ooo..___..___.......................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX.......................................................................',
|
' .///..___..ooo..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..ooo..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..ooo..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..ooo..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..ooo..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..ooo..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..ooo..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX.......................................................................',
|
' ________________________________________________________ .///..___..___..___..___.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo.......................................................................',
|
' ________________________________________________________ .///..___..___..___..ooo.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo.......................................................................',
|
' ________________________________________________________ .///..___..___..___..ooo.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo.......................................................................',
|
' ________________________________________________________ .///..___..___..___..ooo.......................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
] + wmdocklib.alfabet
|
||||||
'X%%%%%XXX%XXX%%%%%X%%%%%X%XXX%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%XXXXXXXXXX%XXXXXXXXXX%X%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XX%%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXXX%XXXXXXXXXXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXX%%XXXXXXXXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%%%%%XX%%%%X%%%%%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXXXXXX%XXX%%%%%XXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XXXXXXXX%%XXXXXXXXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XX%%XXXX%XXXXXXXXXXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%%%%%XX%%%XX%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XX%%XXXX%XXXXXXXXXXXX%X%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'XX%%%XX%%%%XXX%%%%X%%%%XX%%%%XX%%%%%X%%%%%X%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%XXX%X%%%%XX%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%%%%%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%%X%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%X%XXX%X%XXX%XXXXX%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%X%X%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%XX%X%XX%XXX%XXXX%XXXXX',
|
|
||||||
'X%%%%%X%%%%XX%XXXXX%XXX%X%%%%XX%%%%XX%X%%%X%%%%%XXX%XXXXXXX%X%%%XXX%XXXXX%XXX%X%XXX%X%XXX%X%%%%%X%%XX%X%%%%XX%%%%%XXX%XXX%XXX%X%XXX%X%XXX%XXX%XXX%%%%%XXX%XXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%X%X%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%X%X%XX%X%XXXXXX%XX%XXXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXX%XXX%X%XXX%X%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%XX%%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%%X%%X%XXX%XXXXX%X%XXXXXXXX',
|
|
||||||
'X%XXX%X%%%%XXX%%%%X%%%%XX%%%%XX%XXXXX%%%%%X%XXX%XXX%XXXX%%%XX%XXX%X%%%%XX%XXX%X%XXX%X%%%%%X%XXXXX%%%%%X%XXX%X%%%%%XXX%XXXX%%%%XX%%%XX%XXX%X%XXX%X%%%%%X%%%%%XXXX',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................']
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -38,22 +38,15 @@ import os
|
|||||||
|
|
||||||
import wmdocklib
|
import wmdocklib
|
||||||
|
|
||||||
|
from wmdocklib import letters, lettersStartX, lettersStartY, letterWidth, letterHeight
|
||||||
|
from wmdocklib import digits, digitsStartX, digitsStartY, digitWidth, digitHeight
|
||||||
|
|
||||||
width = 64
|
width = 64
|
||||||
height = 64
|
height = 64
|
||||||
|
|
||||||
xOffset = 4
|
xOffset = 4
|
||||||
yOffset = 4
|
yOffset = 4
|
||||||
|
|
||||||
lettersStartX = 0
|
|
||||||
lettersStartY = 74
|
|
||||||
letterWidth = 6
|
|
||||||
letterHeight = 8
|
|
||||||
|
|
||||||
digitsStartX = 0
|
|
||||||
digitsStartY = 64
|
|
||||||
digitWidth = 6
|
|
||||||
digitHeight = 8
|
|
||||||
|
|
||||||
hGraphStartX = 7
|
hGraphStartX = 7
|
||||||
hGraphStartY = 53
|
hGraphStartY = 53
|
||||||
hGraphHeight = 4
|
hGraphHeight = 4
|
||||||
@@ -76,9 +69,6 @@ vGraphLineStartY = 1
|
|||||||
vGraphBgStartX = 97
|
vGraphBgStartX = 97
|
||||||
vGraphBgStartY = 1
|
vGraphBgStartY = 1
|
||||||
|
|
||||||
letters = 'abcdefghijklmnopqrstuvwxyz'
|
|
||||||
digits = '0123456789:/-%. '
|
|
||||||
|
|
||||||
defaultConfigFile = '~/.pywmhdmonrc'
|
defaultConfigFile = '~/.pywmhdmonrc'
|
||||||
defaultRGBFiles = ('/usr/lib/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt')
|
defaultRGBFiles = ('/usr/lib/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt')
|
||||||
defaultProcStat = '/proc/stat'
|
defaultProcStat = '/proc/stat'
|
||||||
@@ -369,108 +359,73 @@ xpm = \
|
|||||||
'-\tc #707070707070 s graphbg',
|
'-\tc #707070707070 s graphbg',
|
||||||
'|\tc #2020b2b2aaaa s vgraph',
|
'|\tc #2020b2b2aaaa s vgraph',
|
||||||
'I\tc #707070707070 s vgraphbg',
|
'I\tc #707070707070 s vgraphbg',
|
||||||
'X\tc #000000000000 s background',
|
'_\tc #000000000000 s background',
|
||||||
'%\tc #2081B2CAAEBA s text',
|
'%\tc #2081B2CAAEBA s text',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX......|.I..............................................................',
|
' .///..___..ooo..___..___......|.I..............................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX......|.I..............................................................',
|
' .///..___..ooo..___..___......|.I..............................................................',
|
||||||
' .///..XXX..ooo..XXX..XXX......|.I..............................................................',
|
' .///..___..ooo..___..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..___..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..___..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..___..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..ooo..XXX......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..ooo..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..ooo..XXX......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..ooo..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..ooo..XXX......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..ooo..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..___..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..___..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..XXX......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..___..___......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..___..ooo......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..___..ooo......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..XXX..XXX..XXX..ooo......|.I..............................................................',
|
' ________________________________________________________ .///..___..___..___..ooo......|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///..........................|.I..............................................................',
|
' ________________________________________________________ .///..........................|.I..............................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...-------------------------------------------------------------------------------------...',
|
' ________________________________________________________ .///...-------------------------------------------------------------------------------------...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///...........................................................................................',
|
' ________________________________________________________ .///...........................................................................................',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' ________________________________________________________ .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
' .///////////////////////////////////////////////////////////////////////////////////////////...',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
' ...............................................................................................',
|
' ...............................................................................................',
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
] + wmdocklib.alfabet
|
||||||
'X%%%%%XXX%XXX%%%%%X%%%%%X%XXX%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%XXXXXXXXXX%XXXXXXXXXX%X%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XX%%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXXX%XXXXXXXXXXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXXXXXX%XXXXX%X%XXX%X%XXXXX%XXXXXXXXX%X%XXX%X%XXX%XX%%XXXXX%%XXXXXXXXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%%%%%XX%%%%X%%%%%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXXXXXX%XXX%%%%%XXXX%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XXXXXXXX%%XXXXXXXXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%XXX%XXX%XXX%XXXXXXXXX%XXXXX%XXXXX%X%XXX%XXXXX%X%XXX%XXXXX%XX%%XXXX%XXXXXXXXXXXX%XXXXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'X%%%%%XX%%%XX%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XXXXX%X%%%%%X%%%%%XX%%XXXX%XXXXXXXXXXXX%X%XXX%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX............................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'XX%%%XX%%%%XXX%%%%X%%%%XX%%%%XX%%%%%X%%%%%X%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%XXX%X%%%%XX%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%%%%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%%%%%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XXX%X%XXXXX%%X%%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%X%XXX%X%XXX%XXXXX%XXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXXXX%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%X%X%X%XXX%X%XXX%X%XXX%X%XXX%X%XXX%X%XXXXXXX%XXX%XXX%X%XXX%X%XXX%XX%X%XX%XXX%XXXX%XXXXX',
|
|
||||||
'X%%%%%X%%%%XX%XXXXX%XXX%X%%%%XX%%%%XX%X%%%X%%%%%XXX%XXXXXXX%X%%%XXX%XXXXX%XXX%X%XXX%X%XXX%X%%%%%X%%XX%X%%%%XX%%%%%XXX%XXX%XXX%X%XXX%X%XXX%XXX%XXX%%%%%XXX%XXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXXXXXX%X%XX%XX%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%X%X%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%X%X%XX%X%XXXXXX%XX%XXXXXXX',
|
|
||||||
'X%XXX%X%XXX%X%XXXXX%XXX%X%XXXXX%XXXXX%XXX%X%XXX%XXX%XXX%XXX%X%XXX%X%XXXXX%XXX%X%XXX%X%XXX%X%XXXXX%XX%%X%XXX%XXXXX%XXX%XXX%XXX%X%XXX%X%%X%%X%XXX%XXXXX%X%XXXXXXXX',
|
|
||||||
'X%XXX%X%%%%XXX%%%%X%%%%XX%%%%XX%XXXXX%%%%%X%XXX%XXX%XXXX%%%XX%XXX%X%%%%XX%XXX%X%XXX%X%%%%%X%XXXXX%%%%%X%XXX%X%%%%%XXX%XXXX%%%%XX%%%XX%XXX%X%XXX%X%%%%%X%%%%%XXXX',
|
|
||||||
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................',
|
|
||||||
'................................................................................................................................................................']
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -47,18 +47,18 @@
|
|||||||
/* X11 Variables */
|
/* X11 Variables */
|
||||||
/*****************/
|
/*****************/
|
||||||
|
|
||||||
Window Root;
|
Window Root;
|
||||||
int screen;
|
int screen;
|
||||||
int x_fd;
|
int x_fd;
|
||||||
int d_depth;
|
int d_depth;
|
||||||
XSizeHints mysizehints;
|
XSizeHints mysizehints;
|
||||||
XWMHints mywmhints;
|
XWMHints mywmhints;
|
||||||
Pixel back_pix, fore_pix;
|
Pixel back_pix, fore_pix;
|
||||||
char *Geometry = "";
|
char *Geometry = "";
|
||||||
Window iconwin, win;
|
Window iconwin, win;
|
||||||
GC NormalGC;
|
GC NormalGC;
|
||||||
XpmIcon wmgen;
|
XpmIcon wmgen;
|
||||||
Pixmap pixmask;
|
Pixmap pixmask;
|
||||||
Atom deleteAtom; /* Added 2003-06-24 for graceful shutdown. */
|
Atom deleteAtom; /* Added 2003-06-24 for graceful shutdown. */
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -165,16 +165,16 @@ pywmgeneral_checkMouseRegion(PyObject *self, PyObject *args) {
|
|||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pywmgeneral_copyXPMArea(PyObject *self, PyObject *args) {
|
pywmgeneral_copyXPMArea(PyObject *self, PyObject *args) {
|
||||||
/* x - source x, y - source y
|
/* sx - source x, sy - source y
|
||||||
* sx - width, sy - height
|
* sw - width, sw - height
|
||||||
* dx - destination x, dy - destination y
|
* dx - destination x, dy - destination y
|
||||||
*
|
*
|
||||||
* Variables named as in the original wmgeneral.c, don't blame me for it :)
|
* in the original wmgeneral.c variables are named differently.
|
||||||
*/
|
*/
|
||||||
int x, y, sx, sy, dx, dy;
|
int sx, sy, sw, sh, dx, dy;
|
||||||
if (!PyArg_ParseTuple(args, "iiiiii", &x, &y, &sx, &sy, &dx, &dy))
|
if (!PyArg_ParseTuple(args, "iiiiii", &sx, &sy, &sw, &sh, &dx, &dy))
|
||||||
return NULL;
|
return NULL;
|
||||||
copyXPMArea(x, y, sx, sy, dx, dy);
|
copyXPMArea(sx, sy, sw, sh, dx, dy);
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
@@ -248,14 +248,14 @@ void initpywmgeneral(void) {
|
|||||||
/*****************/
|
/*****************/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int enable;
|
int enable;
|
||||||
int top;
|
int top;
|
||||||
int bottom;
|
int bottom;
|
||||||
int left;
|
int left;
|
||||||
int right;
|
int right;
|
||||||
} MOUSE_REGION;
|
} MOUSE_REGION;
|
||||||
|
|
||||||
MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
|
MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
|
||||||
|
|
||||||
/***********************/
|
/***********************/
|
||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
@@ -268,142 +268,142 @@ void AddMouseRegion(int, int, int, int, int);
|
|||||||
int CheckMouseRegion(int, int);
|
int CheckMouseRegion(int, int);
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* GetXPM *|
|
|* GetXPM *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
|
static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
|
||||||
|
|
||||||
XWindowAttributes attributes;
|
XWindowAttributes attributes;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* For the colormap */
|
/* For the colormap */
|
||||||
XGetWindowAttributes(display, Root, &attributes);
|
XGetWindowAttributes(display, Root, &attributes);
|
||||||
|
|
||||||
wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
|
wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
|
||||||
|
|
||||||
err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
|
err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
|
||||||
&(wmgen->mask), &(wmgen->attributes));
|
&(wmgen->mask), &(wmgen->attributes));
|
||||||
|
|
||||||
if (err != XpmSuccess) {
|
if (err != XpmSuccess) {
|
||||||
fprintf(stderr, "Not enough free colorcells.\n");
|
fprintf(stderr, "Not enough free colorcells.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* GetColor *|
|
|* GetColor *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
static Pixel GetColor(char *name) {
|
static Pixel GetColor(char *name) {
|
||||||
|
|
||||||
XColor color;
|
XColor color;
|
||||||
XWindowAttributes attributes;
|
XWindowAttributes attributes;
|
||||||
|
|
||||||
XGetWindowAttributes(display, Root, &attributes);
|
XGetWindowAttributes(display, Root, &attributes);
|
||||||
|
|
||||||
color.pixel = 0;
|
color.pixel = 0;
|
||||||
if (!XParseColor(display, attributes.colormap, name, &color)) {
|
if (!XParseColor(display, attributes.colormap, name, &color)) {
|
||||||
fprintf(stderr, "wm.app: can't parse %s.\n", name);
|
fprintf(stderr, "wm.app: can't parse %s.\n", name);
|
||||||
} else if (!XAllocColor(display, attributes.colormap, &color)) {
|
} else if (!XAllocColor(display, attributes.colormap, &color)) {
|
||||||
fprintf(stderr, "wm.app: can't allocate %s.\n", name);
|
fprintf(stderr, "wm.app: can't allocate %s.\n", name);
|
||||||
}
|
}
|
||||||
return color.pixel;
|
return color.pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* flush_expose *|
|
|* flush_expose *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
static int flush_expose(Window w) {
|
static int flush_expose(Window w) {
|
||||||
|
|
||||||
XEvent dummy;
|
XEvent dummy;
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
|
while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* RedrawWindow *|
|
|* RedrawWindow *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
void RedrawWindow(void) {
|
void RedrawWindow(void) {
|
||||||
|
|
||||||
flush_expose(iconwin);
|
flush_expose(iconwin);
|
||||||
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
|
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
|
||||||
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
||||||
flush_expose(win);
|
flush_expose(win);
|
||||||
XCopyArea(display, wmgen.pixmap, win, NormalGC,
|
XCopyArea(display, wmgen.pixmap, win, NormalGC,
|
||||||
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* RedrawWindowXY *|
|
|* RedrawWindowXY *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
void RedrawWindowXY(int x, int y) {
|
void RedrawWindowXY(int x, int y) {
|
||||||
|
|
||||||
flush_expose(iconwin);
|
flush_expose(iconwin);
|
||||||
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
|
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
|
||||||
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
||||||
flush_expose(win);
|
flush_expose(win);
|
||||||
XCopyArea(display, wmgen.pixmap, win, NormalGC,
|
XCopyArea(display, wmgen.pixmap, win, NormalGC,
|
||||||
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* AddMouseRegion *|
|
|* AddMouseRegion *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
void AddMouseRegion(int index, int left, int top, int right, int bottom) {
|
void AddMouseRegion(int index, int left, int top, int right, int bottom) {
|
||||||
|
|
||||||
if (index < MAX_MOUSE_REGION) {
|
if (index < MAX_MOUSE_REGION) {
|
||||||
mouse_region[index].enable = 1;
|
mouse_region[index].enable = 1;
|
||||||
mouse_region[index].top = top;
|
mouse_region[index].top = top;
|
||||||
mouse_region[index].left = left;
|
mouse_region[index].left = left;
|
||||||
mouse_region[index].bottom = bottom;
|
mouse_region[index].bottom = bottom;
|
||||||
mouse_region[index].right = right;
|
mouse_region[index].right = right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* CheckMouseRegion *|
|
|* CheckMouseRegion *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
int CheckMouseRegion(int x, int y) {
|
int CheckMouseRegion(int x, int y) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
found = 0;
|
found = 0;
|
||||||
|
|
||||||
for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
|
for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
|
||||||
if (mouse_region[i].enable &&
|
if (mouse_region[i].enable &&
|
||||||
x <= mouse_region[i].right &&
|
x <= mouse_region[i].right &&
|
||||||
x >= mouse_region[i].left &&
|
x >= mouse_region[i].left &&
|
||||||
y <= mouse_region[i].bottom &&
|
y <= mouse_region[i].bottom &&
|
||||||
y >= mouse_region[i].top)
|
y >= mouse_region[i].top)
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
if (!found) return -1;
|
if (!found) return -1;
|
||||||
return (i-1);
|
return (i-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* createXBMfromXPM *|
|
|* createXBMfromXPM *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
|
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
|
||||||
|
|
||||||
int i,j,k;
|
int i,j,k;
|
||||||
int width, height, numcol, depth;
|
int width, height, numcol, depth;
|
||||||
int zero=0;
|
int zero=0;
|
||||||
unsigned char bwrite;
|
unsigned char bwrite;
|
||||||
int bcount;
|
int bcount;
|
||||||
int curpixel;
|
int curpixel;
|
||||||
|
|
||||||
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
|
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
|
||||||
|
|
||||||
|
|
||||||
for (k=0; k!=depth; k++)
|
for (k=0; k!=depth; k++)
|
||||||
@@ -412,10 +412,10 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
|
|||||||
zero |= xpm[1][k];
|
zero |= xpm[1][k];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=numcol+1; i < numcol+sy+1; i++) {
|
for (i=numcol+1; i < numcol+sy+1; i++) {
|
||||||
bcount = 0;
|
bcount = 0;
|
||||||
bwrite = 0;
|
bwrite = 0;
|
||||||
for (j=0; j<sx*depth; j+=depth) {
|
for (j=0; j<sx*depth; j+=depth) {
|
||||||
bwrite >>= 1;
|
bwrite >>= 1;
|
||||||
|
|
||||||
curpixel=0;
|
curpixel=0;
|
||||||
@@ -426,114 +426,118 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( curpixel != zero ) {
|
if ( curpixel != zero ) {
|
||||||
bwrite += 128;
|
bwrite += 128;
|
||||||
}
|
}
|
||||||
bcount++;
|
bcount++;
|
||||||
if (bcount == 8) {
|
if (bcount == 8) {
|
||||||
*xbm = bwrite;
|
*xbm = bwrite;
|
||||||
xbm++;
|
xbm++;
|
||||||
bcount = 0;
|
bcount = 0;
|
||||||
bwrite = 0;
|
bwrite = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* copyXPMArea *|
|
|* copyXPMArea *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
|
void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
|
||||||
|
/* in pywmgeneral_copyXPMArea variables are named differently.
|
||||||
|
*/
|
||||||
|
|
||||||
XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
|
XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* copyXBMArea *|
|
|* copyXBMArea *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
|
void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
|
||||||
|
|
||||||
XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
|
XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* setMaskXY *|
|
|* setMaskXY *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
|
|
||||||
void setMaskXY(int x, int y) {
|
void setMaskXY(int x, int y) {
|
||||||
|
|
||||||
XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
|
XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
|
||||||
XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
|
XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************\
|
/*******************************************************************************\
|
||||||
|* openXwindow *|
|
|* openXwindow *|
|
||||||
\*******************************************************************************/
|
\*******************************************************************************/
|
||||||
void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
|
void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
|
||||||
|
|
||||||
unsigned int borderwidth = 1;
|
unsigned int borderwidth = 1;
|
||||||
XClassHint classHint;
|
XClassHint classHint;
|
||||||
char *display_name = NULL;
|
char *display_name = NULL;
|
||||||
char *wname = argv[0];
|
char *wname = argv[0];
|
||||||
XTextProperty name;
|
XTextProperty name;
|
||||||
|
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
unsigned long gcm;
|
unsigned long gcm;
|
||||||
|
|
||||||
char *geometry = NULL;
|
char *geometry = NULL;
|
||||||
|
|
||||||
int dummy=0;
|
int dummy=0;
|
||||||
int i, wx, wy;
|
int i, wx, wy;
|
||||||
|
|
||||||
/* Changed to work better with Python. Changed check in for loop to control
|
/* Changed to work better with Python. Changed check in for loop to control
|
||||||
* argc instead of argv.
|
* argc instead of argv.
|
||||||
*/
|
*/
|
||||||
for (i=1; i < argc; i++) {
|
for (i=1; i < argc; i++) {
|
||||||
if (!strcmp(argv[i], "-display")) {
|
if (!strcmp(argv[i], "-display")) {
|
||||||
display_name = argv[i+1];
|
display_name = argv[i+1];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (!strcmp(argv[i], "-geometry")) {
|
if (!strcmp(argv[i], "-geometry")) {
|
||||||
geometry = argv[i+1];
|
geometry = argv[i+1];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(display = XOpenDisplay(display_name))) {
|
if (!(display = XOpenDisplay(display_name))) {
|
||||||
fprintf(stderr, "%s: can't open display %s\n",
|
fprintf(stderr, "%s: can't open display %s\n",
|
||||||
wname, XDisplayName(display_name));
|
wname, XDisplayName(display_name));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
screen = DefaultScreen(display);
|
screen = DefaultScreen(display);
|
||||||
Root = RootWindow(display, screen);
|
Root = RootWindow(display, screen);
|
||||||
d_depth = DefaultDepth(display, screen);
|
d_depth = DefaultDepth(display, screen);
|
||||||
x_fd = XConnectionNumber(display);
|
x_fd = XConnectionNumber(display);
|
||||||
|
|
||||||
/* Convert XPM to XImage */
|
/* Convert XPM to XImage */
|
||||||
GetXPM(&wmgen, pixmap_bytes);
|
GetXPM(&wmgen, pixmap_bytes);
|
||||||
|
|
||||||
/* Create a window to hold the stuff */
|
/* Create a window to hold the stuff */
|
||||||
mysizehints.flags = USSize | USPosition;
|
mysizehints.flags = USSize | USPosition;
|
||||||
mysizehints.x = 0;
|
mysizehints.x = 0;
|
||||||
mysizehints.y = 0;
|
mysizehints.y = 0;
|
||||||
|
|
||||||
back_pix = GetColor("white");
|
back_pix = GetColor("white");
|
||||||
fore_pix = GetColor("black");
|
fore_pix = GetColor("black");
|
||||||
|
|
||||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||||
|
|
||||||
mysizehints.width = 64;
|
mysizehints.width = 64;
|
||||||
mysizehints.height = 64;
|
mysizehints.height = 64;
|
||||||
|
|
||||||
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
|
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
|
||||||
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
|
mysizehints.width, mysizehints.height, borderwidth,
|
||||||
|
fore_pix, back_pix);
|
||||||
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
|
|
||||||
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
|
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
|
||||||
|
mysizehints.width, mysizehints.height, borderwidth,
|
||||||
|
fore_pix, back_pix);
|
||||||
|
|
||||||
|
|
||||||
/* Added 2003-06-24 for graceful shutdown. */
|
/* Added 2003-06-24 for graceful shutdown. */
|
||||||
@@ -541,56 +545,56 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||||||
XSetWMProtocols(display, win, &deleteAtom, 1);
|
XSetWMProtocols(display, win, &deleteAtom, 1);
|
||||||
|
|
||||||
|
|
||||||
/* Activate hints */
|
/* Activate hints */
|
||||||
XSetWMNormalHints(display, win, &mysizehints);
|
XSetWMNormalHints(display, win, &mysizehints);
|
||||||
classHint.res_name = wname;
|
classHint.res_name = wname;
|
||||||
classHint.res_class = wname;
|
classHint.res_class = wname;
|
||||||
XSetClassHint(display, win, &classHint);
|
XSetClassHint(display, win, &classHint);
|
||||||
|
|
||||||
XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
|
XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
|
||||||
XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
|
XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
|
||||||
|
|
||||||
if (XStringListToTextProperty(&wname, 1, &name) == 0) {
|
if (XStringListToTextProperty(&wname, 1, &name) == 0) {
|
||||||
fprintf(stderr, "%s: can't allocate window name\n", wname);
|
fprintf(stderr, "%s: can't allocate window name\n", wname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetWMName(display, win, &name);
|
XSetWMName(display, win, &name);
|
||||||
|
|
||||||
/* Create GC for drawing */
|
/* Create GC for drawing */
|
||||||
|
|
||||||
gcm = GCForeground | GCBackground | GCGraphicsExposures;
|
gcm = GCForeground | GCBackground | GCGraphicsExposures;
|
||||||
gcv.foreground = fore_pix;
|
gcv.foreground = fore_pix;
|
||||||
gcv.background = back_pix;
|
gcv.background = back_pix;
|
||||||
gcv.graphics_exposures = 0;
|
gcv.graphics_exposures = 0;
|
||||||
NormalGC = XCreateGC(display, Root, gcm, &gcv);
|
NormalGC = XCreateGC(display, Root, gcm, &gcv);
|
||||||
|
|
||||||
/* ONLYSHAPE ON */
|
/* ONLYSHAPE ON */
|
||||||
|
|
||||||
pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height);
|
pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height);
|
||||||
|
|
||||||
XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
|
XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
|
||||||
XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
|
XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
|
||||||
|
|
||||||
/* ONLYSHAPE OFF */
|
/* ONLYSHAPE OFF */
|
||||||
|
|
||||||
mywmhints.initial_state = WithdrawnState;
|
mywmhints.initial_state = WithdrawnState;
|
||||||
mywmhints.icon_window = iconwin;
|
mywmhints.icon_window = iconwin;
|
||||||
mywmhints.icon_x = mysizehints.x;
|
mywmhints.icon_x = mysizehints.x;
|
||||||
mywmhints.icon_y = mysizehints.y;
|
mywmhints.icon_y = mysizehints.y;
|
||||||
mywmhints.window_group = win;
|
mywmhints.window_group = win;
|
||||||
mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
|
mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
|
||||||
|
|
||||||
XSetWMHints(display, win, &mywmhints);
|
XSetWMHints(display, win, &mywmhints);
|
||||||
|
|
||||||
XSetCommand(display, win, argv, argc);
|
XSetCommand(display, win, argv, argc);
|
||||||
XMapWindow(display, win);
|
XMapWindow(display, win);
|
||||||
|
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
|
if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
|
||||||
fprintf(stderr, "Bad geometry string.\n");
|
fprintf(stderr, "Bad geometry string.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
XMoveWindow(display, win, wx, wy);
|
XMoveWindow(display, win, wx, wy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,3 +251,54 @@ def getColorCode(colorName, rgbFileName):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
digits = '0123456789:/-%. '
|
||||||
|
letters = 'abcdefghijklmnopqrstuvwxyz'
|
||||||
|
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
||||||
|
lettersStartX = 0
|
||||||
|
lettersStartY = 74
|
||||||
|
letterWidth = 6
|
||||||
|
letterHeight = 8
|
||||||
|
|
||||||
|
digitsStartX = 0
|
||||||
|
digitsStartY = 64
|
||||||
|
digitWidth = 6
|
||||||
|
digitHeight = 8
|
||||||
|
|
||||||
|
alfabet = [\
|
||||||
|
'____________________________________________________________________________________________________________________________________............................',
|
||||||
|
'__%%%____%____%%%___%%%_____%__%%%%%__%%%__%%%%%__%%%___%%%___________%________%%__%________________________________________________............................',
|
||||||
|
'_%___%__%%___%___%_%___%___%%__%_____%___%_%___%_%___%_%___%__%%______%________%%_%%________________________________________________............................',
|
||||||
|
'_%__%%___%_______%_____%__%_%__%%%%__%________%__%___%_%___%__%%_____%%__________%%_________________________________________________............................',
|
||||||
|
'_%_%_%___%______%____%%__%__%______%_%%%%____%____%%%___%%%%_________%___%%%%%___%__________________________________________________............................',
|
||||||
|
'_%%__%___%_____%_______%_%%%%%_____%_%___%___%___%___%_____%________%%__________%%__________________________________________________............................',
|
||||||
|
'_%___%___%____%____%___%____%__%___%_%___%___%___%___%_%___%__%%____%__________%%_%%__%%____________________________________________............................',
|
||||||
|
'__%%%___%%%__%%%%%__%%%_____%___%%%___%%%____%____%%%___%%%___%%____%__________%__%%__%%____________________________________________............................',
|
||||||
|
'____________________________________________________________________________________________________________________________________............................',
|
||||||
|
'................................................................................................................................................................',
|
||||||
|
'________________________________________________________________________________________________________________________________________________________________',
|
||||||
|
'_______%______________%__________%%________%______%_______%__%______%___________________________________________________________________________________________',
|
||||||
|
'_______%______________%_________%__________%_________________%______%_______________________________________________%___________________________________________',
|
||||||
|
'__%%___%%%____%%____%%%___%%____%_____%%%__%%%____%_______%__%__%___%____%%_%__%%%____%%___%%%____%%%__%%%____%%%__%%%___%__%__%__%__%___%_%___%_%__%__%%%%%____',
|
||||||
|
'____%__%__%__%_____%__%__%__%___%%___%__%__%__%___%_______%__%_%____%____%_%_%_%__%__%__%__%__%__%__%__%__%__%______%____%__%__%__%__%_%_%__%_%__%__%_____%_____',
|
||||||
|
'__%%%__%__%__%_____%__%__%%%%___%____%__%__%__%___%_______%__%%_____%____%_%_%_%__%__%__%__%__%__%__%__%______%%____%____%__%__%__%__%_%_%___%___%__%____%______',
|
||||||
|
'_%__%__%__%__%_____%__%__%______%_____%%%__%__%___%_______%__%_%____%____%_%_%_%__%__%__%__%%%____%%%__%________%___%____%__%___%%___%_%_%__%_%___%%%___%_______',
|
||||||
|
'__%%%__%%%____%%____%%%___%%____%_______%__%__%___%_______%__%__%___%____%_%_%_%__%___%%___%________%__%_____%%%_____%%___%%%___%%____%_%__%___%___%___%%%%%____',
|
||||||
|
'_____________________________________%%%________________%%_________________________________%________%____________________________________________%%_____________',
|
||||||
|
'................................................................................................................................................................',
|
||||||
|
'________________________________________________________________________________________________________________________________________________________________',
|
||||||
|
'___%___%%%%___%%%__%%%%__%%%%%_%%%%%__%%%__%___%__%%%____%%%_%___%_%_____%___%_%___%__%%%__%%%%___%%%__%%%%___%%%__%%%%%_%___%_%___%_%___%_%___%_%___%_%%%%%____',
|
||||||
|
'__%_%__%___%_%___%_%___%_%_____%_____%___%_%___%___%______%__%__%__%_____%%_%%_%%__%_%___%_%___%_%___%_%___%_%___%___%___%___%_%___%_%___%_%___%_%___%_____%____',
|
||||||
|
'_%___%_%___%_%_____%___%_%_____%_____%_____%___%___%______%__%_%___%_____%_%_%_%%%_%_%___%_%___%_%___%_%___%_%_______%___%___%_%___%_%___%__%_%__%___%____%_____',
|
||||||
|
'_%___%_%%%%__%_____%___%_%%%___%%%___%__%%_%%%%%___%______%__%%____%_____%_%_%_%_%%%_%___%_%%%%__%___%_%%%%___%%%____%___%___%_%___%_%_%_%___%____%_%____%______',
|
||||||
|
'_%%%%%_%___%_%_____%___%_%_____%_____%___%_%___%___%______%__%_%___%_____%___%_%__%%_%___%_%_____%_%_%_%_%_______%___%___%___%_%___%_%_%_%__%_%____%____%_______',
|
||||||
|
'_%___%_%___%_%___%_%___%_%_____%_____%___%_%___%___%___%__%__%__%__%_____%___%_%___%_%___%_%_____%__%__%__%__%___%___%___%___%__%_%__%%_%%_%___%___%___%________',
|
||||||
|
'_%___%_%%%%___%%%__%%%%__%%%%%_%______%%%__%___%__%%%___%%___%___%_%%%%%_%___%_%___%__%%%__%______%%_%_%___%__%%%____%____%%%____%___%___%_%___%___%___%%%%%____',
|
||||||
|
'________________________________________________________________________________________________________________________________________________________________',
|
||||||
|
'................................................................................................................................................................',
|
||||||
|
'................................................................................................................................................................',
|
||||||
|
'................................................................................................................................................................',
|
||||||
|
'................................................................................................................................................................',
|
||||||
|
'................................................................................................................................................................',
|
||||||
|
'................................................................................................................................................................',
|
||||||
|
'................................................................................................................................................................']
|
||||||
|
|||||||
Reference in New Issue
Block a user