Package elisa :: Package plugins :: Package bad :: Package poblenou_frontend :: Package poblenou_widgets :: Module slideshow_osd
[hide private]
[frames] | no frames]

Source Code for Module elisa.plugins.bad.poblenou_frontend.poblenou_widgets.slideshow_osd

  1  # -*- coding: utf-8 -*- 
  2  # Elisa - Home multimedia server 
  3  # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 
  4  # All rights reserved. 
  5  # 
  6  # This file is available under one of two license agreements. 
  7  # 
  8  # This file is licensed under the GPL version 3. 
  9  # See "LICENSE.GPL" in the root of this distribution including a special 
 10  # exception to use Elisa with Fluendo's plugins. 
 11  # 
 12  # The GPL part of Elisa is also available under a commercial licensing 
 13  # agreement from Fluendo. 
 14  # See "LICENSE.Elisa" in the root directory of this distribution package 
 15  # for details on that license. 
 16   
 17  import pgm 
 18  from pgm.graph.text import Text 
 19  from pgm.graph.image import Image 
 20   
 21  from progressbar_osd import ProgressBarOsd 
 22  from dock import Dock 
 23   
 24  import time, os 
 25   
 26   
 27  # HACK: this is in fact the same as the PlayerOsd 
28 -class SlideshowOsd(Dock):
29
30 - def __init__(self, canvas, layer, 31 playing_length, 32 width, height, 33 bar_bg_image, bar_fg_image, 34 background_image):
35 36 Dock.__init__(self, canvas, layer, width, height, background_image) 37 38 self._time_position = 0 39 self._time_string = "" 40 41 inner_width = width * 0.9 42 inner_x = (width - inner_width)/2.0 43 44 45 # build the title 46 self._title = Text() 47 self._title.label = "" 48 # self._title.font_family = "MgOpen Cosmetica" 49 self._title.ellipsize = pgm.TEXT_ELLIPSIZE_MIDDLE 50 self._title.fg_color = (220, 220, 220, 255) 51 self._title.bg_color = (0, 0, 0, 0) 52 self.add(self._title) 53 self._title.position = (inner_x, 0.05, 0.0) 54 self._title.size = (inner_width, height*0.33) 55 self._title.font_height = self._title.height 56 57 # build the time bar 58 self._timebar = ProgressBarOsd(canvas, layer, playing_length, 59 bar_bg_image, bar_fg_image) 60 self._timebar.bg_color = (0, 0, 0, 0) 61 self.add(self._timebar) 62 self._timebar.position = (inner_x, height*(0.33+0.15), 0.0) 63 self._timebar.size = (inner_width, height*0.2) 64 self._timebar.visible = False 65 66 # build the total time text 67 self._time = Text() 68 self._time.label = "" 69 # self._time.font_family = "MgOpen Cosmetica" 70 self._time.fg_color = (255, 255, 255, 255) 71 self._time.bg_color = (0, 0, 0, 0) 72 self._time.alignment = pgm.TEXT_ALIGN_RIGHT 73 self.add(self._time) 74 self._time.position = (inner_x, height*(0.33+0.2+0.15), 0.001) 75 self._time.size = (inner_width, height*0.2) 76 self._time.font_height = self._time.height 77 self._time.visible = False 78 79 self._title.visible = True 80 81 self.length = playing_length
82
83 - def length__set(self, length):
84 """ 85 Set the length of the medias 86 """ 87 self._timebar.length = length 88 if length > 1: 89 self._timebar.visible = True 90 self._show_position() 91 else: 92 self._timebar.visible = False
93
94 - def length__get(self):
95 """ 96 Get the length of the medias 97 """ 98 return self._timebar.length
99 100
101 - def title__set(self, title):
102 """ 103 Set the title of the dock 104 @param title: the name of a movie or a audio file 105 @type title: string 106 """ 107 self._title.label = title
108 # self._title.font_height = self._title.height 109
110 - def title__get(self):
111 """ 112 Get the current title of the dock 113 """ 114 return self._title.label
115
116 - def index__set(self, position):
117 """ 118 Set the position 119 """ 120 self._time_position = position 121 self._time.visible = bool(position > 1) 122 self._timebar.jump_to_position(position) 123 self._show_position()
124
125 - def index__get(self):
126 """ 127 Get the current position 128 """ 129 return self._time_position
130
131 - def _show_position(self):
132 self._time.label = "%s / %s" % (self.index, self.length)
133