Editing the official pie menus add-on fundamentally I wanted to edit the official pie menus add-on so that instead of Click-Style Intraction ,releasing the pie key without moving the mouse would cause the key to continue its previous function (exp. pressing 'tab' without moving the mouse, switch to edit mode directly instead of appearing the annoying static menu which slow me down.) Reason: Maintaining my muscle memory.

However as I digged into it, it appeared that the new official pie menus add-on is twisted with the blender source itself...

So I want to ask if there is anyway I can achieve this with a python code and editing ui_pie_menus_official.py (within the /2.76/scripts/addons folder) without needing to compile a new branch?

There were a couple of solutions reached my mind but I have no idea about how to practically do it:
-Somehow simulating a 'HOLD' option instead of 'PRESS' for km.keymap_items

-for example if the tab key pressed and if the mouse have moved (kmi = km.keymap_items.new('wm.call_menu_pie', 'MOUSEMOVE', 'ANY')), do kmi.properties.name = 'VIEW3D_PIE_object_mode' else just go to edit mode (ops.object.mode_set(mode='EDIT', toggle=True))

-if the mouse was within the pie circle (or inside pie_menu_threshold) go to edit mode instead of bringing the pie menu.. (However I thinks this requires compiling some C++ codes!)

Thanks
I can think of two approaches that don't involve altering the pie menu addon.

First is to alter the keyboard shortcuts, blender can use any key as a modifier so you can keep &#8633; Tab to toggle edit mode and hold E and press &#8633; Tab to show the pie menu. The standard edit mode shortcut is left in place, the pie menu addon just gets the tab key before the default shortcut.



Another approach that gets closer to your idea is to create an addon that runs an operator on a timer to decide after the set time if it should toggle edit mode or show a pie menu. As it is, this example is awkward to use but could probably be improved with a bit more work. The full addon can be found here with the main operator showing the idea below. The mouse positions passed into the operator's modal() are from the previous modal() call rather than the initial execute, this leads to the mouse needing to be moved just as the timer is triggered to get the menu to show.

class TimedEditMode(bpy.types.Operator):
    """Go into edit mode if tab is held down"""
    bl_idname = "wm.timed_edit_mode"
    bl_label = "Timed Edit Mode"
    _timer = None

    def modal(self, context, event):
        if event.type in {'RIGHTMOUSE', 'ESC'}:
            self.cancel(context)
            return {'CANCELLED'}

        if event.type == 'TIMER':
            move_x = abs(event.mouse_x - event.mouse_prev_x)
            move_y = abs(event.mouse_y - event.mouse_prev_y)
            move_threshold = context.user_preferences.view.pie_menu_threshold

            if move_x &gt; move_threshold or move_y &gt; move_threshold:
                bpy.ops.wm.call_menu_pie(name='OBJECT_MT_mode_menu')
                return {'FINISHED'}
            else:
                bpy.ops.object.mode_set(mode='EDIT', toggle=True)
                return {'FINISHED'}
        return {'PASS_THROUGH'}

    def execute(self, context):
        wm = context.window_manager
        self._timer = wm.event_timer_add(time_to_wait, context.window)
        wm.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)