From c14688d67a82b7ec7746beda90da915c98600a3d Mon Sep 17 00:00:00 2001 From: erick Date: Sat, 05 Dec 2009 21:03:59 +0000 Subject: Merge branch 'frame_integration' into revamped_dragndrop Conflicts: tutorius/actions.py --- (limited to 'Workshop.activity/TutoriusActivity.py') diff --git a/Workshop.activity/TutoriusActivity.py b/Workshop.activity/TutoriusActivity.py new file mode 100755 index 0000000..f2f3adc --- /dev/null +++ b/Workshop.activity/TutoriusActivity.py @@ -0,0 +1,120 @@ +# Copyright (C) 2009, Tutorius.org +# +# This program 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 2 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +from sugar.activity import activity +from TutorialStoreHome import TutorialStore +from Workshop import WorkshopView +from WorkshopModel import WorkshopModel +import logging + +import sys, os +import gtk +from dialogs import LoginDialog + +class TutoriusActivity(activity.Activity): + + def callback(self, widget, button_string): + + if button_string == 'search_button': + self.right_container.remove(self.tutorial_store_home.tutorial_store_home) + + results_widget = self.tutorial_store_home.get_results_widget() + + self.right_container.pack_start(results_widget) + + results_widget.show() + self.right_container.show() + + elif button_string == 'more_button': + self.right_container.remove(self.tutorial_store_home.tutorial_store_home) + + details_widget = self.tutorial_store_home.get_details_widget() + + self.right_container.pack_start(details_widget) + + details_widget.show() + self.right_container.show() + + def __init__(self,handle): + activity.Activity.__init__(self,handle) + gtk.gdk.threads_init() + toolbox = activity.ActivityToolbox(self) + self.set_toolbox(toolbox) + toolbox.show() + + self.table = gtk.VPaned() + self.table.set_position(500) + self.left_container = gtk.HBox() + btn1 = gtk.Button("My tutorials") + btn2 = gtk.Button("Tutorial Store") + + self.left_container.pack_start(btn1,expand=False) + self.left_container.pack_start(btn2,expand=False) + + #tutorial_store_search_button = self.tutorial_store_home.get_search_button() + #tutorial_store_search_button.connect("clicked", self.callback, 'search_button') + + #tutorial_store_more_button = self.tutorial_store_home.get_more_button() + #tutorial_store_more_button.connect("clicked", self.callback, 'more_button') + + self.right_container = gtk.VBox() + #self.right_container.pack_start(self.tutorial_store_home.tutorial_store_home) + + self.model = WorkshopModel() + + self.workshop_my_tutorial = WorkshopView(self.model) + self.workshop_store = TutorialStore(self.model) + self.model.set_workshop_view(self.workshop_my_tutorial) + self.model.set_store_view(self.workshop_store) + + self.model.query(None) + + self.table.add2(self.left_container) + self.table.add1(self.workshop_my_tutorial) + self.set_canvas(self.table) + + self.workshop_store.show() + self.workshop_my_tutorial.show() + self.table.show_all() + + + btn1.connect("clicked",self.display_my_tutorial,None) + btn2.connect("clicked",self.display_store,None) + + def display_store(self,widget,data): + """ + Display the Tutorial store view + + @param widget The widget that made the call + @param data parameter not used + """ + if self.table.get_child1() == self.workshop_my_tutorial: + self.table.remove(self.workshop_my_tutorial) + if self.table.get_child1() is None: + logging.info("here store") + self.table.add1(self.workshop_store) + + def display_my_tutorial(self,widget,data): + """ + Display the My Tutorial view + + @param widget The widget that made the call + @param data parameter not used + """ + if self.table.get_child1() == self.workshop_store: + self.table.remove(self.workshop_store) + if self.table.get_child1() is None: + logging.info("here my") + self.table.add1(self.workshop_my_tutorial) -- cgit v0.9.1