Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Workshop.activity/WorkshopController.py
blob: ba192cf28c3becddf08da6288396b12fb0ac63d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
"""
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)