Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_topbar.py
| # SPDX-License-Identifier: GPL-2.0-or-later | # SPDX-License-Identifier: GPL-2.0-or-later | ||||
| import bpy | import bpy | ||||
| from bpy.types import Header, Menu, Panel | from bpy.types import Header, Menu, Panel | ||||
| from bpy.app.translations import pgettext_iface as iface_ | |||||
| class TOPBAR_HT_upper_bar(Header): | class TOPBAR_HT_upper_bar(Header): | ||||
| bl_space_type = 'TOPBAR' | bl_space_type = 'TOPBAR' | ||||
| def draw(self, context): | def draw(self, context): | ||||
| region = context.region | region = context.region | ||||
| if region.alignment == 'RIGHT': | if region.alignment == 'RIGHT': | ||||
| ▲ Show 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | def draw_ex(layout, _context, *, use_splash=False, use_more=False): | ||||
| if not use_more: | if not use_more: | ||||
| props = layout.operator( | props = layout.operator( | ||||
| "wm.read_homefile", text="General", icon=icon) | "wm.read_homefile", text="General", icon=icon) | ||||
| props.app_template = "" | props.app_template = "" | ||||
| for d in paths: | for d in paths: | ||||
| props = layout.operator( | props = layout.operator( | ||||
| "wm.read_homefile", | "wm.read_homefile", | ||||
| text=bpy.path.display_name(d), | text=bpy.path.display_name(iface_(d)), | ||||
| icon=icon, | icon=icon, | ||||
| ) | ) | ||||
| props.app_template = d | props.app_template = d | ||||
| layout.operator_context = 'EXEC_DEFAULT' | layout.operator_context = 'EXEC_DEFAULT' | ||||
| if show_more: | if show_more: | ||||
| layout.menu("TOPBAR_MT_templates_more", text="...") | layout.menu("TOPBAR_MT_templates_more", text="...") | ||||
| ▲ Show 20 Lines • Show All 575 Lines • Show Last 20 Lines | |||||