Home | Trees | Indices | Help |
---|
|
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 __maintainer__ = 'Florian Boucault <florian@fluendo.com>' 18 19 20 from elisa.core import plugin_registry 21 22 from poblenou_widgets.slideshow import Slideshow 23 from poblenou_widgets.slideshow_osd import SlideshowOsd 24 from poblenou_widgets.player_osd import Dock 25 26 from pgm.graph.group import Group 27 28 import pgm 29 30 SlideshowViewClass = plugin_registry.get_component_class('base:slideshow_view') 31 PlayerViewClass = plugin_registry.get_component_class('poblenou:player_view') 3234 default_config = {} 35 supported_controllers = ('base:slideshow_controller',) 36 37 SlideshowWidgetClass = Slideshow 38 39 bindings = {'playing':'playing', 40 'current_index' : 'index'} 4125443 super(SlideshowView, self).__init__() 44 45 # delay before the osd disappears automatically 46 self._osd_duration = 3 47 48 # position of the mouse when the dragging started 49 self._drag_start_position = None50 54 5860 # FIXME: we can't use super() because of context_handle overriding 61 # by both parent views. :( 62 63 if new_frontend == None: 64 return 65 66 viewport = self.frontend.context.viewport_handle 67 canvas = viewport.get_canvas() 68 viewport.connect("motion-notify-event", self.mouse_moved) 69 70 if self.slideshow_widget == None: 71 canvas = self.frontend.context.viewport_handle.get_canvas() 72 self.slideshow_widget = self.SlideshowWidgetClass(canvas, 73 pgm.DRAWABLE_FAR) 74 self.slideshow_widget.size = canvas.size 75 self.slideshow_widget.visible = True 76 77 self.slideshow_widget.connect('clicked', self.drag_clicked) 78 self.slideshow_widget.connect('drag_begin', self.drag_begin) 79 self.slideshow_widget.connect('drag_motion', self.drag_motion) 80 self.slideshow_widget.connect('drag_end', self.drag_end) 81 82 83 if self.group == None: 84 canvas = self.frontend.context.viewport_handle.get_canvas() 85 86 # FIXME: why is the OSD not in self.group? Because of resizing 87 # issue that will be solved when drawable.regenerate is in place 88 # in Pigment. 89 90 # create the group containing all the widgets of the player 91 self.group = Group(canvas, pgm.DRAWABLE_FAR) 92 self.group.visible = True 93 self.context_handle = self.group 94 95 theme = self.frontend.theme 96 self._normal_osd_status_bg = theme.get_media("dock_background") 97 self._mouse_osd_status_bg = theme.get_media("dock_background_mouse") 98 self._play_button_image = theme.get_media("play_button_mouse") 99 self._pause_button_image = theme.get_media("pause_button_mouse") 100 101 self._create_background() 102 self._create_playpause_button() 103 self._create_osd_status_widget() 104 self._create_back_widget()105 109111 # FIXME: refactorize. only difference with player view is usage 112 # of SlideshowOsd instead of PlayerOsd 113 canvas = self.frontend.context.viewport_handle.get_canvas() 114 theme = self.frontend.theme 115 116 osd_status_bar_bg = theme.get_media("dock_bar_bg") 117 osd_status_bar_fg = theme.get_media("dock_bar_fg") 118 119 px, py = 0.7, 0.8 120 iw, ih = canvas.width, canvas.height 121 osd_status_w = iw * px 122 osd_status_h = ih * 0.15 123 self._osd_status = SlideshowOsd(canvas, 124 pgm.DRAWABLE_FAR, 125 10000, 126 osd_status_w, osd_status_h, 127 osd_status_bar_bg, 128 osd_status_bar_fg, 129 self._normal_osd_status_bg) 130 self._osd_status.opacity = 0 131 self._osd_status.position = self._osd_status_position 132 self._osd_status.visible = True 133 self._osd_status.index = 0 134 self._osd_status.length = 0 135 self._osd_status.connect("clicked", self._osd_status_clicked)136138 super(SlideshowView, self).attribute_set(origin, key, old_value, 139 new_value) 140 if key == 'focused': 141 if (new_value, self.frontend.context.touchscreen) == (True, True): 142 self.osd_show(self._osd_duration)143145 self._update_play_button('') 146 self._update_length_and_position() 147 self._update_osd_layout() 148 self._osd_back_button.show(time_visible) 149 self._osd_status.show(time_visible) 150 self._osd_play_button.show(time_visible)151 156 160162 self._osd_status.length = len(self.controller.model.playlist) 163 self._osd_status.index = self.controller.model.current_index +1164 172174 if not self.controller.focused: 175 return False 176 177 self.osd_show(self._osd_duration) 178 return True179 185 194196 if self.controller is None or not self.controller.focused: 197 return False 198 199 self._drag_start_position = (x, y) 200 self.slideshow_widget.move(0.0) 201 self.osd_show(self._osd_duration) 202 return True203205 if self.controller is None or not self.controller.focused: 206 return False 207 208 if self._drag_start_position != None: 209 dx = self._drag_start_position[0] - x 210 dy = self._drag_start_position[1] - y 211 212 if dx > 0.3: 213 if not self.controller.next_image(): 214 self.slideshow_widget.release() 215 elif dx < -0.3: 216 if not self.controller.previous_image(): 217 self.slideshow_widget.release() 218 else: 219 self.slideshow_widget.release() 220 221 self._drag_start_position = None 222 223 self.osd_show(self._osd_duration) 224 225 return True 226 227 return False228230 if self.controller is None or not self.controller.focused: 231 return False 232 233 if self._drag_start_position != None: 234 dx = x - self._drag_start_position[0] 235 self.slideshow_widget.move(dx) 236 return True 237 238 return False239241 if self.controller is None or not self.controller.focused: 242 return False 243 244 if self.slideshow_widget.visible == False or self.slideshow_widget.opacity == 0.0: 245 return False 246 247 if self._drag_start_position != None: 248 dx = self._drag_start_position[0] - x 249 if dx < -0.05 or dx > 0.05: 250 return True 251 252 self.osd_show(self._osd_duration) 253 return True
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:30 2008 | http://epydoc.sourceforge.net |