markups.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. from aiogram import types
  2. import dbworker as db
  3. def klas():
  4. markup = types.ReplyKeyboardMarkup(row_width=4, resize_keyboard=True)
  5. buttons = [types.KeyboardButton(i) for i in [f"{i} клас" for i in range(5, 12)]]
  6. markup.add(*buttons)
  7. return markup
  8. def subject(klas):
  9. markup = types.ReplyKeyboardMarkup(row_width=4, resize_keyboard=True)
  10. buttons = [types.KeyboardButton(i) for i in [i[0] for i in db.get_subjects(klas)]]
  11. markup.add(types.KeyboardButton("Главное меню"))
  12. markup.add(types.KeyboardButton("Назад"))
  13. markup.add(*buttons)
  14. return markup
  15. def author(klas, subject):
  16. markup = types.ReplyKeyboardMarkup(row_width=2, resize_keyboard=True)
  17. buttons = [types.KeyboardButton(i) for i in [i[0] for i in db.get_authors(klas, subject)]]
  18. markup.add(types.KeyboardButton("Главное меню"))
  19. markup.add(types.KeyboardButton("Назад"))
  20. markup.add(*buttons)
  21. return markup
  22. def type(klas, subject, author):
  23. markup = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
  24. buttons = [types.KeyboardButton(i) for i in [i[0] for i in db.get_types(klas, subject, author)]]
  25. markup.add(types.KeyboardButton("Главное меню"))
  26. markup.add(types.KeyboardButton("Назад"))
  27. markup.add(*buttons)
  28. return markup
  29. def maintopic(klas, subject, author, type):
  30. markup = types.ReplyKeyboardMarkup(row_width=3, resize_keyboard=True)
  31. buttons = [types.KeyboardButton(i) for i in [i[0] for i in db.get_maintopics(klas, subject, author, type)]]
  32. markup.add(types.KeyboardButton("Главное меню"))
  33. markup.add(types.KeyboardButton("Назад"))
  34. markup.add(*buttons)
  35. return markup
  36. def subtopic(klas, subject, author, type, maintopic):
  37. markup = types.ReplyKeyboardMarkup(row_width=3, resize_keyboard=True)
  38. buttons = [types.KeyboardButton(i) for i in [i[0] for i in db.get_subtopics(klas, subject, author, type, maintopic)]]
  39. markup.add(types.KeyboardButton("Главное меню"))
  40. markup.add(types.KeyboardButton("Назад"))
  41. markup.add(*buttons)
  42. return markup
  43. def subsubtopic(klas, subject, author, type, maintopic, subtopic):
  44. markup = types.ReplyKeyboardMarkup(row_width=3, resize_keyboard=True)
  45. buttons = [types.KeyboardButton(i) for i in [i[0] for i in db.get_subsubtopics(klas, subject, author, type, maintopic, subtopic)]]
  46. markup.add(types.KeyboardButton("Главное меню"))
  47. markup.add(types.KeyboardButton("Назад"))
  48. markup.add(*buttons)
  49. return markup
  50. def exercise(klas, subject, author, type, maintopic, subtopic, subsubtopic):
  51. markup = types.ReplyKeyboardMarkup(row_width=7, resize_keyboard=True)
  52. buttons = [types.KeyboardButton(i) for i in [i[0] for i in db.get_exercises(klas, subject, author, type, maintopic, subtopic, subsubtopic)]]
  53. markup.add(types.KeyboardButton("Главное меню"))
  54. markup.add(types.KeyboardButton("Назад"))
  55. markup.add(*buttons)
  56. return markup