mirror of
https://github.com/gryf/wmdocklib.git
synced 2025-12-18 12:00:20 +01:00
1568639 installation scripts
added the ./setup.py script. added the */__init__.py files. modified the import instruction (import from pywmgeneral).
This commit is contained in:
1
pywmdatetime/__init__.py
Normal file
1
pywmdatetime/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from pywmdatetime import *
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
'''pywmdatetime.py
|
||||
"""pywmdatetime.py
|
||||
|
||||
WindowMaker dockapp that displays time, date, weekday and week number.
|
||||
|
||||
@@ -25,8 +25,8 @@ Added event handling for graceful shutdown
|
||||
|
||||
2003-06-16 Kristoffer Erlandsson
|
||||
First workingish version
|
||||
'''
|
||||
usage = '''pywmdatetime.py [options]
|
||||
"""
|
||||
usage = """pywmdatetime.py [options]
|
||||
Available options are:
|
||||
-h, --help print this help
|
||||
-f, --foreground <color> set the foreground color
|
||||
@@ -40,14 +40,14 @@ Available options are:
|
||||
|
||||
The formats are the same as Python's strftime() accept. See the sample
|
||||
rc-file for more information about this.
|
||||
'''
|
||||
"""
|
||||
|
||||
import sys
|
||||
import time
|
||||
import getopt
|
||||
import os
|
||||
|
||||
import pywmhelpers
|
||||
from pywmgeneral import pywmhelpers
|
||||
|
||||
width = 64
|
||||
height = 64
|
||||
|
||||
1
pywmgeneral/__init__.py
Normal file
1
pywmgeneral/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from pywmhelpers import *
|
||||
1
pywmgeneric/__init__.py
Normal file
1
pywmgeneric/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from pywmgeneric import *
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
'''pywmgeneric.py
|
||||
|
||||
WindowMaker dockapp to display the output from an external program, or the
|
||||
@@ -40,10 +40,10 @@ import ConfigParser
|
||||
import getopt
|
||||
import popen2
|
||||
|
||||
import pywmhelpers
|
||||
from pywmgeneral import pywmhelpers
|
||||
|
||||
class UserMethods:
|
||||
'''Put methods that should be called when the action is method=... here.
|
||||
"""Put methods that should be called when the action is method=... here.
|
||||
|
||||
The action methods should return a function, which in turn returns
|
||||
the string to be displayed (if no 'display =' exists) and stored
|
||||
@@ -57,15 +57,43 @@ class UserMethods:
|
||||
|
||||
THE METHODS ALLREADY HERE ARE JUST SAMPLES AND WILL PROBABLY NOT WORK
|
||||
WITH YOUR SYSTEM.
|
||||
'''
|
||||
"""
|
||||
|
||||
userTicks = sysTicks = niceTicks = idleTicks = 0
|
||||
|
||||
def getCpuTemp(self):
|
||||
def result():
|
||||
try:
|
||||
f = file('/proc/sys/dev/sensors/w83697hf-isa-0290/temp2', 'r')
|
||||
f = file('/proc/stat', 'r')
|
||||
except IOError:
|
||||
return lambda: 'error'
|
||||
temp = f.readline().split()[2]
|
||||
|
||||
import re
|
||||
cpuinfo = re.compile(r'^cpu.* (?P<user>[0-9]+) +(?P<nice>[0-9]+)'
|
||||
r'+(?P<sys>[0-9]+) +(?P<idle>[0-9]+)')
|
||||
match = dict([(k, int(v))
|
||||
for (k,v) in cpuinfo.match(f.readline()).groupdict().items()])
|
||||
totalTicks = ((match['user'] - self.userTicks) +
|
||||
(match['sys'] - self.sysTicks) +
|
||||
(match['nice'] - self.niceTicks) +
|
||||
(match['idle'] - self.idleTicks));
|
||||
|
||||
if (totalTicks > 0):
|
||||
user = (100. * (match['user'] - self.userTicks)) / totalTicks;
|
||||
sys = (100. * (match['sys'] - self.sysTicks)) / totalTicks;
|
||||
nice = (100. * (match['nice'] - self.niceTicks)) / totalTicks;
|
||||
idle = (100. - (user + sys + nice));
|
||||
else:
|
||||
user = sys = nice = idle = 0;
|
||||
|
||||
self.userTicks = match['user']
|
||||
self.sysTicks = match['sys']
|
||||
self.niceTicks = match['nice']
|
||||
self.idleTicks = match['idle']
|
||||
|
||||
f.close()
|
||||
return lambda: 'cpu: %s' % temp
|
||||
return '%02.f/%02.f/%02.f' % (user, nice, sys)
|
||||
return result
|
||||
|
||||
def getSysTemp(self):
|
||||
try:
|
||||
@@ -118,7 +146,7 @@ digits = '0123456789:/-%. '
|
||||
maxChars = 9
|
||||
|
||||
defaultConfigFile = '~/.pywmgenericrc'
|
||||
defaultRGBFiles = ('/usr/lib/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt')
|
||||
defaultRGBFiles = ('/usr/share/X11/rgb.txt', '/usr/X11R6/lib/X11/rgb.txt')
|
||||
|
||||
err = sys.stderr.write
|
||||
|
||||
@@ -143,10 +171,10 @@ def getXY(line):
|
||||
return 0, line * (letterHeight + 3) + 1
|
||||
|
||||
def isTrue(s):
|
||||
'''Return true if the string s can be interpreted as a true value.
|
||||
"""Return true if the string s can be interpreted as a true value.
|
||||
|
||||
Raises ValueError if we get a string we don't like.
|
||||
'''
|
||||
"""
|
||||
trueThings = ['on', 'yes', '1', 'true']
|
||||
falseThings = ['off', 'no', '0', 'false']
|
||||
if s in trueThings:
|
||||
@@ -345,13 +373,13 @@ class Entry:
|
||||
pass
|
||||
|
||||
def translateText(self, text):
|
||||
'''Translate chars that can't be painted in the app to something nicer.
|
||||
"""Translate chars that can't be painted in the app to something nicer.
|
||||
|
||||
Or nothing if we can't come up with something good. Could be nice to
|
||||
extend this function with chars more fitting for your language.
|
||||
'''
|
||||
fromChars = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
||||
toChars = 'aaoeu'
|
||||
"""
|
||||
fromChars = 'áéíóúàèìòùâêîôûäëïöü'
|
||||
toChars = 'aeiouaeiouaeiouaeiou'
|
||||
deleteChars = []
|
||||
for c in text.lower():
|
||||
if not (c in letters or c in digits or c in fromChars):
|
||||
@@ -484,15 +512,15 @@ class PywmGeneric:
|
||||
while 1:
|
||||
counter += 1
|
||||
self._checkForEvents()
|
||||
if counter % 3 == 0:
|
||||
if counter % 2 == 0:
|
||||
[e.tick1() for e in self._entrys if not e is None]
|
||||
if counter % 100 == 0:
|
||||
if counter % 20 == 0:
|
||||
[e.tick2() for e in self._entrys if not e is None]
|
||||
|
||||
if counter == 999999:
|
||||
counter = -1
|
||||
pywmhelpers.redraw()
|
||||
time.sleep(0.1)
|
||||
time.sleep(0.5)
|
||||
|
||||
def parseCommandLine(argv):
|
||||
'''Parse the commandline. Return a dictionary with options and values.'''
|
||||
|
||||
1
pywmhdmon/__init__.py
Normal file
1
pywmhdmon/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from pywmhdmon import *
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python2.3
|
||||
|
||||
"""pywmhdmon.py
|
||||
|
||||
@@ -55,7 +55,7 @@ import time
|
||||
import getopt
|
||||
import os
|
||||
|
||||
import pywmhelpers
|
||||
from pywmgeneral import pywmhelpers
|
||||
|
||||
width = 64
|
||||
height = 64
|
||||
|
||||
1
pywmseti/__init__.py
Normal file
1
pywmseti/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from pywmseti import *
|
||||
@@ -37,7 +37,7 @@ import time
|
||||
import getopt
|
||||
import os
|
||||
|
||||
import pywmhelpers
|
||||
from pywmgeneral import pywmhelpers
|
||||
|
||||
width = 64
|
||||
height = 64
|
||||
|
||||
1
pywmsysmon/__init__.py
Normal file
1
pywmsysmon/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from pywmsysmon import *
|
||||
@@ -36,7 +36,7 @@ import time
|
||||
import getopt
|
||||
import os
|
||||
|
||||
import pywmhelpers
|
||||
from pywmgeneral import pywmhelpers
|
||||
|
||||
width = 64
|
||||
height = 64
|
||||
|
||||
33
setup.py
Normal file
33
setup.py
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Set these so they match your system.
|
||||
XLibDir = '/usr/X11R6/lib'
|
||||
XIncludes = '/usr/X11R6/include'
|
||||
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
module1 = Extension('pywmgeneral',
|
||||
libraries = ['Xpm', 'Xext', 'X11'],
|
||||
library_dirs = [XLibDir],
|
||||
include_dirs = [XIncludes],
|
||||
sources = ['pywmgeneral/pywmgeneral.c'])
|
||||
|
||||
setup(name="pywmdockapps",
|
||||
version = "$Revision$"[11:-2],
|
||||
|
||||
description='''
|
||||
read the whole story at http://pywmdockapps.sourceforge.net/''',
|
||||
|
||||
author="Kristoffer Erlandsson & al.",
|
||||
author_email="mfrasca@zonnet.nl",
|
||||
url="http://ibo.sourceforge.net",
|
||||
license="(L)GPL",
|
||||
py_modules=['pywmdatetime.pywmdatetime',
|
||||
'pywmgeneral.pywmhelpers',
|
||||
'pywmgeneric.pywmgeneric',
|
||||
'pywmhdmon.pywmhdmon',
|
||||
'pywmseti.pywmseti',
|
||||
'pywmsysmon.pywmsysmon',
|
||||
],
|
||||
ext_modules = [module1])
|
||||
Reference in New Issue
Block a user