""" 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(self,widget,tutorial): """ Handles start tutorial action @param widget the widget that triggered the action @param tutorial the tutorial to launch """ self.model.launch_tutorial(tutorial) 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,tutorial,rating): """ Change the rating for a tutorial @param tutorial The tutorial to rate @param rating The new rating """ self.model.rate_tutorial(tutorial,rating) 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 """ self.model.edit_tutorial(tutorial) 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 """ self.view.display_info_dialog(tutorial) def save_tutorial_info(self,tutorial): """ Save the metadata of a tutorial @param tutorial The tutorial to update containing the new metadata """ self.model.save_metadata(tutorial) 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)