def main_menu(): menu.menu = { Button("edit"): edit_menu, Button("view"): view_menu, Button("settings"): settings_menu, } menu.update()
def brush_menu(): """select brushsize""" menu.menu = { Button("Fine"): fine_brush, Button("Normal"): normal_brush, Button("Coarse"): coarse_brush, Button("Return"): edit_menu, } menu.update()
def ranges_menu(): def r1(): set_range(20) main_menu() viewer.update() def r2(): set_range(60) main_menu() viewer.update() def r3(): set_range(120) main_menu() viewer.update() menu.menu = { Button("R10"): r1, Button("R30"): r2, Button("R60"): r3, Button("Return"): main_menu, } menu.update()
def view_menu(): menu.menu = { Button("Map"): toggle_overview_map, Button("Pause"): toggle_pause, Button("Show Tokens"): toggle_show_tokens, Button("Translations"): translation_menu, Button("Preview"): toggle_preview, Button("Return"): main_menu, } menu.update()
def edit_menu(): menu.menu = { Button("Next Map"): next_map, Button("Prev Map"): prev_map, Button("Add Fog"): add_fog, Button("Clear Fog"): clear_fog, Button("Brushsize"): brush_menu, Button("return"): main_menu, } menu.update()
def settings_menu(): menu.menu = { Button("Fullscreen"): toggle_fullscreen, Button("Return"): main_menu, } menu.update()
def translation_menu(): # first create the buttons bup = Button("Up") bdown = Button("Down") bright = Button("Right") bleft = Button("Left") bzoom_in = Button("Zoom in") bzoom_out = Button("Zoom out") breturn = Button("Return") breset = Button("Reset") # assign the buttons to functions menu.menu = { bup: trans_up, bdown: trans_down, bright: trans_right, bleft: trans_left, bzoom_in: zoom_in, bzoom_out: zoom_out, breset: remove_token_or_reset, breturn: view_menu, } menu.update() #autosort the position of the buttons # add custom positions to the buttons margin = 10 x_size = bup.x_size y_size = bup.y_size row1 = margin row2 = margin * 2 + y_size row3 = margin * 3 + y_size * 2 row4 = margin * 4 + y_size * 3 column1 = margin column2 = margin * 2 + x_size column3 = margin * 3 + x_size * 2 bup.x, bup.y = column2, row1 bdown.x, bdown.y = column2, row2 bleft.x, bleft.y = column1, row2 bright.x, bright.y = column3, row2 bzoom_in.x, bzoom_in.y = column3, row1 bzoom_out.x, bzoom_out.y = column1, row1 breset.x, breset.y = column1, row3 breturn.x, breturn.y = column1, row4