2 # -*- coding: utf-8 -*-
4 # ****************************************************************************
5 # Copyright (c) 2008 INdT/Fucapi.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Lesser General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # ============================================================================
20 # Project Name :PC Remote
21 # Author :André Portela
22 # Email :andre_portela_@hotmail.com
25 # Class :PCRemote ScreenManager handles the finite state machine which
26 # controls the navigation between screens.
27 # ============================================================================
29 from edje_objects import *
33 class ScreenManager(object):
37 def __init__(self, main, tablet, slide, player, torrent,socket):
45 self.torrent = torrent
47 main.signal_callback_add("mouse,up,1", "Tablet",self.run_tablet)
48 main.signal_callback_add("mouse,up,1", "Slideshow",self.run_slide)
49 main.signal_callback_add("mouse,up,1", "Player",self.run_player)
50 main.signal_callback_add("mouse,up,1", "Torrent",self.run_torrent)
52 def run_tablet(self, edje, emission, source):
53 self.sock.send_message(source+":#start")
54 print 'entrou no tablet'
58 if self.tablet is None:
59 edje_file = os.path.join(os.path.dirname(sys.argv[0]), "tablet.edj")
60 self.tablet = TabletScreen(edje.canvas_class, edje_file, 'main', 'tablet', self.sock)
61 self.tablet.signal_callback_add("mouse,up,1","tablet_bt-voltar_area",self.tablet_back)
62 self.tablet.part_text_set('pc_name',edje.sock_address)
64 self.tablet.focus_set(True)
66 def tablet_back(self, edje, emission, source):
70 self.sock.send_message("Tablet:#stop")
72 self.main.focus_set(True)
74 def run_slide(self, edje, emission, source):
75 self.sock.send_message(source+":#start")
76 print 'entrou no slide'
80 if self.slide is None:
81 edje_file = os.path.join(os.path.dirname(sys.argv[0]), "slide.edj")
82 self.slide = SlideScreen(edje.canvas_class, edje_file, 'main', 'slide', self.sock)
83 self.slide.signal_callback_add("unselected","slide_bt-voltar",self.slide_back)
84 #self.slide.part_text_set('pc_name',edje.sock_address)
85 #this rotates the screen 90 degrees (to fit text in vertical orientation)
86 #self.slide.x11.rotation_set(90)
88 self.slide.focus_set(True)
90 def slide_back(self, edje, emission, source):
94 self.sock.send_message("Slideshow:#stop")
95 #this rotates the screen from 90 to 0 degrees (to fit text in horizontal orientation again)
96 #self.main.x11.rotation_set(0)
98 self.main.focus_set(True)
100 def run_player(self, edje, emission, source):
101 print 'not implemented yet'
103 def player_back(self, edje, emission, source):
104 print 'not implemented yet'
106 def run_torrent(self, edje, emission, source):
107 print 'not implemented yet'
109 def torrent_back(self, edje, emission, source):
110 print 'not implemented yet'