Maniphest T60776

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

Assigned To
Brecht Van Lommel (brecht)
Authored By
Jean Da Costa (jeacom256)
Jan 23 2019, 12:13 AM
Tags
  • BF Blender
Subscribers
Brecht Van Lommel (brecht)
Jacques Lucke (JacquesLucke)
Jean Da Costa (jeacom256)

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()

Related Objects

Mentioned In
T60850: Emulate 3 button mouse couses weird behavior in UI
Mentioned Here
rB0b37399cbe24: Fix T60790, T60636, T60631: MMB emulation issues after recent changes.
rB7f40d553f903: Cleanp: use single global for draw manager

Event Timeline

Jean Da Costa (jeacom256) created this task.Jan 23 2019, 12:13 AM
Jacques Lucke (JacquesLucke) lowered the priority of this task from 90 to 30.Jan 23 2019, 11:42 AM
Jacques Lucke (JacquesLucke) added a subscriber: Jacques Lucke (JacquesLucke).

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

Jean Da Costa (jeacom256) added a comment.Jan 23 2019, 4:00 PM

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

Brecht Van Lommel (brecht) changed the task status from Unknown Status to Resolved.Jan 25 2019, 12:00 PM
Brecht Van Lommel (brecht) claimed this task.
Brecht Van Lommel (brecht) added a subscriber: Brecht Van Lommel (brecht).

Already solved in rB0b37399cbe24: Fix T60790, T60636, T60631: MMB emulation issues after recent changes..