Package elisa :: Package plugins :: Package bad :: Package raval_frontend :: Module elisa_view
[hide private]
[frames] | no frames]

Source Code for Module elisa.plugins.bad.raval_frontend.elisa_view

  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  from elisa.core import common 
 18  from elisa.core import player 
 19   
 20  import gtk.gdk, gobject 
 21   
 22  plugin_registry = common.application.plugin_registry 
 23  PigmentView = plugin_registry.get_component_class('pigment:pigment_view') 
 24   
25 -class ElisaView(PigmentView):
26 27 supported_controllers = ('raval:elisa_controller',) 28 bindings = {'player': 'player', 29 'dvd_player': 'dvd_player', 30 'slideshow': 'slideshow', 31 'manager': 'manager', 32 'focused_window': 'focused_window'} 33
34 - def __init__(self):
35 super(ElisaView, self).__init__() 36 path = 'raval:focus_transition' 37 self._player_in = plugin_registry.create_component(path) 38 path = 'raval:unfocus_transition' 39 self._player_out = plugin_registry.create_component(path)
40
41 - def frontend_changed(self, previous_frontend, new_frontend):
42 super(ElisaView, self).frontend_changed(previous_frontend, new_frontend) 43 if new_frontend == None: 44 return 45 46 # FIXME: is this the right place to do that? 47 icon_path = self.frontend.theme.get_media("elisa_icon") 48 try: 49 icon = gtk.gdk.pixbuf_new_from_file(icon_path) 50 except gobject.GError: 51 self.warning("Icon file not found: %r", icon_path) 52 else: 53 self.frontend.context.viewport_handle.icon = icon
54
55 - def controller_changed(self, old_controller, new_controller):
56 if new_controller: 57 context = self.frontend.context 58 if context.gtk_window is None: 59 context.viewport_handle.fullscreen = self.controller.fullscreen 60 else: 61 if self.controller.fullscreen: 62 context.gtk_window.fullscreen() 63 else: 64 context.gtk_window.unfullscreen()
65
66 - def focused_window__set(self, focused_window):
67 self.debug("new focused window: %s" % focused_window) 68 players = ('player', 'dvd_player', 'slideshow') 69 70 # FIXME: hackish ways to find out faded views 71 slideshow_faded = float(self.slideshow.context_handle.opacity) == 50. 72 player_faded = float(self.player.context_handle.opacity) == 50. 73 self.debug("player_faded: %r, slideshow_faded: %r", 74 player_faded, slideshow_faded) 75 76 try: 77 if self._focused_window == focused_window: 78 return 79 80 old_view = getattr(self, self._focused_window) 81 except AttributeError, e: 82 # there was no previously focused window 83 pass 84 else: 85 if self._focused_window in players: 86 self._player_out.apply(old_view) 87 path = 'player_out' 88 else: 89 if slideshow_faded and focused_window != 'slideshow': 90 path = 'pigment:fadeout_transition' 91 fadeout = plugin_registry.create_component(path) 92 view = self.slideshow 93 fadeout.apply(view) 94 self.debug("Faded out slideshow") 95 if player_faded and focused_window != 'player': 96 path = 'pigment:fadeout_transition' 97 fadeout = plugin_registry.create_component(path) 98 view = self.player 99 fadeout.apply(view) 100 self.debug("Faded out player") 101 102 path = 'pigment:fadeout_transition' 103 fadeout = plugin_registry.create_component(path) 104 fadeout.apply(old_view) 105 self.debug("Fade out applied to %r : %r", old_view, path) 106 107 new_view = getattr(self, focused_window) 108 109 if focused_window in players: 110 self._player_in.apply(new_view) 111 path = 'player_in' 112 else: 113 path = 'pigment:fadein_transition' 114 fadein = plugin_registry.create_component(path) 115 fadein.apply(new_view) 116 117 self.debug("Fade in applied to %r : %r", new_view, path) 118 119 self._focused_window = focused_window
120
121 - def canvas_resized(self, new_size):
122 self.context_handle.regenerate()
123