Advertisement
sDextra

sDextra - Telegram Update

Nov 27th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.59 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.     # Bar 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.     # Text Style
  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.     # New message
  36.     def msg(txt, choices=False, who=False, sound=False):
  37.         store.m_msg.append((who, txt, choices, 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.     # Delete the last message
  44.     def del_last_msg():
  45.         if len(store.m_msg) > 0:
  46.             del store.m_msg[-1]
  47.     # Clear all
  48.     def del_all_msg():
  49.         store.m_msg = []
  50.  
  51.     def freeze():
  52.         renpy.config.skipping = False
  53.         store._skipping = False
  54.         renpy.pause(9999, hard=True)
  55.     def unfreeze():
  56.         store._skipping = True
  57.  
  58. #################################################################################
  59. # Messenger Screen
  60. #################################################################################
  61. screen telegram():
  62.     frame background "messenger/back.png" xysize (600,975) align (0.9,.5):
  63.         frame background None xysize (560, 810) align (0.5,0.58):
  64.             viewport id "vp_msg" mousewheel True  yadjustment yadj:
  65.                 vbox spacing 15 xsize 550 xalign 0.4 box_reverse True:
  66.                     for message in m_msg[::-1]:
  67.                         $ who, txt, choices, sound = message
  68.                         $ xgn = 0.0 if who else 1.0
  69.                         if sound:
  70.                             imagebutton auto "messenger/sound_%s.png" xalign xgn action Play("sound", sound)
  71.                         elif choices:
  72.                             frame xalign xgn xmaximum 580 xpadding 20 ypadding 10 background Frame("messenger/box.png", 25, 25):
  73.                                 vbox:
  74.                                     $ sort = sorted(choices.items(), key=lambda x: x)
  75.                                     for k, v in sort:
  76.                                         textbutton "%s"%(v.get('name', 'choices %s'%(k) )) hover_background "#00a":
  77.                                             action Function(del_all_msg), Function(unfreeze), Jump(v.get('jump', 'start'))
  78.                         else:
  79.                             button xalign xgn xmaximum 580 xpadding 20 ypadding 10 background Frame("messenger/box.png", 25, 25):
  80.                                 text "%s"%(txt) style "txt_base"
  81.  
  82.                                 # if who == 1:
  83.                                 #     background Frame("messenger/box_two.png", 25, 25)
  84.                                 # else:
  85.                                 #     background Frame("messenger/box.png", 25, 25)
  86.  
  87.         # Name
  88.         text "%s"%(msg_name) style "txt_base" size 35 xalign 0.31 xanchor 0.0 yalign 0.04
  89.         # Avatar
  90.         add "messenger/av/"+msg_name.lower().replace(' ', '_')+".png" pos (100,27)
  91.         # Arrow
  92.         imagebutton auto "messenger/arr_%s.png" pos (10, 33) action NullAction()
  93.         # Clear All
  94.         button background style_button_inst hover_background style_button_hovr xalign 0.99 yalign 0.03 action Function(del_all_msg) xysize (60,60):
  95.             text "  x  " style "txt_base" size 40 pos (36, -2)
  96.         # Bar
  97.         vbar value YScrollValue("vp_msg") style "bar_vert"
  98. #################################################################################
  99.  
  100.  
  101. #################################################################################
  102. # by sDextra
  103. # old Sota
  104. #################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement