[Freevo-devel] Re: [PATCH] Idlebar plugins reactivated

2004-09-13 Thread Viggo Fredriksen
On Wednesday 08 September 2004 10:34, Dirk Meyer wrote:
> BTW, what about using an extra file for each plugin? I guess it would
> look much cleaner and having all the code in __init__.py is very bad.
>
>
> Dischi


Done, all IdleBarPlugins are now seperated into files.


Viggo
diff -Naur freevo/src/plugins/idlebar/__init__.py freevo_devel/src/plugins/idlebar/__init__.py
--- freevo/src/plugins/idlebar/__init__.py	2004-09-13 22:00:38.675851359 +0200
+++ freevo_devel/src/plugins/idlebar/__init__.py	2004-09-13 22:08:05.0 +0200
@@ -4,17 +4,6 @@
 # ---
 # $Id: __init__.py,v 1.29 2004/09/08 08:33:13 dischi Exp $
 #
-# Documentation moved to the corresponding classes, so that the help
-# interface returns something usefull.
-# Available plugins:
-#   idlebar
-#   idlebar.clock
-#   idlebar.cdstatus
-#   idlebar.mail
-#   idlebar.tv
-#   idlebar.weather
-#   idlebar.holidays
-#
 # ---
 # $Log: __init__.py,v $
 # Revision 1.29  2004/09/08 08:33:13  dischi
@@ -84,22 +73,14 @@
 #
 # --- */
 
-
+# python modules
 import time
-import os
-import sys
-import string
-import types
-import mailbox
-import re
 import locale
 
+# freevo modules
 import config
 import plugin
-import util.tv_util as tv_util
-import util.pymetar as pymetar
 import gui
-import gui.imagelib
 import eventhandler
 from event import *
 
@@ -308,418 +289,3 @@
 for o in self.objects:
 o.unparent()
 self.objects = []
-
-
-
-
-class clock(IdleBarPlugin):
-"""
-Shows the current time.
-
-Activate with:
-plugin.activate('idlebar.clock',   level=50)
-Note: The clock will always be displayed on the right side of
-the idlebar.
-"""
-def __init__(self, format=''):
-IdleBarPlugin.__init__(self)
-	if format == '': # No overiding of the default value
-	if time.strftime('%P') =='':
-format ='%a %H:%M'
-else:
-format ='%a %I:%M %P'
-self.format = format
-self.object = None
-self.align  = 'right'
-self.width  = 0
-self.text   = ''
-
-def draw(self, width, height):
-clock  = time.strftime(self.format)
-
-if self.objects and self.text == clock:
-return self.NO_CHANGE
-
-self.clear()
-
-font  = gui.get_font('clock')
-width = min(width, font.stringsize(clock))
-
-txt = gui.Text(clock, (0, 0), (width, height), font,
-   align_v='center', align_h='right')
-self.objects.append(txt)
-self.text = clock
-return width
-
-
-
-class cdstatus(IdleBarPlugin):
-"""
-Show the status of all rom drives.
-
-Activate with:
-plugin.activate('idlebar.cdstatus')
-"""
-def __init__(self):
-
-IdleBarPlugin.__init__(self)
-icondir = os.path.join(config.ICON_DIR, 'status')
-self.cdimages ={}
-self.cdimages ['audiocd']   = os.path.join(icondir, 'cd_audio.png')
-self.cdimages ['empty_cdrom'] = os.path.join(icondir, 'cd_inactive.png')
-self.cdimages ['images']  = os.path.join(icondir, 'cd_photo.png')
-self.cdimages ['video']   = os.path.join(icondir, 'cd_video.png')
-self.cdimages ['dvd'] = os.path.join(icondir, 'cd_video.png')
-self.cdimages ['burn']= os.path.join(icondir, 'cd_burn.png')
-self.cdimages ['cdrip']   = os.path.join(icondir, 'cd_rip.png')
-self.cdimages ['mixed']   = os.path.join(icondir, 'cd_mixed.png')
-
-def draw(self, width, height):
-image = self.cdimages['empty_cdrom']
-
-self.clear()
-
-w = 0
-for media in config.REMOVABLE_MEDIA:
-image = self.cdimages['empty_cdrom']
-if media.type == 'empty_cdrom':
-image = self.cdimages['empty_cdrom']
-if media.type and self.cdimages.has_key(media.type):
-image = self.cdimages[media.type]
-else:
-image = self.cdimages['mixed']
-i = gui.imagelib.load(image, (None, None))
-
-w += i.width + 10
-
-self.objects.append(gui.Image(i, (w, (height-i.height)/2)))
-
-
-if w:
-w -= 10
-return w
-
-
-class mail(IdleBarPlugin):
-"""
-Shows if new mail is in the mailbox.
-
-Activate with:
-plugin.activate('idlebar.mail',level=10, args=('path to mailbox', ))
-
-"""
-def __init__(self, mailbox):
-IdleBarPlugin.__init__(self)
-self.mails = -1
-self.NO_MAILIMAGE = os.path.join(config.ICON_DIR, 'status/newmail_dimmed.png')
-self.MAILIMAGE = os.path.join(config.ICON_DIR, 'status/newmail_active.png')
-self.MAILBOX = mailbox
-
-def checkmail(self):
-if no

[Freevo-devel] Re: [BUG] on the topic of sqllite support..

2004-09-13 Thread Dirk Meyer
"Mick" wrote:
> I've had it enable for a while, then today I tried to play my first audio cd
> since for ever..
>
> When starting the second track, i get this, and it crashes freevo everytime.
>
> Traceback (most recent call last):
>   File "/usr/lib/python2.3/site-packages/freevo/main.py", line 492, in ?
> MainTread().run()
>   File "/usr/lib/python2.3/site-packages/freevo/main.py", line 352, in run
> self.eventhandler(rc.get_event(True))
>   File "/usr/lib/python2.3/site-packages/freevo/main.py", line 304, in
> eventhandler
> if p.eventhandler(event=event):
>   File "/usr/lib/python2.3/site-packages/freevo/audio/plugins/logger.py",
> line 76, in eventhandler
> self.log_track(event.arg)
>   File "/usr/lib/python2.3/site-packages/freevo/audio/plugins/logger.py",
> line 61, in log_track
> query = 'UPDATE music SET play_count=play_count+1,last_play=%f WHERE \
>   File "/usr/lib/python2.3/posixpath.py", line 119, in dirname
> return split(p)[0]
>   File "/usr/lib/python2.3/posixpath.py", line 77, in split
> i = p.rfind('/') + 1
> AttributeError: 'NoneType' object has no attribute 'rfind'
>
> Any tips on whats going on?

Wild guess without checking the code: the logger wants to add the
filename to the database. Since a cd has no file, filename is None. 


Dischi

-- 
I started out with nothing... I still have most of it.


---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
___
Freevo-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-devel