(first message didn't appear within 8 hours, this is 2nd try) Hi,
long time no see. I've been quite busy at school lately and has thus not been able to code as much as I would like on Freevo. I decided to try out freevo 2.0 cvs on my non-devel htpc, and found a couple of bugs. idlebar_fix_width.patch: - Replaced width with p.width when no changes has taken place. audio_detach_fix_position_and_codeingguidelines.patch: - Fix position when overscan is used. - Fix some coding guidelines inconcistencies. tiny_osd_consider_idlebar.patch: - Respect the idlebar when considering position of msgs. controlpanel_addkey_fix_placement.patch: - Add key for toggling the control (set to 'T') in keymap. - Fix placement, centering didn't behave well with overscan. If there I discover other trivial bugs like this, I will probably try to fix them -- but unfortunately I do not have the time to do more serious work atm. Regards Viggo Fredriksen -- This is a good time to punt work.
diff -Naur freevo/src/audio/plugins/detach.py freevo_viggo/src/audio/plugins/detach.py --- freevo/src/audio/plugins/detach.py 2005-01-11 16:07:29.714643597 +0100 +++ freevo_viggo/src/audio/plugins/detach.py 2005-01-11 16:16:33.894833415 +0100 @@ -92,7 +92,7 @@ # eventhandler.register(self, PLAY_END) eventhandler.register(self, PLAY_START) eventhandler.register(self, DETACH_AUDIO_STOP) - + self.visible = False self.detached = False self.animation = None @@ -108,7 +108,7 @@ def draw(self, width, height): """ Dummy method for the idlebar, only sets - our boundries for now + boundries for the detached bar to draw to. """ if self.max_width > width: self.max_width = width @@ -127,19 +127,27 @@ def detach(self,a=None): + """ + Shows or hides the detached view + according to its current status. + """ + p = audioplayer() - # hide the detached player show the player + if self.visible: + # hide the detached player show the player self.hide() p.show() self.detached = False - #p.item.parent.menuw.show() - - # hide the audioplayer and show the itemmenu else: + # hide the audioplayer and show the itemmenu p.hide() - #p.item.parent.menuw.show() + + # hack to make it work properly with overscan + # resets the self.__x and self.__y variables + self.clear() + self.detached = True # show the detachbar @@ -148,23 +156,27 @@ def show(self): + """ + Shows the detached view. + """ if self.visible: return - # set up a controlbar # XXX FIXME: Add config-var for this + a_handler = audioplayer().eventhandler path = os.path.join(config.ICON_DIR, 'misc','audio_') - handlers = [('Prev', '%sprev.png' % path, audioplayer().eventhandler, PLAYLIST_PREV), - ('Rew', '%srew.png' % path, audioplayer().eventhandler, Event(SEEK, arg=-10)), - ('Pause', '%spause.png'% path, audioplayer().eventhandler, PAUSE ), - ('Play', '%splay.png' % path, audioplayer().eventhandler, PLAY ), - ('Stop', '%sstop.png' % path, self.eventhandler, STOP ), - ('FFwd', '%sffwd.png' % path, audioplayer().eventhandler, Event(SEEK, arg=10)), - ('Next', '%snext.png' % path, audioplayer().eventhandler, PLAYLIST_NEXT), - ('Show Player', '%sshow.png' % path, self.detach, None) ] + handlers = [ + (_('Prev'), '%sprev.png' % path, a_handler, PLAYLIST_PREV), + (_('Rew'), '%srew.png' % path, a_handler, Event(SEEK, arg=-10)), + (_('Pause'), '%spause.png'% path, a_handler, PAUSE ), + (_('Play'), '%splay.png' % path, a_handler, PLAY ), + (_('Stop'), '%sstop.png' % path, self.eventhandler, STOP ), + (_('FFwd'), '%sffwd.png' % path, a_handler, Event(SEEK,arg=10)), + (_('Next'), '%snext.png' % path, a_handler, PLAYLIST_NEXT), + (_('Show Player'), '%sshow.png' % path, self.detach, None) ] self.controlbar = ButtonPanel(handlers, default_action=3) controlpanel().register(self.controlbar) @@ -176,11 +188,11 @@ if not self.show_detachbar: return - width = self.max_width - 4 - height = self.max_height - 4 + width = self.max_width - 10 + height = self.max_height - 10 y1 = self.y1 - x1 = 2 + x1 = 5 textinfo, image, item = self.format_info() @@ -193,28 +205,32 @@ # FIXME: Find a more suitable default image? if not image: image = os.path.join(config.IMAGE_DIR, 'gant', 'music.png') + cover = gui.Image(gui.imagelib.load(image, (None, height)),(x1, y1)) iw,ih = cover.get_size() self.objects.append(cover) # create a marquee for showing item info - info = mevas.image.CanvasImage((width-iw-6, fih)) - info.set_pos((x1+iw+4, y1+ih-fih-2)) + info = mevas.image.CanvasImage( (width - iw - 6, fih) ) + info.set_pos( (x1 + iw + 4, y1 + ih - fih - 2) ) # create text objects to be shown as # iteminfo on the detachbar tobjs = [] for string in textinfo: - tobjs.append(gui.Text(string, (0,0), - (fi.stringsize(string), fih), - fi, align_v='top', align_h='left')) + tobjs.append(gui.Text(string, + (0, 0), + (fi.stringsize(string), fih), + fi, + align_v='top', + align_h='left') ) self.objects.append(info) # create canvas for showing elapsed time - w = ft.stringsize('00:00') + w = ft.stringsize(u'00:00') elapsed = mevas.image.CanvasImage((w, fth)) - elapsed.set_pos((x1+width-w, y1)) + elapsed.set_pos( (x1 + width - w, y1) ) self.objects.append(elapsed) self.animation = DetachbarAnimation(tobjs, info, item, elapsed, ft) @@ -224,6 +240,10 @@ def hide(self): + """ + Hides the detached view. + """ + if not self.visible: return @@ -259,14 +279,15 @@ plugin.getbyname('idlebar').update() gui.get_display().update() return True - - elif event == PLAY_START and isinstance(event.arg, AudioItem) and self.detached: - # An audio item has started playing and we are in detached mode. This is our - # item and we should show ourself + + elif event == PLAY_START and isinstance(event.arg, AudioItem) and \ + self.detached: + # An audio item has started playing and we are in detached mode. + # This is our item and we should show ourself self.hide() self.show() return True - + return False @@ -284,22 +305,23 @@ # trackno - title if info['trackno'] and info['title']: - textinfo.append( 'Title: %s - %s' % (info['trackno'], info['title'] ) ) + textinfo.append( _('Title: %s - %s') % (info['trackno'], + info['title']) ) elif info['title']: - textinfo.append( 'Title: %s' % info['title'] ) + textinfo.append( _('Title: %s') % info['title'] ) else: - textinfo.append( 'Title: %s' % item.name) + textinfo.append( _('Title: %s') % item.name) # artist : album if info['artist']: - textinfo.append( 'Artist: %s' % info['artist'] ) + textinfo.append( _('Artist: %s') % info['artist'] ) if info['album']: - textinfo.append( 'Album: %s' % info['album'] ) - + textinfo.append( _('Album: %s') % info['album'] ) - textinfo.append('Duration: %02i:%02i' % (item.length/60, item.length%60) ) + textinfo.append(_('Duration: %02i:%02i') % (item.length / 60, + item.length % 60) ) self.item = item return textinfo, image, item @@ -310,9 +332,10 @@ """ Animation intended for the text on the detached audioplayer """ - def __init__(self, textobjects, textcanvas, item, itemcanvas, el_font, fps=15): - BaseAnimation.__init__(self, fps) + def __init__(self, textobjects, textcanvas, item, + itemcanvas, el_font, fps=15): + BaseAnimation.__init__(self, fps) self.fps = fps self.pobj = -1 @@ -334,7 +357,7 @@ """ if not audioplayer().running: eventhandler.post(DETACH_AUDIO_STOP) - + self.frame += 1 # goto next text object @@ -344,7 +367,8 @@ if self.pobj == len(self.objects): self.pobj = 0 - self.max_frames = self.objects[self.pobj].get_size()[0] + self.sleep_frames + self.max_frames = self.objects[self.pobj].get_size()[0] \ + + self.sleep_frames self.frame = 0 obj = self.objects[self.pobj] @@ -362,10 +386,15 @@ # update the time elapsed if self.item.elapsed != self.last_elapsed: self.last_elapsed = self.item.elapsed - elapsed = '%02i:%02i' % (self.item.elapsed / 60, self.item.elapsed % 60) - size = (self.elapsed_font.stringsize(elapsed), self.elapsed_font.height) + elapsed = u'%02i:%02i' % (self.item.elapsed / 60, + self.item.elapsed % 60) + + size = ( self.elapsed_font.stringsize(elapsed), + self.elapsed_font.height) # XXX FIXME!! Causes "Fatal python error: Deallocating None" # after a while! - self.itemcanvas.set_image(gui.Text(elapsed, (0,0), size, self.elapsed_font)) - + self.itemcanvas.set_image( gui.Text(elapsed, + (0, 0), + size, + self.elapsed_font) )
diff -Naur freevo/src/plugins/tiny_osd.py freevo_viggo/src/plugins/tiny_osd.py --- freevo/src/plugins/tiny_osd.py 2005-01-11 16:07:31.601016834 +0100 +++ freevo_viggo/src/plugins/tiny_osd.py 2005-01-11 16:36:40.795937795 +0100 @@ -37,7 +37,7 @@ # # ----------------------------------------------------------------------- # Freevo - A Home Theater PC framework -# Copyright (C) 2002 Krister Lagerstrom, et al. +# Copyright (C) 2002 Krister Lagerstrom, et al. # Please see the file freevo/Docs/CREDITS for a complete list of authors. # # This program is free software; you can redistribute it and/or modify @@ -88,7 +88,7 @@ self.gui_object = None self._timer_id = None - + def update(self): """ update the display @@ -108,12 +108,19 @@ # get the osd from from the settings font = gui.get_font('osd') + over_x = config.GUI_OVERSCAN_X + over_y = config.GUI_OVERSCAN_Y + # create the text object - # FIXME: do respect the idlebar if active + y = over_y + 10 + if plugin.getbyname('idlebar') != None: + y += 60 + + self.gui_object = gui.Text(self.message, - (config.GUI_OVERSCAN_X, config.GUI_OVERSCAN_Y + 10), - (display.width - 10 - 2 * config.GUI_OVERSCAN_X, - config.GUI_OVERSCAN_Y + 10 + font.height), + (over_x, y), + (display.width - 10 - 2 * over_x, + over_y + 10 + font.height), font, align_h='right') # make sure the object is on top of everything else
diff -Naur freevo/src/plugins/idlebar/__init__.py freevo_viggo/src/plugins/idlebar/__init__.py --- freevo/src/plugins/idlebar/__init__.py 2005-01-11 16:07:31.773959372 +0100 +++ freevo_viggo/src/plugins/idlebar/__init__.py 2005-01-11 16:14:49.912382998 +0100 @@ -173,9 +173,9 @@ p.set_pos((x1, y1)) x1 = x1 + p.width else: - if changed: - p.set_pos((x2 - width, y1)) x2 = x2 - p.width + if changed: + p.set_pos((x2, y1)) continue if width > x2 - x1: @@ -306,8 +306,8 @@ self.__x = 0 self.__y = 0 self.width = 0 - - + + def draw(self, width, height): return self.NO_CHANGE
diff -Naur freevo/src/controlpanel.py freevo_viggo/src/controlpanel.py --- freevo/src/controlpanel.py 2005-01-11 16:07:28.530037192 +0100 +++ freevo_viggo/src/controlpanel.py 2005-01-11 16:54:31.224326969 +0100 @@ -113,11 +113,8 @@ self.container.add_child(o) # TODO: support different placements - tw = display.width - 2*config.GUI_OVERSCAN_X - th = display.height - 2*config.GUI_OVERSCAN_Y - - x = int(tw/2) - int(w/2) - y = th - h + x = config.GUI_OVERSCAN_X + 10 + y = display.height - config.GUI_OVERSCAN_Y - h self.container.set_pos((x,y)) diff -Naur freevo/src/input/keymap.py freevo_viggo/src/input/keymap.py --- freevo/src/input/keymap.py 2005-01-11 16:07:31.343102528 +0100 +++ freevo_viggo/src/input/keymap.py 2005-01-11 16:54:13.837103623 +0100 @@ -44,6 +44,7 @@ 'PERIOD' : 'EJECT', 'L' : 'SUBTITLE', 'A' : 'LANG', + 'T' : 'TOGGLE_CONTROL' } REMOTE_MAP = {