Page MenuHome

Keymaps added from python doesn't behave correctly.
Closed, ResolvedPublic

Description

System Information
Operating system: Windows 7
Graphics card: Nvidia geforce 1050

Blender Version
Broken: 7f40d553f903

Short description of error
A keymap added from python to call a custom menu makes the menu behaves incorrectly.
The menu requires a double click in order to activate any entrie

Exact steps for others to reproduce the error
use the default cube scene
go to edit mode
paste and run this code on text editor:
press Alt + W to activate the custom menu,
in principle, it might look ok but if you try to select an option, it requires a second click (which shouldn't).

import bpy
from bpy.types import Menu

# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)


class VIEW3D_PIE_template(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Select Mode"

    def draw(self, context):
        layout = self.layout

        pie = layout.menu_pie()
        # operator_enum will just spread all available options
        # for the type enum of the operator on the pie
        pie.operator_enum("mesh.select_mode", "type")


def register():
    km = bpy.context.window_manager.keyconfigs.addon.keymaps.new(name="3D View", space_type="VIEW_3D")
    kmi = km.keymap_items.new("wm.call_menu_pie", type="W", alt=True, value="PRESS")
    kmi.properties.name = "VIEW3D_PIE_template"
    
    bpy.utils.register_class(VIEW3D_PIE_template)

if __name__ == "__main__":
    register()

Event Timeline

Jacques Lucke (JacquesLucke) lowered the priority of this task from 90 to 30.Jan 23 2019, 11:42 AM

Seems to work as expected here. Can you upload a short .gif to show the issue?

@Jacques Lucke (JacquesLucke) It turns out that this problem is being caused by the emulate 3 button mouse option,
here's the .gif