# Tichy # copyright 2008 Guillaume Chereau (charlie@openmoko.org) # # This file is part of Tichy. # # Tichy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Tichy 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Tichy. If not, see . import tichy import tichy.gui as gui from tichy.phone import TelNumber class Message(tichy.Application): name = "Messages" icon = 'icon.png' def run(self, parent): w = gui.Window(parent, modal = True) # We run into a new modal window frame = gui.ApplicationFrame(w, self, back_button=True) vbox = gui.Box(frame, axis = 1) # We create a list of the sub applications actors list = tichy.ActorList() for app in [New, Inbox, Outbox]: actor = app.create_actor() list.append(actor) list.view(vbox) gui.Spring(vbox, axis = 1) yield tichy.Wait(frame, 'back') # Wait until the quit button is clicked w.close() # Don't forget to close the window class New(tichy.Application): name = 'New' enabled = False icon = 'icon.png' def run(self, parent): self.window = gui.Window(parent, modal = True) # We run into a new modal window frame = gui.ApplicationFrame(self.window, self, title = "New Message") vbox = gui.Box(frame, axis = 1) # The destination field hbox = gui.Box(vbox, axis = 0) gui.Label(hbox, "to:") number = TelNumber('') number.create_actor().view(hbox) # The message text = tichy.Text("") text.view(vbox, editable=True, expandable=True) frame.actor.new_action("Send").connect('activated', self.on_send) frame.actor.new_action("Cancel").connect('activated', self.on_cancel) yield tichy.Wait(self.window, 'destroyed') # Wait until the quit button is clicked def on_cancel(self, action, item, view): self.window.close() def on_send(self, action, item, view): self.window.close() class Inbox(tichy.Application): name = "Inbox" icon = 'inbox_icon.png' enabled = False def run(self, parent): yield None class Outbox(tichy.Application): name = "Outbox" icon = 'outbox_icon.png' enabled = False def run(self, parent): yield None