Help menu: report a bug now links to the new tracker at developer.blender.org.
[blender.git] / release / scripts / startup / bl_ui / space_info.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
3 #  This program is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU General Public License
5 #  as published by the Free Software Foundation; either version 2
6 #  of the License, or (at your option) any later version.
7 #
8 #  This program is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #  GNU General Public License for more details.
12 #
13 #  You should have received a copy of the GNU General Public License
14 #  along with this program; if not, write to the Free Software Foundation,
15 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 from bpy.types import Header, Menu
22
23
24 class INFO_HT_header(Header):
25     bl_space_type = 'INFO'
26
27     def draw(self, context):
28         layout = self.layout
29
30         window = context.window
31         scene = context.scene
32         rd = scene.render
33
34         row = layout.row(align=True)
35         row.template_header()
36
37         if context.area.show_menus:
38             sub = row.row(align=True)
39             sub.menu("INFO_MT_file")
40             if rd.use_game_engine:
41                 sub.menu("INFO_MT_game")
42             else:
43                 sub.menu("INFO_MT_render")
44             sub.menu("INFO_MT_window")
45             sub.menu("INFO_MT_help")
46
47         if window.screen.show_fullscreen:
48             layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
49             layout.separator()
50         else:
51             layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
52             layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
53
54         layout.separator()
55
56         if rd.has_multiple_engines:
57             layout.prop(rd, "engine", text="")
58
59         layout.separator()
60
61         layout.template_running_jobs()
62
63         layout.template_reports_banner()
64
65         row = layout.row(align=True)
66
67         if bpy.app.autoexec_fail is True and bpy.app.autoexec_fail_quiet is False:
68             layout.operator_context = 'EXEC_DEFAULT'
69             row.label("Auto-run disabled: %s" % bpy.app.autoexec_fail_message, icon='ERROR')
70             if bpy.data.is_saved:
71                 props = row.operator("wm.open_mainfile", icon='SCREEN_BACK', text="Reload Trusted")
72                 props.filepath = bpy.data.filepath
73                 props.use_scripts = True
74
75             row.operator("script.autoexec_warn_clear", text="Ignore")
76             return
77
78         row.operator("wm.splash", text="", icon='BLENDER', emboss=False)
79         row.label(text=scene.statistics(), translate=False)
80
81
82 class INFO_MT_file(Menu):
83     bl_label = "File"
84
85     def draw(self, context):
86         layout = self.layout
87
88         layout.operator_context = 'INVOKE_AREA'
89         layout.operator("wm.read_homefile", text="New", icon='NEW')
90         layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
91         layout.menu("INFO_MT_file_open_recent", icon='OPEN_RECENT')
92         layout.operator("wm.recover_last_session", icon='RECOVER_LAST')
93         layout.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='RECOVER_AUTO')
94
95         layout.separator()
96
97         layout.operator_context = 'EXEC_AREA' if context.blend_data.is_saved else 'INVOKE_AREA'
98         layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK')
99
100         layout.operator_context = 'INVOKE_AREA'
101         layout.operator("wm.save_as_mainfile", text="Save As...", icon='SAVE_AS')
102         layout.operator_context = 'INVOKE_AREA'
103         layout.operator("wm.save_as_mainfile", text="Save Copy...", icon='SAVE_COPY').copy = True
104
105         layout.separator()
106
107         layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
108
109         layout.operator_context = 'INVOKE_AREA'
110         layout.operator("wm.save_homefile", icon='SAVE_PREFS')
111         layout.operator_context = 'EXEC_AREA'
112         layout.operator("wm.read_factory_settings", icon='LOAD_FACTORY')
113
114         layout.separator()
115
116         layout.operator_context = 'INVOKE_AREA'
117         layout.operator("wm.link_append", text="Link", icon='LINK_BLEND')
118         props = layout.operator("wm.link_append", text="Append", icon='APPEND_BLEND')
119         props.link = False
120         props.instance_groups = False
121
122         layout.separator()
123
124         layout.menu("INFO_MT_file_import", icon='IMPORT')
125         layout.menu("INFO_MT_file_export", icon='EXPORT')
126
127         layout.separator()
128
129         layout.menu("INFO_MT_file_external_data", icon='EXTERNAL_DATA')
130
131         layout.separator()
132
133         layout.operator_context = 'EXEC_AREA'
134         layout.operator("wm.quit_blender", text="Quit", icon='QUIT')
135
136
137 class INFO_MT_file_import(Menu):
138     bl_idname = "INFO_MT_file_import"
139     bl_label = "Import"
140
141     def draw(self, context):
142         if bpy.app.build_options.collada:
143             self.layout.operator("wm.collada_import", text="Collada (Default) (.dae)")
144
145
146 class INFO_MT_file_export(Menu):
147     bl_idname = "INFO_MT_file_export"
148     bl_label = "Export"
149
150     def draw(self, context):
151         if bpy.app.build_options.collada:
152             self.layout.operator("wm.collada_export", text="Collada (Default) (.dae)")
153
154
155 class INFO_MT_file_external_data(Menu):
156     bl_label = "External Data"
157
158     def draw(self, context):
159         layout = self.layout
160
161         layout.operator("file.pack_all", text="Pack into .blend file")
162         layout.operator("file.unpack_all", text="Unpack into Files")
163
164         layout.separator()
165
166         layout.operator("file.make_paths_relative")
167         layout.operator("file.make_paths_absolute")
168         layout.operator("file.report_missing_files")
169         layout.operator("file.find_missing_files")
170
171
172
173 class INFO_MT_game(Menu):
174     bl_label = "Game"
175
176     def draw(self, context):
177         layout = self.layout
178
179         gs = context.scene.game_settings
180
181         layout.operator("view3d.game_start")
182
183         layout.separator()
184
185         layout.prop(gs, "show_debug_properties")
186         layout.prop(gs, "show_framerate_profile")
187         layout.prop(gs, "show_physics_visualization")
188         layout.prop(gs, "use_deprecation_warnings")
189         layout.prop(gs, "use_animation_record")
190         layout.separator()
191         layout.prop(gs, "use_auto_start")
192
193
194 class INFO_MT_render(Menu):
195     bl_label = "Render"
196
197     def draw(self, context):
198         layout = self.layout
199
200         layout.operator("render.render", text="Render Image", icon='RENDER_STILL')
201         layout.operator("render.render", text="Render Animation", icon='RENDER_ANIMATION').animation = True
202
203         layout.separator()
204
205         layout.operator("render.opengl", text="OpenGL Render Image")
206         layout.operator("render.opengl", text="OpenGL Render Animation").animation = True
207
208         layout.separator()
209
210         layout.operator("render.view_show")
211         layout.operator("render.play_rendered_anim")
212
213
214 class INFO_MT_window(Menu):
215     bl_label = "Window"
216
217     def draw(self, context):
218         import sys
219
220         layout = self.layout
221
222         layout.operator("wm.window_duplicate")
223         layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER')
224
225         layout.separator()
226
227         layout.operator("screen.screenshot").full = True
228         layout.operator("screen.screencast").full = True
229
230         if sys.platform[:3] == "win":
231             layout.separator()
232             layout.operator("wm.console_toggle", icon='CONSOLE')
233
234
235 class INFO_MT_help(Menu):
236     bl_label = "Help"
237
238     def draw(self, context):
239         layout = self.layout
240
241         layout.operator("wm.url_open", text="Manual", icon='HELP').url = "http://wiki.blender.org/index.php/Doc:2.6/Manual"
242         layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-269"
243         layout.separator()
244
245         layout.operator("wm.url_open", text="Blender Website", icon='URL').url = "http://www.blender.org"
246         layout.operator("wm.url_open", text="Blender e-Shop", icon='URL').url = "http://www.blender.org/e-shop"
247         layout.operator("wm.url_open", text="Developer Community", icon='URL').url = "http://www.blender.org/community/get-involved"
248         layout.operator("wm.url_open", text="User Community", icon='URL').url = "http://www.blender.org/community/user-community"
249         layout.separator()
250         layout.operator("wm.url_open", text="Report a Bug", icon='URL').url = "http://developer.blender.org/maniphest/task/create/?project=2&type=Bug"
251         layout.separator()
252
253         layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = bpy.types.WM_OT_doc_view._prefix
254         layout.operator("wm.operator_cheat_sheet", icon='TEXT')
255         layout.operator("wm.sysinfo", icon='TEXT')
256         layout.separator()
257         layout.operator("logic.texface_convert", text="TexFace to Material Convert", icon='GAME')
258         layout.separator()
259
260         layout.operator("wm.splash", icon='BLENDER')
261
262 if __name__ == "__main__":  # only for live edit.
263     bpy.utils.register_module(__name__)