Пример #1
0
 def pre_redirect(self, request, *args, **kwargs):
     if (kwargs['callback'] == 'mediafile' and
             get_active_slide()['callback'] == 'mediafile'):
         # If the current slide is a pdf and the new page is also a slide,
         # we dont have to use set_active_slide, because is causes a content
         # reload.
         kwargs.update({'page_num': 1, 'pk': request.GET.get('pk')})
         url = Mediafile.objects.get(pk=kwargs['pk'], is_presentable=True).mediafile.url
         config['projector_active_slide'] = kwargs
         ProjectorSocketHandler.send_updates(
             {'calls': {'load_pdf': {'url': url, 'page_num': kwargs['page_num']}}})
     else:
         set_active_slide(kwargs['callback'], kwargs=dict(request.GET.items()))
     config['projector_scroll'] = config.get_default('projector_scroll')
     config['projector_scale'] = config.get_default('projector_scale')
     call_on_projector({'scroll': config['projector_scroll'],
                        'scale': config['projector_scale']})
Пример #2
0
    def pre_redirect(self, request, *args, **kwargs):
        direction = kwargs['direction']
        if direction == 'bigger':
            config['projector_scale'] = int(config['projector_scale']) + 1
        elif direction == 'smaller':
            config['projector_scale'] = int(config['projector_scale']) - 1
        elif direction == 'down':
            config['projector_scroll'] = int(config['projector_scroll']) + 1
        elif direction == 'up':
            if config['projector_scroll'] > 0:
                config['projector_scroll'] = int(config['projector_scroll']) - 1
        elif direction == 'clean_scale':
            config['projector_scale'] = config.get_default('projector_scale')
        elif direction == 'clean_scroll':
            config['projector_scroll'] = config.get_default('projector_scroll')

        call_on_projector({'scroll': config['projector_scroll'],
                           'scale': config['projector_scale']})
Пример #3
0
 def test_get_default(self):
     """
     Tests the methode 'default'.
     """
     self.assertEqual(config.get_default('string_var'),
                      'default_string_rien4ooCZieng6ah')
     self.assertRaisesMessage(
         ConfigNotFound, 'The config variable unknown_var was not found.',
         config.get_default, 'unknown_var')
Пример #4
0
 def test_get_default(self):
     """
     Tests the methode 'default'.
     """
     self.assertEqual(config.get_default('string_var'), 'default_string_rien4ooCZieng6ah')
     self.assertRaisesMessage(
         ConfigNotFound,
         'The config variable unknown_var was not found.',
         config.get_default,
         'unknown_var')