NLA SoC: Merge from 2.5
[blender.git] / release / ui / space_filebrowser.py
1
2 import bpy
3
4
5 class FILEBROWSER_HT_header(bpy.types.Header):
6         __space_type__ = "FILE_BROWSER"
7         __idname__ = "FILEBROWSER_HT_header"
8
9         def draw(self, context):
10                 st = context.space_data
11                 layout = self.layout
12                 
13                 params = st.params 
14                 layout.template_header()
15
16                 if context.area.show_menus:
17                         row = layout.row()
18                         row.itemM("FILEBROWSER_MT_directory")
19                         row.itemM("FILEBROWSER_MT_bookmarks")
20                         
21                 row = layout.row(align=True)
22                 row.itemO("FILE_OT_parent", text="", icon='ICON_FILE_PARENT')
23                 row.itemO("FILE_OT_refresh", text="", icon='ICON_FILE_REFRESH')
24
25                 layout.itemR(params, "display", expand=True, text="")
26                 layout.itemR(params, "sort", expand=True, text="")
27                 
28                 layout.itemR(params, "hide_dot")
29                 layout.itemR(params, "do_filter")
30                 
31                 row = layout.row(align=True)
32                 row.itemR(params, "filter_folder", text="");
33                 row.itemR(params, "filter_blender", text="");
34                 row.itemR(params, "filter_image", text="");
35                 row.itemR(params, "filter_movie", text="");
36                 row.itemR(params, "filter_script", text="");
37                 row.itemR(params, "filter_font", text="");
38                 row.itemR(params, "filter_sound", text="");
39                 row.itemR(params, "filter_text", text="");
40
41                 row.active = params.do_filter
42
43 class FILEBROWSER_MT_directory(bpy.types.Menu):
44         __space_type__ = "FILE_BROWSER"
45         __label__ = "Directory"
46
47         def draw(self, context):
48                 layout = self.layout
49
50                 layout.itemO("FILE_OT_refresh", text="Refresh", icon='ICON_FILE_REFRESH')
51                 layout.itemO("FILE_OT_parent", text="Parent", icon='ICON_FILE_PARENT')
52                 
53 class FILEBROWSER_MT_bookmarks(bpy.types.Menu):
54         __space_type__ = "FILE_BROWSER"
55         __label__ = "Bookmarks"
56
57         def draw(self, context):
58                 layout = self.layout
59
60                 layout.itemO("FILE_OT_add_bookmark", text="Add current directory", icon='ICON_BOOKMARKS')
61
62                 
63 bpy.types.register(FILEBROWSER_HT_header)
64 bpy.types.register(FILEBROWSER_MT_directory)
65 bpy.types.register(FILEBROWSER_MT_bookmarks)