1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
# Entry point for the developer console.
label _developer:
if not config.developer:
return
call _enter_menu from _call__enter_menu_4
label _developer_screen:
python hide:
ui.window(style=style.gm_root)
ui.null()
ui.frame(xpos=10, ypos=10, style=style.menu_frame)
ui.vbox(box_first_spacing=10)
layout.label(u"Developer Menu", None)
sg = "developer_menu"
layout.button("Return", None, clicked=ui.returns(True), size_group=sg)
layout.button("Reload Game (Shift+R)", None, clicked=ui.callsinnewcontext("_save_reload_game"), size_group=sg)
layout.button("Variable Viewer", None, clicked=ui.jumps("_debugger_screen"), size_group=sg)
layout.button("Theme Test", None, clicked=ui.jumps("_theme_test"), size_group=sg)
layout.button("Style Hierarchy", None, clicked=ui.jumps("_style_hierarchy"), size_group=sg)
ui.close()
ui.interact()
return
label _debugger_screen:
python hide:
ui.window(style=style.gm_root)
ui.null()
ui.frame(ymargin=10, xmargin=10, style=style.menu_frame)
ui.side(['t', 'c', 'r', 'b'])
layout.label("Variable Viewer", None)
entries = [ ]
ebc = renpy.game.log.ever_been_changed
ebc = list(ebc)
ebc.sort()
ebc.remove("nvl_list")
import repr
aRepr = repr.Repr()
aRepr.maxstring = 40
for var in ebc:
if not hasattr(store, var):
continue
if var.startswith("__00"):
continue
if var.startswith("_") and not var.startswith("__"):
continue
val = aRepr.repr(getattr(store, var))
entries.append((0, (var + " = " + val).replace("{", "{{")))
if entries:
vp = ui.viewport(mousewheel=True)
layout.list(entries)
ui.bar(adjustment=vp.yadjustment, style='vscrollbar')
else:
layout.prompt("No variables have changed since the game started.", None)
ui.null()
layout.button(u"Return to the developer menu", None, clicked=ui.returns(True))
ui.close()
ui.interact()
jump _developer_screen
label _theme_test:
python hide:
# Never gets pickled
def role(b):
if b:
return "selected_"
else:
return ""
toggle_var = True
adj = ui.adjustment(100, 25, page=25)
while True:
ui.window(style=style.gm_root)
ui.null()
# Buttons
ui.hbox(box_spacing=10, xpos=10, ypos=10)
ui.vbox(box_spacing=10)
sg = "theme_test"
ui.frame(style='menu_frame')
ui.vbox()
layout.label("Button", None)
ui.textbutton("Button", size_group=sg, clicked=ui.returns("gndn"))
ui.textbutton("Button (Selected)", size_group=sg, clicked=ui.returns("gndn"), role=role(True))
ui.textbutton("Small", clicked=ui.returns("gndn"), style='small_button')
ui.close()
ui.frame(style='menu_frame')
ui.vbox()
layout.label("Radio Button", None)
ui.textbutton("True", size_group=sg, clicked=ui.returns("set"), role=role(toggle_var), style='radio_button')
ui.textbutton("False", size_group=sg, clicked=ui.returns("unset"), role=role(not toggle_var), style='radio_button')
ui.close()
ui.frame(style='menu_frame')
ui.vbox()
layout.label("Check Button", None)
ui.textbutton("Check Button", size_group=sg, clicked=ui.returns("toggle"), role=role(toggle_var), style='check_button')
ui.close()
ui.frame(style='menu_frame')
ui.vbox(box_spacing=2)
ui.bar(adjustment=adj, style='bar', xmaximum=200)
ui.bar(adjustment=adj, style='slider', xmaximum=200)
ui.bar(adjustment=adj, style='scrollbar', xmaximum=200)
ui.close()
ui.close() # vbox
ui.frame(style='menu_frame')
ui.hbox(box_spacing=2)
ui.bar(adjustment=adj, style='vbar', ymaximum=200)
ui.bar(adjustment=adj, style='vslider', ymaximum=200)
ui.bar(adjustment=adj, style='vscrollbar', ymaximum=200)
ui.close()
ui.frame(style='menu_frame', xmaximum=0.95)
ui.vbox(box_spacing=20)
layout.prompt("This a prompt. Hopefully, we've made this long enough to wrap around at least once.", None)
ui.close()
ui.close() # hbox
ui.frame(style='menu_frame', xalign=.01, yalign=.99)
ui.textbutton("Return to the developer menu", clicked=ui.returns("return"))
rv = ui.interact()
if rv == "return":
renpy.jump("_developer_screen")
elif rv == "set":
toggle_var = True
elif rv == "unset":
toggle_var = False
elif rv == "toggle":
toggle_var = not toggle_var
label _style_hierarchy:
python hide:
ui.window(style=style.gm_root)
ui.null()
ui.frame(ymargin=10, xmargin=10, style=style.menu_frame)
ui.side(['t', 'c', 'r', 'b'], spacing=2)
layout.label("Style Hierarchy", None)
hier = renpy.style.style_hierarchy()
entries = [ (i[0], i[1] + " - " + str(i[2])) for i in hier if i[2] ]
vp = ui.viewport(mousewheel=True)
layout.list(entries)
ui.bar(adjustment=vp.yadjustment, style='vscrollbar')
layout.button(u"Return to the developer menu", None, clicked=ui.returns(True))
ui.close()
ui.interact()
jump _developer_screen
|