← All ideas
  • Published 18 Aug 2021

Asking what the Python is to scroll and show the active-workspace tab label

Hi.

Where can I find/access the horizontal scroll property value for the TOPBAR menu-and-tabs, or the active workspace tab position ? I'd like to see which tab label is active but it is often off to the right of my hardware's desktop/display space.

Workspace tabs don't become visible when I do Ctrl+PgUp or Ctrl+PgDn to select them, so I'd like to write a bit of code that finds out where the tab is and scrolls it horizontally into the middle of the tab bar.

I'd like to be able to do this because it will mean being about to work a little more conveniently than by moving the mouse to the menu to set the horizontal menu scrollwheel context, even after the workspace tab already changed. It is trivial but also distracting.

Is it somewhere in bpy.data.window_managers['WinMan'].windows[0] or bpy.context.window_manager['WinMan'].windows[0] ?

Thanks.

This code can find where I want the workspace tab to be put, and move the mouse there, but I don't know how to situate the tab menu scroll line via bpy . I don't want to have to try achieving it with pyautogui , so I'd be grateful for your help.

import bpy
import pyautogui
step_time = 1.4
original_x, original_y = pyautogui.position().x, pyautogui.position().y
window_x_center = bpy.data.window_managers["WinMan"].windows[0].width/2
pyautogui.moveTo(window_x_center, 10, step_time, pyautogui.easeOutQuint)
pyautogui.moveTo(original_x, original_y, step_time, pyautogui.easeOutQuint)

...

>>> for d in bpy.context.window.screen.bl_rna.properties.items(): print (d)
... 
('rna_type', <bpy_struct, PointerProperty("rna_type") at 0xe96dfa0>)
('name', <bpy_struct, StringProperty("name") at 0xe96de80>)
('name_full', <bpy_struct, StringProperty("name_full") at 0xe96dd60>)
('is_evaluated', <bpy_struct, BoolProperty("is_evaluated") at 0xe96dc40>)
('original', <bpy_struct, PointerProperty("original") at 0xe96db40>)
('users', <bpy_struct, IntProperty("users") at 0xe96da00>)
('use_fake_user', <bpy_struct, BoolProperty("use_fake_user") at 0xe96d8e0>)
('is_embedded_data', <bpy_struct, BoolProperty("is_embedded_data") at 0xe96d7c0>)
('tag', <bpy_struct, BoolProperty("tag") at 0xe96d6a0>)
('is_library_indirect', <bpy_struct, BoolProperty("is_library_indirect") at 0xe96d580>)
('library', <bpy_struct, PointerProperty("library") at 0xe96d480>)
('asset_data', <bpy_struct, PointerProperty("asset_data") at 0xe96d380>)
('override_library', <bpy_struct, PointerProperty("override_library") at 0xe96d280>)
('preview', <bpy_struct, PointerProperty("preview") at 0xe96d180>)
('areas', <bpy_struct, CollectionProperty("areas") at 0xec54600>)
('is_animation_playing', <bpy_struct, BoolProperty("is_animation_playing") at 0xec544e0>)
('is_scrubbing', <bpy_struct, BoolProperty("is_scrubbing") at 0xec543c0>)
('is_temporary', <bpy_struct, BoolProperty("is_temporary") at 0xec542a0>)
('show_fullscreen', <bpy_struct, BoolProperty("show_fullscreen") at 0xec54180>)
('show_statusbar', <bpy_struct, BoolProperty("show_statusbar") at 0xec54060>)
('use_play_top_left_3d_editor', <bpy_struct, BoolProperty("use_play_top_left_3d_editor") at 0xec53f40>)
('use_play_3d_editors', <bpy_struct, BoolProperty("use_play_3d_editors") at 0xec53e20>)
('use_follow', <bpy_struct, BoolProperty("use_follow") at 0xec53d00>)
('use_play_animation_editors', <bpy_struct, BoolProperty("use_play_animation_editors") at 0xec53be0>)
('use_play_properties_editors', <bpy_struct, BoolProperty("use_play_properties_editors") at 0xec53ac0>)
('use_play_image_editors', <bpy_struct, BoolProperty("use_play_image_editors") at 0xec539a0>)
('use_play_sequence_editors', <bpy_struct, BoolProperty("use_play_sequence_editors") at 0xec53880>)
('use_play_node_editors', <bpy_struct, BoolProperty("use_play_node_editors") at 0xec53760>)
('use_play_clip_editors', <bpy_struct, BoolProperty("use_play_clip_editors") at 0xec53640>)
>>> 
>>> bpy.context.window.screen.bl_rna.properties['areas']
<bpy_struct, CollectionProperty("areas") at 0xec54600>

>>> bpy.context.window.screen.bl_rna.properties['areas'].
                                                         as_pointer(
                                                         bl_rna
                                                         bl_rna_get_subclass(
                                                         bl_rna_get_subclass_py(
                                                         description
                                                         driver_add(
                                                         driver_remove(
                                                         fixed_type
                                                         get(
                                                         icon
                                                         id_data
                                                         id_properties_clear(
                                                         id_properties_ensure(
                                                         identifier
                                                         is_animatable
                                                         is_argument_optional
                                                         is_enum_flag
                                                         is_hidden
                                                         is_library_editable
                                                         is_never_none
                                                         is_output
                                                         is_overridable
                                                         is_property_hidden(
                                                         is_property_overridable_library(
                                                         is_property_readonly(
                                                         is_property_set(
                                                         is_readonly
                                                         is_registered
                                                         is_registered_optional
                                                         is_required
                                                         is_runtime
                                                         is_skip_save
                                                         items(
                                                         keyframe_delete(
                                                         keyframe_insert(
                                                         keys(
                                                         name
                                                         path_from_id(
                                                         path_resolve(
                                                         pop(
                                                         property_overridable_library_set(
                                                         property_unset(
                                                         rna_type
                                                         srna
                                                         subtype
                                                         tags
                                                         translation_context
                                                         type
                                                         type_recast(
                                                         unit
                                                         values(
100%

Development Status: Open

Upvote 2 Downvote 0
rdmo
18 Aug 2021

3 Comments

rdmo Author

Setting up an operator to center the TOPBAR MT_MENU on the active workspace tab when it changes is harder expected. The horizontal scroll position of the top menu bar is not available via bpy , at least according to my searches so far.

rdmo Author

Thanks for your input, @IIIFGIII, I don't want to try to reinvent the wheel. Your advice prompted me to find pages that may help like blender.stackexchange.com/questions/110095/list-of-menu-bl-idnames-info-mt-file-export-etc

Cheers.