1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 """Admin class, specify how the main window should look like"""
29
31
32 sections = []
33 admins = {}
34
36 """The main sections to be used in the navigation pane of the application,
37 all entities will be put in such a section, depending on the properties of
38 their EntityAdmin class, a list of tuples of strings and icons
39 [('section', ('Section display name',section_icon))]
40 """
41 if main_sections:
42 self.sections = main_sections
43
44 - def register(self, entity, admin_class):
45 self.admins[entity] = admin_class
46
49
51 """Get the default entity admin for this entity, return None, if not
52 existant"""
53 try:
54 return self.admins[entity](self, entity)
55 except KeyError:
56 pass
57 if hasattr(entity, 'Admin'):
58 return entity.Admin(self, entity)
59
61 """Get the root query for an entity"""
62 return entity.query
63
65 """
66 @return: a list of tuples of (admin, query) instances related to
67 the entities in this section.
68 """
69 result = [(self.getEntityAdmin(e), self.getEntityQuery(e))
70 for e, a in self.admins.items()
71 if hasattr(a, 'section')
72 and a.section == section]
73 result.sort(cmp = lambda x, y: cmp(x[0].getName(), y[0].getName()))
74 return result
75
77 """@return: a list of actions that should be added to the menu and the icon
78 bar for this application, each action is a tuple of (name, icon, callable),
79 where callable is a function taking no arguments that will be called when
80 the action is executed. Callable will be called in the model thread.
81 """
82 return []
83
85 """@return: the name of the application"""
86 return "Project Camelot"
87
91
93 """@return: the content of the About dialog"""
94 return """<b>Camelot Project</b>
95 <p>
96 Copyright © 2008 Conceptive Engineering.
97 All right reserved.
98 </p>"""
99