From 6465961301bf120c5693c234eada59acfaf707ff Mon Sep 17 00:00:00 2001 From: Abraxa Date: Sun, 31 Aug 2008 03:50:33 +0000 Subject: [PATCH] Rename TestView to Dialer Rename Dialer.groups to Dialer.screens Rename *_GROUP_NAME to *_SCREEN_NAME Add Dialer.show_screen() method git-svn-id: http://www.neo1973-germany.de/svn@108 46df4e5c-bc4e-4628-a0fc-830ba316316d --- epydial/epydial.py | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/epydial/epydial.py b/epydial/epydial.py index 8177f56..d2be6ce 100755 --- a/epydial/epydial.py +++ b/epydial/epydial.py @@ -14,8 +14,8 @@ WM_INFO = ("epydial", "epydial") EDJE_FILE_PATH = "data/themes/" -MAIN_GROUP_NAME = "pyneo/dialer/main" -INCALL_GROUP_NAME = "pyneo/dialer/incall" +MAIN_SCREEN_NAME = "pyneo/dialer/main" +INCALL_SCREEN_NAME = "pyneo/dialer/incall" from datetime import datetime from dbus import SystemBus @@ -57,11 +57,11 @@ class EdjeGroup(edje.Edje): class InCallScreen(EdjeGroup): def __init__(self, main): - EdjeGroup.__init__(self, main, INCALL_GROUP_NAME) + EdjeGroup.__init__(self, main, INCALL_SCREEN_NAME) class MainScreen(EdjeGroup): def __init__(self, main): - EdjeGroup.__init__(self, main, MAIN_GROUP_NAME) + EdjeGroup.__init__(self, main, MAIN_SCREEN_NAME) self.text = [] dbus_ml = e_dbus.DBusEcoreMainLoop() @@ -161,22 +161,30 @@ class MainScreen(EdjeGroup): call = object_by_url(name) call.Hangup(dbus_interface=DIN_CALL) -class TestView(object): +class Dialer(object): def __init__(self): edje.frametime_set(FRAMETIME) self.evas_canvas = EvasCanvas(FULLSCREEN, "x11-16") - self.groups = {} + self.screens = {} - self.init_group(MAIN_GROUP_NAME, MainScreen(self)) - self.init_group(INCALL_GROUP_NAME, InCallScreen(self)) + self.init_screen(MAIN_SCREEN_NAME, MainScreen(self)) + self.init_screen(INCALL_SCREEN_NAME, InCallScreen(self)) - self.groups[MAIN_GROUP_NAME].part_text_set("numberdisplay_text", "wait ...") - self.groups[MAIN_GROUP_NAME].show() + self.screens[MAIN_SCREEN_NAME].part_text_set("numberdisplay_text", "wait ...") + + self.show_screen(MAIN_SCREEN_NAME) - def init_group(self, name, instance): - self.groups[name] = instance - self.evas_canvas.evas_obj.data[name] = instance + def init_screen(self, screen_name, instance): + self.screens[screen_name] = instance + self.evas_canvas.evas_obj.data[screen_name] = instance + + def show_screen(self, screen_name): + for (name, screen) in self.screens.items(): + if name == screen_name: + screen.show() + else: + screen.hide() class EvasCanvas(object): def __init__(self, fullscreen, engine_name): @@ -209,7 +217,7 @@ class EvasCanvas(object): ecore.main_loop_quit() if __name__ == "__main__": - TestView() + Dialer() ecore.main_loop_begin() '''