Hi!
On Wednesday 20 April 2005 22:29, Tanja Striepling wrote:
> Hope it is what you are looking for.
> It is just a small and simple plugin,
> and maybe it is not the smartest way to do this.
Small and simple is always smart. ;-)
No, it fits my needs quite nicely; since it's so small and useful, I strongly
vote for its inclusion into Freevo.
For those who want to try it, too: The .tar.gz which Tanja sent contains an
image "chartpie.png" to be put into <freevo-src/>share/icons/misc/, and a
patched __init__.py for src/plugins/idlebar/ (for Freevo 1.5.x).
Attached you'll find the corresponding .diff file for easy patching.
Thanks Tanja and have a nice day everybody,
Hans
Index: src/plugins/idlebar/__init__.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/idlebar/__init__.py,v
retrieving revision 1.19
diff -u -3 -p -d -r1.19 __init__.py
--- src/plugins/idlebar/__init__.py 10 Jul 2004 12:33:41 -0000 1.19
+++ src/plugins/idlebar/__init__.py 21 Apr 2005 18:29:31 -0000
@@ -62,6 +62,7 @@ import plugin
import skin
import util.tv_util as tv_util
import util.pymetar as pymetar
+import util.fileops as util
from pygame import image,transform
@@ -193,6 +194,7 @@ class clock(IdleBarPlugin):
return 0
+
class cdstatus(IdleBarPlugin):
"""
Show the status of all rom drives.
@@ -481,3 +483,45 @@ class logo(IdleBarPlugin):
else:
image = os.path.join(config.IMAGE_DIR, self.image)
return osd.drawimage(image, (x, osd.y + 5, -1, 75))[0]
+
+
+class diskfree(IdleBarPlugin):
+ """
+ Displays the amount of free disk space
+
+ Activate with:
+ plugin.activate('idlebar.diskfree', level=30)
+
+ This plugin displays the total amount of free disk space for recordings
+ """
+ def __init__(self):
+ IdleBarPlugin.__init__(self)
+ self.time = 0
+ self.diskfree = 0
+
+
+ def getDiskFree(self):
+ """
+ Determine amount of freedisk space
+ Update maximum every 30 seconds
+
+ """
+ if (time.time()-self.time)>30:
+ self.time = time.time()
+ freespace = util.freespace(config.TV_RECORD_DIR)
+ self.diskfree = _('%iGb') % (((freespace / 1024) / 1024) / 1024)
+
+ def draw(self, (type,object),x,osd):
+ """
+ Drawing to idlebar
+ """
+
+ self.getDiskFree()
+ font = osd.get_font('small0')
+ widthdf = 0
+ widthdf = font.stringsize(self.diskfree)
+ osd.draw_image(os.path.join(config.ICON_DIR, 'misc/chartpie.png' ),(x, osd.y + 7, -1, -1))
+ osd.write_text(self.diskfree, font, None, x + 15, osd.y + 55 - font.h, widthdf, font.h, 'left', 'top')
+
+ return widthdf + 15
+