""" WorkshopController This module handles user action from the workshop view """ import logging from WorkshopModel import Tutorial class WorkshopController(): def __init__(self,view,model): self.view = view self.model = model def tutorial_query(self,widget,keyword): """ Handles query from the view @param widget the widget that sent the query @param keyword the keyword for the query, empty to get all tutorials """ self.model.query(keyword) def sort_selection_changed(self,widget,data): """ Handles selection changes in the sorting selection @param widget the widget that sent the query @param sort the property to use to sort tutorial """ sorting = widget.get_active_text() self.view.change_sorting(sorting) def launch_tutorial_triggered(self,widget,tutorial): """ Handles start tutorial action @param widget the widget that triggered the action @param tutorial the tutorial to launch """ pass def show_details(self,widget,tutorial): """ show the details for a tutorial @param widget the widget that made the call @param tutorial the tutorial to """ self.view.display_detail(tutorial) def back_pressed(self,widget,data): """ When in detail view, go back to general view @param widget the widget that made the call @param data not used """ self.view.display_main_view() def rate_tutorial(self,widget,data): """ Change the rating for a tutorial @param widget the widget that made the call @param data a tuple (tutorial,new_rating) """ pass def edit_tutorial(self,widget,tutorial): """ Edit the tutorial in the detail view @param widget the widget that made the call @param tutorial the tutorial to edit """ pass def update_tutorial(self,widget,tutorial): """ Need to know what this do """ pass def info_tutorial(self,widget,tutorial): """ Edit the infos about the tutorial @param widget the widget that made the call @param tutorial the tutorial to edit """ pass def delete_tutorial(self,widget,tutorial): """ Delete a tutorial @param widget the widget that made the call @param tutorial the tutorial to delete """ self.model.delete_tutorial(tutorial) def publish_tutorial(self,widget,tutorial): """ Publish a tutorial @param widget the widget that made the call @param tutorial the tutorial to publish """ self.model.publish_tutorial(tutorial) def unpublish_tutorial(self,widget,tutorial): """ Unpublish a tutorial @param widget the widget that made the call @param tutorial the tutorial to unpublish """ self.model.unpublish_tutorial(tutorial)