コード例 #1
0
ファイル: StyleVarPane.py プロジェクト: Stendec-UA/BEE2.4
def make_pane(tool_frame):
    """Create the styleVar pane.

    """
    global window
    window = SubPane(
        TK_ROOT,
        options=GEN_OPTS,
        title='Style Properties',
        name='style',
        resize_y=True,
        tool_frame=tool_frame,
        tool_img=png.png('icons/win_stylevar'),
        tool_col=3,
    )

    UI['style_can'] = Canvas(window, highlightthickness=0)
    # need to use a canvas to allow scrolling
    UI['style_can'].grid(sticky='NSEW')
    window.rowconfigure(0, weight=1)

    UI['style_scroll'] = ttk.Scrollbar(
        window,
        orient=VERTICAL,
        command=UI['style_can'].yview,
    )
    UI['style_scroll'].grid(column=1, row=0, rowspan=2, sticky="NS")
    UI['style_can']['yscrollcommand'] = UI['style_scroll'].set
    canvas_frame = ttk.Frame(UI['style_can'])

    frame_all = ttk.Labelframe(canvas_frame, text="All:")
    frame_all.grid(row=0, sticky='EW')

    frm_chosen = ttk.Labelframe(canvas_frame, text="Selected Style:")
    frm_chosen.grid(row=1, sticky='EW')

    ttk.Separator(
        canvas_frame,
        orient=HORIZONTAL,
    ).grid(row=2, sticky='EW', pady=(10, 5))

    frm_other = ttk.Labelframe(canvas_frame, text="Other Styles:")
    frm_other.grid(row=3, sticky='EW')

    UI['stylevar_chosen_none'] = ttk.Label(
        frm_chosen,
        text='No Options!',
        font='TkMenuFont',
        justify='center',
    )
    UI['stylevar_other_none'] = ttk.Label(
        frm_other,
        text='None!',
        font='TkMenuFont',
        justify='center',
    )

    for pos, var in enumerate(styleOptions):
        # Add the special stylevars which apply to all styles
        tk_vars[var.id] = IntVar(
            value=GEN_OPTS.get_bool('StyleVar', var.id, var.enabled))
        checkbox_special[var.id] = ttk.Checkbutton(frame_all,
                                                   variable=tk_vars[var.id],
                                                   text=var.name,
                                                   command=functools.partial(
                                                       set_stylevar, var.id))
        checkbox_special[var.id].grid(row=pos, column=0, sticky="W", padx=3)

        if var.desc:
            tooltip.add_tooltip(
                checkbox_special[var.id],
                var.desc,
            )

    for var in var_list:
        tk_vars[var.id] = IntVar(value=var.default)
        args = {
            'variable': tk_vars[var.id],
            'text': var.name,
            'command': functools.partial(set_stylevar, var.id)
        }
        checkbox_chosen[var.id] = ttk.Checkbutton(frm_chosen, **args)
        checkbox_other[var.id] = ttk.Checkbutton(frm_other, **args)
        if var.desc:
            tooltip.add_tooltip(
                checkbox_chosen[var.id],
                var.desc,
            )
            tooltip.add_tooltip(
                checkbox_other[var.id],
                var.desc,
            )

    UI['style_can'].create_window(0, 0, window=canvas_frame, anchor="nw")
    UI['style_can'].update_idletasks()
    UI['style_can'].config(
        scrollregion=UI['style_can'].bbox(ALL),
        width=canvas_frame.winfo_reqwidth(),
    )
    ttk.Sizegrip(
        window,
        cursor=utils.CURSORS['stretch_vert'],
    ).grid(row=1, column=0)

    UI['style_can'].bind('<Configure>', flow_stylevar)

    # Scroll globally even if canvas is not selected.
    if utils.WIN:
        window.bind(
            "<MouseWheel>",
            lambda e: scroll(int(-1 * (e.delta / 120))),
        )
    elif utils.MAC:
        window.bind(
            "<Button-4>",
            lambda e: scroll(1),
        )
        window.bind(
            "<Button-5>",
            lambda e: scroll(-1),
        )
