# 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 class DesignConf(tichy.Application): name = 'Designs' enabled = False def run(self, parent): self.window = gui.Window(parent) frame = gui.ApplicationFrame(self.window, self, back_button=True) vbox = gui.Box(frame, axis = 1) current = tichy.Service('Design') self.current_text = tichy.Text("current : %s" % current) self.current_text.view(vbox) # We get all the design services designs = tichy.Service.get_all('Design') designs_list = tichy.ActorList() for design in designs: actor = tichy.Actor(design) use_action = actor.new_action('Use') use_action.connect('activated', self.on_use_design) designs_list.append(actor) designs_list.view(vbox) yield tichy.Wait(frame, 'back') # Wait until the quit button is clicked self.window.close() # Don't forget to close the window def on_use_design(self, action, design, window): tichy.Service.set_default('Design', design) self.current_text.value = "current : %s" % design