Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_topbar.py
| Context not available. | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| file = context.blend_data | |||||
| layout.operator_context = 'INVOKE_AREA' | layout.operator_context = 'INVOKE_AREA' | ||||
| layout.menu("TOPBAR_MT_file_new", 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') | ||||
| Context not available. | |||||
| layout.separator() | layout.separator() | ||||
| layout.operator_context = 'EXEC_AREA' if context.blend_data.is_saved else 'INVOKE_AREA' | layout.operator_context = 'EXEC_AREA' if file.is_saved else 'INVOKE_AREA' | ||||
| layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK') | # Dim the "Save" if the file is not dirty or goes to "Save As". | ||||
| sub = layout.column() | |||||
| sub.active = file.is_dirty and file.is_saved | |||||
| sub.operator("wm.save_mainfile", text="Save", icon='FILE_TICK') | |||||
| layout.operator_context = 'INVOKE_AREA' | layout.operator_context = 'INVOKE_AREA' | ||||
| layout.operator("wm.save_as_mainfile", text="Save As...") | layout.operator("wm.save_as_mainfile", text="Save As...") | ||||
| Context not available. | |||||