Ejemplo n.º 1
0
from smart_sa.intervention.installed_games import InstalledGames, GameInterface


class PillGame(GameInterface):
    def __init__(self, mode):
        self.mode = mode

    def pages(self):
        return ('pills',)

    def template(self, page_id):
        game_context = {'mode': self.mode}

        return ('pill_game/pill.html', game_context)

    def variables(self, page_id=None):
        return ['pill_game']

InstalledGames.register_game(
    'pills', 'Pill Game - Practice', PillGame('practice'))
InstalledGames.register_game(
    'pills-my-regimen',
    'Pill Game - My Regimen', PillGame('actual'))
Ejemplo n.º 2
0
            'video': 'video/%s.mp4' % page_id,
            'width': 530,  # 320,
            'height': 413,  # 255,
        }
        return ('watchvideo_game/video.html', game_context)

    def variables(self, page_id=None):
        return []


class WatchVideoGame2(WatchVideoGame1):
    "watch another video"
    def pages(self):
        return ('joseph_hope', )


class WatchVideoGame3(WatchVideoGame1):
    "watch another video"
    def pages(self):
        return ('problem_solving_smart_sa_new_vo', )

InstalledGames.register_game('video-soldiers',
                             'Soldiers and Snakes',
                             WatchVideoGame1())
InstalledGames.register_game('video-joseph',
                             'Joseph and Hope',
                             WatchVideoGame2())
InstalledGames.register_game('video-problem-solving',
                             'Problem Solving Video',
                             WatchVideoGame3())
Ejemplo n.º 3
0
            example=self.example
        )

    def from_dict(self, d):
        self.name = d['name']
        self.text = d['text']
        self.ordinality = d['ordinality']
        self.subtext = d['subtext']
        self.example = d['example']
        self.save()

    def __unicode__(self):
        return "%s) %s" % (self.ordinality, self.name)


class ProblemSolvingGame(GameInterface):
    def pages(self):
        return ('barriers', )

    def template(self, page_id):
        game_context = {'issues': Issue.objects.all().order_by('ordinality')}
        return ('problemsolving_game/problemsolving.html', game_context)

    def variables(self, page_id=None):
        return ['problemsolving']


InstalledGames.register_game(
    'problemsolving',
    'Problem Solving', ProblemSolvingGame())
Ejemplo n.º 4
0
from smart_sa.intervention.installed_games import InstalledGames, GameInterface


class IslandGame(GameInterface):
    def __init__(self, mode):
        self.mode = mode

    def pages(self):
        return ('one',)

    def template(self, page_id):
        game_context = {'mode': self.mode}
        return ('island_game/island.html', game_context)

InstalledGames.register_game(
    'island', 'Island Before Medication', IslandGame('before-medication'))
InstalledGames.register_game(
    'island-after-medication', 'Island After Medication',
    IslandGame('after-medication'))
Ejemplo n.º 5
0
 def variables(self, page_id=None):
     return InstalledGames.variables(self.activity.game, page_id)
Ejemplo n.º 6
0
from smart_sa.intervention.installed_games import InstalledGames, GameInterface


class SSNMTreeGame(GameInterface):
    """Client will label the fruit, and then set disclosure and
    level of support info for each person"""

    def pages(self):
        return ('addnames',)

    def template(self, page_id):
        game_context = {'mode': page_id}
        return ('ssnmtree_game/tree.html', game_context)

    def variables(self, page_id=None):
        return ['ssnmtree']


class SSNMTreeReview(SSNMTreeGame):
    """This is the '4th' part where the client reviews the tree with
    their friend"""

    def pages(self):
        return ('review', )


InstalledGames.register_game('ssnmTree',
                             'Social Support Network Tree',
                             SSNMTreeGame())
Ejemplo n.º 7
0
 def template(self, page_id):
     return InstalledGames.template(self.activity.game, page_id)
Ejemplo n.º 8
0
 def variables(self, page_id=None):
     if self.game:
         return InstalledGames.variables(self.game, page_id) or []
     return []
Ejemplo n.º 9
0
 def pages(self):
     if self.game:
         return InstalledGames.pages(self.game)
     else:
         return tuple()
Ejemplo n.º 10
0
from smart_sa.intervention.installed_games import InstalledGames, GameInterface


class LifeGoalsTask(GameInterface):
    def pages(self):
        return ('goals', )

    def template(self, page_id):
        game_context = {'mode': page_id, }
        return ('lifegoal_task/goals.html', game_context)

    def variables(self, page_id=None):
        return ['lifegoals']

InstalledGames.register_game('lifegoals', 'Life Goals', LifeGoalsTask())
Ejemplo n.º 11
0
from smart_sa.intervention.installed_games import InstalledGames, GameInterface


class AssessmentQuizTask(GameInterface):
    def __init__(self, mode):
        self.mode = mode

    def pages(self):
        return ('quiz',)

    def template(self, page_id):
        game_context = {'mode': self.mode}
        return ('assessmentquiz_task/%s.html' % self.mode, game_context)

    def variables(self, page_id=None):
        return ['assessmentquiz']

InstalledGames.register_game(
    'assessmentquiz',
    'Assessment Quiz Mood',
    AssessmentQuizTask('kten'))
InstalledGames.register_game(
    'assessmentquiz-audit',
    'Assessment Quiz Alchohol Audit',
    AssessmentQuizTask('audit'))
InstalledGames.register_game(
    'assessmentquiz-drug-audit',
    'Assessment Quiz Drug Audit',
    AssessmentQuizTask('drugaudit'))