コード例 #1
0
ファイル: contextWin.py プロジェクト: Stendec-UA/BEE2.4
def show_prop(widget, warp_cursor=False):
    """Show the properties window for an item.

    wid should be the UI.PalItem widget that represents the item.
    If warp_cursor is  true, the cursor will be moved relative to this window so
    it stays on top of the selected subitem.
    """
    global selected_item, selected_sub_item, is_open
    if warp_cursor and is_open:
        cursor_x, cursor_y = prop_window.winfo_pointerxy()
        off_x = cursor_x-prop_window.winfo_rootx()
        off_y = cursor_y-prop_window.winfo_rooty()
    else:
        off_x, off_y = None, None
    prop_window.deiconify()
    prop_window.lift(TK_ROOT)
    selected_item = widget.item
    selected_sub_item = widget
    is_open = True

    icon_widget = wid['subitem'][pos_for_item()]

    # Calculate the pixel offset between the window and the subitem in
    # the properties dialog, and shift if needed to keep it inside the
    # window
    loc_x, loc_y = utils.adjust_inside_screen(
        x=(
            widget.winfo_rootx()
            + prop_window.winfo_rootx()
            - icon_widget.winfo_rootx()
        ),
        y=(
            widget.winfo_rooty()
            + prop_window.winfo_rooty()
            - icon_widget.winfo_rooty()
        ),
        win=prop_window,
    )

    prop_window.geometry('+{x!s}+{y!s}'.format(x=loc_x, y=loc_y))
    prop_window.relX = loc_x-TK_ROOT.winfo_x()
    prop_window.relY = loc_y-TK_ROOT.winfo_y()

    if off_x is not None and off_y is not None:
        # move the mouse cursor
        prop_window.event_generate('<Motion>', warp=True, x=off_x, y=off_y)

    load_item_data()
コード例 #2
0
ファイル: contextWin.py プロジェクト: Stendec-UA/BEE2.4
def show_prop(widget, warp_cursor=False):
    """Show the properties window for an item.

    wid should be the UI.PalItem widget that represents the item.
    If warp_cursor is  true, the cursor will be moved relative to this window so
    it stays on top of the selected subitem.
    """
    global selected_item, selected_sub_item, is_open
    if warp_cursor and is_open:
        cursor_x, cursor_y = prop_window.winfo_pointerxy()
        off_x = cursor_x - prop_window.winfo_rootx()
        off_y = cursor_y - prop_window.winfo_rooty()
    else:
        off_x, off_y = None, None
    prop_window.deiconify()
    prop_window.lift(TK_ROOT)
    selected_item = widget.item
    selected_sub_item = widget
    is_open = True

    icon_widget = wid['subitem'][pos_for_item()]

    # Calculate the pixel offset between the window and the subitem in
    # the properties dialog, and shift if needed to keep it inside the
    # window
    loc_x, loc_y = utils.adjust_inside_screen(
        x=(widget.winfo_rootx() + prop_window.winfo_rootx() -
           icon_widget.winfo_rootx()),
        y=(widget.winfo_rooty() + prop_window.winfo_rooty() -
           icon_widget.winfo_rooty()),
        win=prop_window,
    )

    prop_window.geometry('+{x!s}+{y!s}'.format(x=loc_x, y=loc_y))
    prop_window.relX = loc_x - TK_ROOT.winfo_x()
    prop_window.relY = loc_y - TK_ROOT.winfo_y()

    if off_x is not None and off_y is not None:
        # move the mouse cursor
        prop_window.event_generate('<Motion>', warp=True, x=off_x, y=off_y)

    load_item_data()
コード例 #3
0
ファイル: contextWin.py プロジェクト: Stendec-UA/BEE2.4
def follow_main(_=None):
    """Move the properties window to keep a relative offset to the main window.

    """
    prop_window.geometry('+'+str(prop_window.relX+TK_ROOT.winfo_x()) +
                         '+'+str(prop_window.relY+TK_ROOT.winfo_y()))
コード例 #4
0
ファイル: contextWin.py プロジェクト: Stendec-UA/BEE2.4
def follow_main(_=None):
    """Move the properties window to keep a relative offset to the main window.

    """
    prop_window.geometry('+' + str(prop_window.relX + TK_ROOT.winfo_x()) +
                         '+' + str(prop_window.relY + TK_ROOT.winfo_y()))