Example #1
0
def init_toplevel():
    """Initialise the window as part of the BEE2."""
    global window
    window = tk.Toplevel(TK_ROOT)
    window.transient(TK_ROOT)
    window.withdraw()
    window.title(_('Backup/Restore Puzzles'))

    def quit_command():
        from BEE2_config import GEN_OPTS
        window.withdraw()
        GEN_OPTS.save_check()

    # Don't destroy window when quit!
    window.protocol("WM_DELETE_WINDOW", quit_command)

    init()
    init_backup_settings()

    # When embedded in the BEE2, use regular buttons and a dropdown!
    toolbar_frame = ttk.Frame(
        window,
    )
    ttk.Button(
        toolbar_frame,
        text=_('New Backup'),
        command=ui_new_backup,
        width=14,
    ).grid(row=0, column=0)

    ttk.Button(
        toolbar_frame,
        text=_('Open Backup'),
        command=ui_load_backup,
        width=13,
    ).grid(row=0, column=1)

    ttk.Button(
        toolbar_frame,
        text=_('Save Backup'),
        command=ui_save_backup,
        width=11,
    ).grid(row=0, column=2)

    ttk.Button(
        toolbar_frame,
        text='.. As',
        command=ui_save_backup_as,
        width=5,
    ).grid(row=0, column=3)

    toolbar_frame.grid(row=0, column=0, columnspan=3, sticky='W')

    TK_ROOT.update()
    ui_new_backup()