Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. #################################################################################
  2. ### Telegram Messenger
  3. #################################################################################
  4. init python:
  5. ### Цветовая схема\ Color scheme
  6. style_button_back = "#282E33"
  7. style_button_hovr = "#5F6C77"
  8. style_button_inst = "#14171A"
  9.  
  10. # Стиль кнопок\ Button Style
  11. style.btn = Style(style.default)
  12. style.btn.background = style_button_back
  13. style.btn.hover_background = style_button_hovr
  14. style.btn.insensitive_background = style_button_inst
  15. # Стиль ползунка\ Slider Style
  16. style.bar_vert = Style(style.default)
  17. style.bar_vert.right_bar = style_button_inst
  18. style.bar_vert.left_bar = style_button_inst
  19. style.bar_vert.thumb = style_button_hovr
  20. style.bar_vert.bar_vertical = True
  21. style.bar_vert.bar_invert = True
  22. style.bar_vert.xalign = 1.0
  23. style.bar_vert.yalign = 0.6
  24. style.bar_vert.xsize = 10
  25. style.bar_vert.ysize = 780
  26. # Стиль текста\ Style of text
  27. style.txt_base = Style(style.default)
  28. style.txt_base.font = "gui/tahoma.ttf"
  29. style.txt_base.xalign = 0.5
  30. style.txt_base.yalign = 0.5
  31. style.txt_base.size = 30
  32. style.txt_base.color = "#fff"
  33.  
  34. yadj = ui.adjustment()
  35. # Добавление нового сообщения\ Adding a new message
  36. def msg(txt, who=False, sound=False):
  37. store.m_msg.append((who, txt, sound))
  38. store.yadj.value = store.yadj.range+300
  39. renpy.restart_interaction()
  40. if who:
  41. renpy.play("new_message.mp3", "sound")
  42. renpy.pause()
  43. # Удаление последнего сообщения\ Deleting the last message
  44. def del_last_msg():
  45. if len(store.m_msg) > 0:
  46. del store.m_msg[-1]
  47. # Удаление всех сообщений\ Deleting all messages
  48. def del_all_msg():
  49. store.m_msg = []
  50.  
  51. #################################################################################
  52. # Экран сообщения\ Message screen
  53. screen telegram():
  54. frame background "messenger/back.png" xysize (600,975) align (0.9,.5):
  55. frame background None xysize (560, 810) align (0.5,0.58):
  56. viewport id "vp_msg" mousewheel True yadjustment yadj:
  57. vbox spacing 15 xsize 550 xalign 0.4 box_reverse True:
  58. for message in m_msg[::-1]:
  59. $ who, txt, sound = message
  60. $ xgn = 0.0 if who else 1.0
  61. if sound:
  62. imagebutton auto "messenger/sound_%s.png" xalign xgn action Play("sound", sound)
  63. else:
  64. button xalign xgn xmaximum 580 xpadding 20 ypadding 10 background Frame("messenger/box.png", 25, 25):
  65. text "%s"%(txt) style "txt_base"
  66.  
  67. # Имя собеседника\ Name of the interlocutor
  68. text "%s"%(msg_name) style "txt_base" size 35 xalign 0.31 xanchor 0.0 yalign 0.04
  69. # Аватарка собеседника\ Avatar of the interlocutor
  70. add "messenger/av/"+msg_name.lower().replace(' ', '_')+".png" pos (100,27)
  71. # Стрелка\Arrow
  72. imagebutton auto "messenger/arr_%s.png" pos (10, 33) action NullAction()
  73. # Стереть сообщения\ Delete messages
  74. button background style_button_inst hover_background style_button_hovr xalign 0.99 yalign 0.03 action Function(del_all_msg) xysize (60,60):
  75. text " x " style "txt_base" size 40 pos (36, -2)
  76. # Ползунок прокрутки\ Scroll slider
  77. vbar value YScrollValue("vp_msg") style "bar_vert"
  78. #################################################################################
  79.  
  80.  
  81. #################################################################################
  82. # by sDextra
  83. # old Sota
  84. #################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement