Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_topbar.py
| Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | def app_template_paths(): | ||||
| if os.path.isdir(template): | if os.path.isdir(template): | ||||
| # template_paths_expand.append(template) | # template_paths_expand.append(template) | ||||
| app_templates.append(d) | app_templates.append(d) | ||||
| return sorted(app_templates) | return sorted(app_templates) | ||||
| @staticmethod | @staticmethod | ||||
| def draw_ex(layout, _context, *, use_splash=False, use_more=False): | def draw_ex(layout, _context, *, use_splash=False, use_more=False): | ||||
| layout.operator_context = 'EXEC_DEFAULT' | layout.operator_context = 'INVOKE_DEFAULT' | ||||
| # Limit number of templates in splash screen, spill over into more menu. | # Limit number of templates in splash screen, spill over into more menu. | ||||
| paths = TOPBAR_MT_file_new.app_template_paths() | paths = TOPBAR_MT_file_new.app_template_paths() | ||||
| splash_limit = 5 | splash_limit = 5 | ||||
| if use_splash: | if use_splash: | ||||
| icon = 'FILE_NEW' | icon = 'FILE_NEW' | ||||
| show_more = len(paths) > (splash_limit - 1) | show_more = len(paths) > (splash_limit - 1) | ||||
| ▲ Show 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | |||||
| class TOPBAR_MT_file_context_menu(Menu): | class TOPBAR_MT_file_context_menu(Menu): | ||||
| bl_label = "File Context Menu" | bl_label = "File Context Menu" | ||||
| def draw(self, _context): | def draw(self, _context): | ||||
| layout = self.layout | layout = self.layout | ||||
| layout.operator_context = 'INVOKE_AREA' | layout.operator_context = 'INVOKE_AREA' | ||||
| layout.operator("wm.read_homefile", text="New", icon='FILE_NEW') | layout.menu("TOPBAR_MT_file_new", text="New", icon='FILE_NEW') | ||||
| layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER') | layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER') | ||||
| layout.separator() | layout.separator() | ||||
| layout.operator("wm.link", text="Link...", icon='LINK_BLEND') | layout.operator("wm.link", text="Link...", icon='LINK_BLEND') | ||||
| layout.operator("wm.append", text="Append...", icon='APPEND_BLEND') | layout.operator("wm.append", text="Append...", icon='APPEND_BLEND') | ||||
| layout.separator() | layout.separator() | ||||
| ▲ Show 20 Lines • Show All 181 Lines • Show Last 20 Lines | |||||