コード例 #2
0
ファイル: StyleVarPane.py プロジェクト: GiovanH/BEE2.4
def make_pane(tool_frame):
    """Create the styleVar pane.

    """
    global window
    window = SubPane(
        TK_ROOT,
        options=GEN_OPTS,
        title='Style Properties',
        name='style',
        resize_y=True,
        tool_frame=tool_frame,
        tool_img=png.png('icons/win_stylevar'),
        tool_col=2,
    )

    UI['style_can'] = Canvas(window, highlightthickness=0)
    # need to use a canvas to allow scrolling
    UI['style_can'].grid(sticky='NSEW')
    window.rowconfigure(0, weight=1)

    UI['style_scroll'] = ttk.Scrollbar(
        window,
        orient=VERTICAL,
        command=UI['style_can'].yview,
        )
    UI['style_scroll'].grid(column=1, row=0, rowspan=2, sticky="NS")
    UI['style_can']['yscrollcommand'] = UI['style_scroll'].set
    canvas_frame = ttk.Frame(UI['style_can'])

    frame_all = ttk.Labelframe(canvas_frame, text="All:")
    frame_all.grid(row=0, sticky='EW')

    frm_chosen = ttk.Labelframe(canvas_frame, text="Selected Style:")
    frm_chosen.grid(row=1, sticky='EW')

    ttk.Separator(
        canvas_frame,
        orient=HORIZONTAL,
        ).grid(row=2, sticky='EW', pady=(10, 5))

    frm_other = ttk.Labelframe(canvas_frame, text="Other Styles:")
    frm_other.grid(row=3, sticky='EW')

    UI['stylevar_chosen_none'] = ttk.Label(
        frm_chosen,
        text='No Options!',
        font='TkMenuFont',
        justify='center',
        )
    UI['stylevar_other_none'] = ttk.Label(
        frm_other,
        text='None!',
        font='TkMenuFont',
        justify='center',
        )

    for pos, (var_id, name, default) in enumerate(styleOptions):
        # Add the special stylevars which apply to all styles
        tk_vars[var_id] = IntVar(
            value=GEN_OPTS.get_bool('StyleVar', var_id, default)
        )
        checkbox_special[var_id] = ttk.Checkbutton(
            frame_all,
            variable=tk_vars[var_id],
            text=name,
            command=functools.partial(set_stylevar, var_id)
            )
        checkbox_special[var_id].grid(row=pos, column=0, sticky="W", padx=3)

    for var in var_list:
        tk_vars[var.id] = IntVar(value=var.default)
        args = {
            'variable': tk_vars[var.id],
            'text': var.name,
            'command': functools.partial(set_stylevar, var.id)
            }
        checkbox_chosen[var.id] = ttk.Checkbutton(frm_chosen, **args)
        checkbox_other[var.id] = ttk.Checkbutton(frm_other, **args)

    UI['style_can'].create_window(0, 0, window=canvas_frame, anchor="nw")
    UI['style_can'].update_idletasks()
    UI['style_can'].config(
        scrollregion=UI['style_can'].bbox(ALL),
        width=canvas_frame.winfo_reqwidth(),
        )
    ttk.Sizegrip(
        window,
        cursor="sb_v_double_arrow",
        ).grid(row=1, column=0)

    UI['style_can'].bind('<Configure>', flow_stylevar)

    # Scroll globally even if canvas is not selected.
    window.bind(
        "<MouseWheel>",
        lambda e: scroll(int(-1*(e.delta/120))),
        )
    window.bind(
        "<Button-4>",
        lambda e: scroll(1),
        )
    window.bind(
        "<Button-5>",
        lambda e: scroll(-1),
        )
コード例 #3
0
ファイル: StyleVarPane.py プロジェクト: Stendec-UA/BEE2.4
def make_pane(tool_frame):
    """Create the styleVar pane.

    """
    global window
    window = SubPane(
        TK_ROOT,
        options=GEN_OPTS,
        title="Style Properties",
        name="style",
        resize_y=True,
        tool_frame=tool_frame,
        tool_img=png.png("icons/win_stylevar"),
        tool_col=3,
    )

    UI["style_can"] = Canvas(window, highlightthickness=0)
    # need to use a canvas to allow scrolling
    UI["style_can"].grid(sticky="NSEW")
    window.rowconfigure(0, weight=1)

    UI["style_scroll"] = ttk.Scrollbar(window, orient=VERTICAL, command=UI["style_can"].yview)
    UI["style_scroll"].grid(column=1, row=0, rowspan=2, sticky="NS")
    UI["style_can"]["yscrollcommand"] = UI["style_scroll"].set
    canvas_frame = ttk.Frame(UI["style_can"])

    frame_all = ttk.Labelframe(canvas_frame, text="All:")
    frame_all.grid(row=0, sticky="EW")

    frm_chosen = ttk.Labelframe(canvas_frame, text="Selected Style:")
    frm_chosen.grid(row=1, sticky="EW")

    ttk.Separator(canvas_frame, orient=HORIZONTAL).grid(row=2, sticky="EW", pady=(10, 5))

    frm_other = ttk.Labelframe(canvas_frame, text="Other Styles:")
    frm_other.grid(row=3, sticky="EW")

    UI["stylevar_chosen_none"] = ttk.Label(frm_chosen, text="No Options!", font="TkMenuFont", justify="center")
    UI["stylevar_other_none"] = ttk.Label(frm_other, text="None!", font="TkMenuFont", justify="center")

    for pos, var in enumerate(styleOptions):
        # Add the special stylevars which apply to all styles
        tk_vars[var.id] = IntVar(value=GEN_OPTS.get_bool("StyleVar", var.id, var.enabled))
        checkbox_special[var.id] = ttk.Checkbutton(
            frame_all, variable=tk_vars[var.id], text=var.name, command=functools.partial(set_stylevar, var.id)
        )
        checkbox_special[var.id].grid(row=pos, column=0, sticky="W", padx=3)

        if var.desc:
            tooltip.add_tooltip(checkbox_special[var.id], var.desc)

    for var in var_list:
        tk_vars[var.id] = IntVar(value=var.default)
        args = {"variable": tk_vars[var.id], "text": var.name, "command": functools.partial(set_stylevar, var.id)}
        checkbox_chosen[var.id] = ttk.Checkbutton(frm_chosen, **args)
        checkbox_other[var.id] = ttk.Checkbutton(frm_other, **args)
        if var.desc:
            tooltip.add_tooltip(checkbox_chosen[var.id], var.desc)
            tooltip.add_tooltip(checkbox_other[var.id], var.desc)

    UI["style_can"].create_window(0, 0, window=canvas_frame, anchor="nw")
    UI["style_can"].update_idletasks()
    UI["style_can"].config(scrollregion=UI["style_can"].bbox(ALL), width=canvas_frame.winfo_reqwidth())
    ttk.Sizegrip(window, cursor=utils.CURSORS["stretch_vert"]).grid(row=1, column=0)

    UI["style_can"].bind("<Configure>", flow_stylevar)

    # Scroll globally even if canvas is not selected.
    if utils.WIN:
        window.bind("<MouseWheel>", lambda e: scroll(int(-1 * (e.delta / 120))))
    elif utils.MAC:
        window.bind("<Button-4>", lambda e: scroll(1))
        window.bind("<Button-5>", lambda e: scroll(-1))