--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# ****************************************************************************
+# Copyright (c) 2008 INdT/Fucapi.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# ============================================================================
+# Project Name :PC Remote
+# Author :André Portela
+# Email :andre_portela_@hotmail.com
+# Version :1.0
+# Module :main
+# Class :PCRemote ScreenManager handles the finite state machine which
+# controls the navigation between screens.
+# ============================================================================
+
+from edje_objects import *
+import os
+import sys
+
+class ScreenManager(object):
+ '''
+ classdocs
+ '''
+ def __init__(self, main, tablet, slide, player, torrent,socket):
+ '''
+ Constructor
+ '''
+ self.main = main
+ self.tablet = tablet
+ self.slide = slide
+ self.player = player
+ self.torrent = torrent
+ self.sock = socket
+ main.signal_callback_add("mouse,up,1", "Tablet",self.run_tablet)
+ main.signal_callback_add("mouse,up,1", "Slideshow",self.run_slide)
+ main.signal_callback_add("mouse,up,1", "Player",self.run_player)
+ main.signal_callback_add("mouse,up,1", "Torrent",self.run_torrent)
+
+ def run_tablet(self, edje, emission, source):
+ self.sock.send_message(source+":#start")
+ print 'entrou no tablet'
+ #main edje object
+ edje.focus_set(False)
+ edje.hide()
+ if self.tablet is None:
+ edje_file = os.path.join(os.path.dirname(sys.argv[0]), "tablet.edj")
+ self.tablet = TabletScreen(edje.canvas_class, edje_file, 'main', 'tablet', self.sock)
+ self.tablet.signal_callback_add("mouse,up,1","tablet_bt-voltar_area",self.tablet_back)
+ self.tablet.part_text_set('pc_name',edje.sock_address)
+ self.tablet.show()
+ self.tablet.focus_set(True)
+
+ def tablet_back(self, edje, emission, source):
+ #tablet edje object
+ edje.focus_set(False)
+ edje.hide()
+ self.sock.send_message("Tablet:#stop")
+ self.main.show()
+ self.main.focus_set(True)
+
+ def run_slide(self, edje, emission, source):
+ self.sock.send_message(source+":#start")
+ print 'entrou no slide'
+ #main edje object
+ edje.focus_set(False)
+ edje.hide()
+ if self.slide is None:
+ edje_file = os.path.join(os.path.dirname(sys.argv[0]), "slide.edj")
+ self.slide = SlideScreen(edje.canvas_class, edje_file, 'main', 'slide', self.sock)
+ self.slide.signal_callback_add("unselected","slide_bt-voltar",self.slide_back)
+ #self.slide.part_text_set('pc_name',edje.sock_address)
+ #this rotates the screen 90 degrees (to fit text in vertical orientation)
+ #self.slide.x11.rotation_set(90)
+ self.slide.show()
+ self.slide.focus_set(True)
+
+ def slide_back(self, edje, emission, source):
+ #slide edje object
+ edje.focus_set(False)
+ edje.hide()
+ self.sock.send_message("Slideshow:#stop")
+ #this rotates the screen from 90 to 0 degrees (to fit text in horizontal orientation again)
+ #self.main.x11.rotation_set(0)
+ self.main.show()
+ self.main.focus_set(True)
+
+ def run_player(self, edje, emission, source):
+ print 'not implemented yet'
+
+ def player_back(self, edje, emission, source):
+ print 'not implemented yet'
+
+ def run_torrent(self, edje, emission, source):
+ print 'not implemented yet'
+
+ def torrent_back(self, edje, emission, source):
+ print 'not implemented yet'
+