Beispiel #1
0
 def _add_teacher_butttons(self, links):
     links2 = [
         ButtonLink(_('Фамилия'), NameSetter.switch),
         ButtonLink(_('Стать студентом'),
                    profile_settings.ptype_setter(PType.student),
                    Text(_('Теперь ты студент')), SettingsView.switch),
     ]
     links.extend(links2)
Beispiel #2
0
 def _add_student_buttons(self, links):
     links2 = [
         ButtonLink(_('Группа'), GroupSetter.switch),
         ButtonLink(_('Подгруппа'), SubgroupSetter.switch, next_line=False),
         ButtonLink(_('Стать преподом'),
                    profile_settings.ptype_setter(PType.teacher),
                    Text(_('Теперь ты препод')), SettingsView.switch),
     ]
     links.extend(links2)
Beispiel #3
0
class StartProfileTypeSetter(BaseView):
    __viewname__ = 'start_profile_type_setter'
    hello = Text(_('Выбери тип профиля'))
    success = Text(_('Так, тип профиля установили'))
    links = [
        ButtonLink(_('Студент'), profile_settings.ptype_setter(PType.student),
                   success, StartGroupSetter.switch),
        ButtonLink(_('Преподаватель'),
                   profile_settings.ptype_setter(PType.teacher), success,
                   StartNameSetter.switch),
    ]
Beispiel #4
0
class StartSubgroupSetter(SubgroupSetter, EndSetup):
    __viewname__ = 'start_subgroup_setter'
    hello = Text(_('И последнее. Выбери свою подгруппу'))
    links = [
        ButtonLink(_('1'), profile_settings.set_subgroup, EndSetup.success,
                   MainView.switch),
        ButtonLink(_('2'),
                   profile_settings.set_subgroup,
                   EndSetup.success,
                   MainView.switch,
                   next_line=False),
    ]
Beispiel #5
0
 def _add_notif_switcher(self, links):
     notifs_allowed = self.request.user.notifications.allowed
     if notifs_allowed:
         button = ButtonLink(_('Откл. уведомления'),
                             profile_settings.disable_notifs,
                             Text(_('Отключили')),
                             color=Color.RED)
     else:
         button = ButtonLink(_('Вкл. уведомления'),
                             profile_settings.enable_notifs,
                             Text(_('Включили')),
                             TimeSetter.switch,
                             color=Color.GREEN)
     links.append(button)
Beispiel #6
0
class SubgroupSetter(BaseView):
    __viewname__ = 'subgroup_setter'
    hello = Text(_('Выбери подгруппу'))
    success = Text(_('Подгруппу установили'))
    links = [
        ButtonLink(_('1'), profile_settings.set_subgroup, success,
                   SettingsView.switch),
        ButtonLink(_('2'),
                   profile_settings.set_subgroup,
                   success,
                   SettingsView.switch,
                   next_line=False),
        NotChangeButton(SettingsView.switch)
    ]
Beispiel #7
0
    def links(self):
        links = []
        self._add_notif_switcher(links)
        links.append(ButtonLink(_('Время'), TimeSetter.switch,
                                next_line=False))

        ptype = self.request.user.ptype
        if ptype == PType.student:
            self._add_student_buttons(links)
        else:
            self._add_teacher_butttons(links)

        links.append(ButtonLink(_('Язык'),
                                viewclasses.LanguageSettings.switch))
        links.append(BackButton(viewclasses.MainView.switch))
        # links.append(ButtonLink('Начать сначала',
        #                         manager.StartProfileTypeSetter.switch,
        #                         start_message))
        return links
Beispiel #8
0
class LanguageSettings(BaseView):
    __viewname__ = 'language_settings'
    hello = Text(_('Выбери язык из списка ниже'))
    success = Text(_('Язык установили'))

    links = []
    for lang in Lang:
        b = ButtonLink(lang.value, profile_settings.set_lang(lang), success,
                       SettingsView.switch)
        links.append(b)
    links.append(BackButton(SettingsView.switch))
Beispiel #9
0
class MainView(BaseView):
    __viewname__ = 'main'

    links = [
        ButtonLink(_('Сегодня'), schedule.today_schedule),
        ButtonLink(_('Завтра'), schedule.tomorrow_schedule, next_line=False),
        ButtonLink(_('Неделя'), schedule.curr_week),
        ButtonLink(_('След. неделя'), schedule.next_week, next_line=False),
        ButtonLink(_('Какая неделя'), schedule.week_num),
        ButtonLink(_('Настройки'), viewclasses.SettingsView.switch),
    ]