File: kiwi.environ.Application.html

package info (click to toggle)
kiwi 1.9.22-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 11,976 kB
  • ctags: 5,619
  • sloc: python: 15,767; ansic: 193; xml: 77; makefile: 53; sh: 18
file content (250 lines) | stat: -rw-r--r-- 8,724 bytes parent folder | download | duplicates (3)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>API docs for &ldquo;kiwi.environ.Application&rdquo;</title>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
    <link href="apidocs.css" type="text/css" rel="stylesheet" />
    
    
  </head>
  <body>
    <h1 class="class">Class k.e.Application(<a href="kiwi.environ.Library.html">Library</a>):</h1>
    <p>
      <span id="part">Part of <a href="kiwi.html">kiwi</a>.<a href="kiwi.environ.html">environ</a></span>
      
      <a href="classIndex.html#kiwi.environ.Application">View In Hierarchy</a>
    </p>
    <div>
      
    </div>
    <div><p>Application extends a <a 
href="kiwi.environ.Library.html"><code>Library</code></a>. It's meant to be
used by applications</p>
Libraries are usually instantiated in __init__.py in the topmost package
in your library, an example usage is kiwi itself which does:
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> kiwi.environ <span class="py-keyword">import</span> Application
<span class="py-prompt">&gt;&gt;&gt; </span>app = Application(<span class="py-string">'gnomovision'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">if</span> app.uninstalled:
<span class="py-prompt">&gt;&gt;&gt; </span>    app.add_global_resource(<span class="py-string">'glade'</span>, <span class="py-string">'glade'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>    app.add_global_resource(<span class="py-string">'pixmap'</span>, <span class="py-string">'pixmaps'</span>)</pre>
If you want to do translations, you also need to do the following:
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>app.enable_translation()</pre>
<table class="fieldTable"><tr class="fieldStart"><td class="fieldName">See Also</td><td colspan="2"><a href="kiwi.environ.Library.html"><code>Library</code></a> for more 
information on how to integrate it with the standard distutils 
configuration.
</td></tr></table></div>
    
    
    <div id="splitTables">
      <table class="children sortable" id="id399">
  
  
  
  
  <tr class="method">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Application.html#__init__">__init__</a></td>
    <td><span>Creates a new library, this is usually called in __init__.py in a
</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Application.html#_get_main">_get_main</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Application.html#enable_translation">enable_translation</a></td>
    <td><span>Enables translation for a application
</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Application.html#run">run</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr>
  
</table>
      
        <p>
          Inherited from <a href="kiwi.environ.Library.html">Library</a>:
        </p>
        <table class="children sortable" id="id400">
  
  
  
  
  <tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#_check_translation">_check_translation</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#set_application_domain">set_application_domain</a></td>
    <td><span>Sets the default application domain
</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#add_global_resource">add_global_resource</a></td>
    <td><span>Convenience method to add a global resource.
</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Library.html#add_global_resources">add_global_resources</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr>
  
</table>
      
        <p>
          Inherited from <a href="kiwi.environ.Environment.html">Environment</a> (via <a href="kiwi.environ.Library.html">Library</a>):
        </p>
        <table class="children sortable" id="id401">
  
  
  
  
  <tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#get_root">get_root</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#get_log_level">get_log_level</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#_add_extensions">_add_extensions</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#_add_resource_variable">_add_resource_variable</a></td>
    <td><span>Add resources from an environment variable
</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#get_resource_paths">get_resource_paths</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#add_resource">add_resource</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#add_resources">add_resources</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#find_resource">find_resource</a></td>
    <td><span>Locate a specific resource of called name of type resource
</span></td>
  </tr><tr class="basemethod">
    
    
    <td>Method</td>
    <td><a href="kiwi.environ.Environment.html#_get_epydoc">_get_epydoc</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr>
  
</table>
      
      
    </div>
    
    
    
    <div class="function">
        <a name="kiwi.environ.Application.__init__"></a>
        <a name="__init__"></a>
        <div class="functionHeader">
        
        def __init__(self, name, root='..', path='main', dirname=None):
        
      </div>
        <div class="functionBody">
          <div class="interfaceinfo">overrides <a href="kiwi.environ.Library.html#__init__">kiwi.environ.Library.__init__</a></div>
          <div>Creates a new library, this is usually called in __init__.py in a 
toplevel package. All resources will be relative to the <i>root</i> 
directory.
<table class="fieldTable"><tr class="fieldStart"><td class="fieldName">Parameters</td><td class="fieldArg">name</td><td>name of the library
</td></tr><tr><td></td><td class="fieldArg">root</td><td>root directory
</td></tr><tr><td></td><td class="fieldArg">dirname</td><td></td></tr></table></div>
        </div>
      </div><div class="function">
        <a name="kiwi.environ.Application._get_main"></a>
        <a name="_get_main"></a>
        <div class="functionHeader">
        
        def _get_main(self):
        
      </div>
        <div class="functionBody">
          
          <div class="undocumented">Undocumented</div>
        </div>
      </div><div class="function">
        <a name="kiwi.environ.Application.enable_translation"></a>
        <a name="enable_translation"></a>
        <div class="functionHeader">
        
        def enable_translation(self, domain=None, localedir=None):
        
      </div>
        <div class="functionBody">
          <div class="interfaceinfo">overrides <a href="kiwi.environ.Library.html#enable_translation">kiwi.environ.Library.enable_translation</a></div>
          <div>Enables translation for a application See <a 
href="kiwi.environ.Library.html#enable_translation"><code>Library.enable_translation</code></a>.
<table class="fieldTable"></table></div>
        </div>
      </div><div class="function">
        <a name="kiwi.environ.Application.run"></a>
        <a name="run"></a>
        <div class="functionHeader">
        
        def run(self):
        
      </div>
        <div class="functionBody">
          
          <div class="undocumented">Undocumented</div>
        </div>
      </div>
    
    <address>
      <a href="index.html">API Documentation</a> for Kiwi, generated by <a href="http://codespeak.net/~mwh/pydoctor/">pydoctor</a> at 2008-05-29 16:06:17.
    </address>
  </body>
</html>