Merge lp:~quickly-committers/quickly/gtk3-projects into lp:quickly
- gtk3-projects
- Merge into trunk
Proposed by
Michael Terry
Status: | Merged |
---|---|
Merged at revision: | 645 |
Proposed branch: | lp:~quickly-committers/quickly/gtk3-projects |
Merge into: | lp:quickly |
Diff against target: |
1834 lines (+265/-696) 38 files modified
data/templates/ubuntu-application/create.py (+13/-1) data/templates/ubuntu-application/help/code/JottyWindow.py (+1/-1) data/templates/ubuntu-application/help/tutorial.xml (+1/-1) data/templates/ubuntu-application/project_root/.bzrignore (+1/-0) data/templates/ubuntu-application/project_root/data/glib-2.0/schemas/net.launchpad.project_name.gschema.xml (+10/-0) data/templates/ubuntu-application/project_root/data/ui/Aboutcamel_case_nameDialog.ui (+11/-13) data/templates/ubuntu-application/project_root/data/ui/Preferencescamel_case_nameDialog.ui (+68/-49) data/templates/ubuntu-application/project_root/data/ui/camel_case_nameWindow.ui (+1/-2) data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py (+9/-25) data/templates/ubuntu-application/project_root/python/__init__.py (+3/-16) data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py (+1/-1) data/templates/ubuntu-application/project_root/python_lib/AboutDialog.py (+2/-2) data/templates/ubuntu-application/project_root/python_lib/Builder.py (+29/-14) data/templates/ubuntu-application/project_root/python_lib/PreferencesDialog.py (+3/-84) data/templates/ubuntu-application/project_root/python_lib/Window.py (+8/-10) data/templates/ubuntu-application/project_root/python_lib/__init__.py (+0/-1) data/templates/ubuntu-application/project_root/python_lib/helpers.py (+3/-4) data/templates/ubuntu-application/project_root/python_lib/preferences.py (+0/-100) data/templates/ubuntu-application/project_root/tests/test_example.py (+1/-1) data/templates/ubuntu-application/run.py (+13/-1) data/templates/ubuntu-application/store/data/ui/dialog_camel_case_nameDialog.ui (+13/-9) data/templates/ubuntu-application/store/data/ui/dialog_python_name_dialog.xml (+1/-1) data/templates/ubuntu-application/store/dialog.py (+1/-1) data/templates/ubuntu-application/store/python/dialog_camel_case_nameDialog.py (+5/-5) data/templates/ubuntu-application/store/python/indicator.py (+7/-8) data/templates/ubuntu-application/test/apport/apport.sh (+12/-5) data/templates/ubuntu-application/test/builder/builder.py (+2/-2) data/templates/ubuntu-application/test/configure.sh (+2/-3) data/templates/ubuntu-application/test/filelist.sh (+5/-2) data/templates/ubuntu-application/test/metadata.sh (+2/-4) data/templates/ubuntu-application/test/preferences.py (+0/-151) data/templates/ubuntu-application/upgrade.py (+4/-2) data/templates/ubuntu-flash-game/internal/apportutils.py (+0/-143) data/templates/ubuntu-flash-game/project_root/bin/project_name (+8/-7) quickly/quicklyconfig.py (+1/-1) quickly/test/pylint.sh (+1/-1) setup.py (+1/-1) ubuntudevbar.py (+22/-24) |
To merge this branch: | bzr merge lp:~quickly-committers/quickly/gtk3-projects |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Didier Roche-Tolomelli | Approve | ||
Review via email: mp+81600@code.launchpad.net |
Commit message
Description of the change
Woo! Gtk3/PyGI/GSettings all wrapped into one branch (because they can't be done separately).
Lots of changes. I dropped desktopcouch for gsettings (as discussed in mailing list). Rest of changes are pretty expected.
Tests all pass now (with latest python-
To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote : | # |
I missed your review comment! I was sitting here thinking, "Man, didrocks is taking forever with gtk3... What?! He's on holiday!? Son of a..." Then I checked and you had approved! :)
The "quickly upgrade 0.3" changes were just a spot of cleanup because the "0.4" argument was not actually doing anything. Merged it after double confirming that tests pass.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote : | # |
See, don't be so mean ;)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/templates/ubuntu-application/create.py' |
2 | --- data/templates/ubuntu-application/create.py 2011-06-06 10:14:40 +0000 |
3 | +++ data/templates/ubuntu-application/create.py 2011-11-08 16:10:57 +0000 |
4 | @@ -107,10 +107,22 @@ |
5 | bzr_instance.wait() |
6 | bzr_instance = subprocess.Popen(["bzr", "commit", "-m", "Initial project creation with Quickly!"], stderr=subprocess.PIPE) |
7 | |
8 | +# Compile schema if present |
9 | +schemapath = os.path.abspath("data/glib-2.0/schemas") |
10 | +if os.path.exists(schemapath): |
11 | + subprocess.call(["glib-compile-schemas", schemapath]) |
12 | + |
13 | + env = os.environ.copy() |
14 | + datadir = os.path.abspath("data") |
15 | + if 'XDG_DATA_DIRS' in env: |
16 | + env['XDG_DATA_DIRS'] = "%s:%s" % (datadir, env['XDG_DATA_DIRS']) |
17 | + else: |
18 | + env['XDG_DATA_DIRS'] = datadir |
19 | + |
20 | # run the new application if X display |
21 | if templatetools.is_X_display() and os.path.isfile(exec_file): |
22 | print _("Launching your newly created project!") |
23 | - subprocess.call(['./' + project_name], cwd='bin/') |
24 | + subprocess.call(['./' + project_name], cwd='bin/', env=env) |
25 | |
26 | bzr_instance.wait() |
27 | |
28 | |
29 | === modified file 'data/templates/ubuntu-application/help/code/JottyWindow.py' |
30 | --- data/templates/ubuntu-application/help/code/JottyWindow.py 2011-04-04 13:55:18 +0000 |
31 | +++ data/templates/ubuntu-application/help/code/JottyWindow.py 2011-11-08 16:10:57 +0000 |
32 | @@ -7,7 +7,7 @@ |
33 | from gettext import gettext as _ |
34 | gettext.textdomain('jotty') |
35 | |
36 | -import gtk |
37 | +from gi.repository import Gtk # pylint: disable=E0611 |
38 | import logging |
39 | logger = logging.getLogger('jotty') |
40 | |
41 | |
42 | === modified file 'data/templates/ubuntu-application/help/tutorial.xml' |
43 | --- data/templates/ubuntu-application/help/tutorial.xml 2011-09-26 13:02:43 +0000 |
44 | +++ data/templates/ubuntu-application/help/tutorial.xml 2011-11-08 16:10:57 +0000 |
45 | @@ -3,7 +3,7 @@ |
46 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ |
47 | |
48 | <!ENTITY appname "<application>Quickly</application>" > |
49 | - <!ENTITY appversion "11.10" > |
50 | + <!ENTITY appversion "11.11" > |
51 | ] > |
52 | |
53 | <book lang="en" id="index"> |
54 | |
55 | === added file 'data/templates/ubuntu-application/project_root/.bzrignore' |
56 | --- data/templates/ubuntu-application/project_root/.bzrignore 1970-01-01 00:00:00 +0000 |
57 | +++ data/templates/ubuntu-application/project_root/.bzrignore 2011-11-08 16:10:57 +0000 |
58 | @@ -0,0 +1,1 @@ |
59 | +data/glib-2.0/schemas/gschemas.compiled |
60 | |
61 | === added directory 'data/templates/ubuntu-application/project_root/data/glib-2.0' |
62 | === added directory 'data/templates/ubuntu-application/project_root/data/glib-2.0/schemas' |
63 | === added file 'data/templates/ubuntu-application/project_root/data/glib-2.0/schemas/net.launchpad.project_name.gschema.xml' |
64 | --- data/templates/ubuntu-application/project_root/data/glib-2.0/schemas/net.launchpad.project_name.gschema.xml 1970-01-01 00:00:00 +0000 |
65 | +++ data/templates/ubuntu-application/project_root/data/glib-2.0/schemas/net.launchpad.project_name.gschema.xml 2011-11-08 16:10:57 +0000 |
66 | @@ -0,0 +1,10 @@ |
67 | +<?xml version="1.0" encoding="UTF-8"?> |
68 | +<schemalist gettext-domain="project_name"> |
69 | + <schema id="net.launchpad.project_name" path="/net/launchpad/project_name/"> |
70 | + <key name="example" type="s"> |
71 | + <default>''</default> |
72 | + <summary>Sample setting</summary> |
73 | + <description>Longer description of this sample setting. Talk about allowed values and what it does.</description> |
74 | + </key> |
75 | + </schema> |
76 | +</schemalist> |
77 | |
78 | === modified file 'data/templates/ubuntu-application/project_root/data/ui/Aboutcamel_case_nameDialog.ui' |
79 | --- data/templates/ubuntu-application/project_root/data/ui/Aboutcamel_case_nameDialog.ui 2010-12-20 15:44:44 +0000 |
80 | +++ data/templates/ubuntu-application/project_root/data/ui/Aboutcamel_case_nameDialog.ui 2011-11-08 16:10:57 +0000 |
81 | @@ -1,39 +1,37 @@ |
82 | -<?xml version="1.0"?> |
83 | +<?xml version="1.0" encoding="UTF-8"?> |
84 | <interface> |
85 | - <requires lib="gtk+" version="2.16"/> |
86 | <!-- interface-requires about_python_name_dialog 1.0 --> |
87 | - <!-- interface-naming-policy project-wide --> |
88 | + <!-- interface-requires gtk+ 3.0 --> |
89 | <object class="Aboutcamel_case_nameDialog" id="about_python_name_dialog"> |
90 | + <property name="can_focus">False</property> |
91 | <property name="border_width">5</property> |
92 | <property name="icon">../media/project_name.svg</property> |
93 | <property name="type_hint">normal</property> |
94 | - <property name="has_separator">False</property> |
95 | <property name="program_name">sentence_name</property> |
96 | - <property name="version"></property> |
97 | - <property name="copyright"></property> |
98 | - <property name="website"></property> |
99 | - <property name="license"></property> |
100 | <property name="authors"></property> |
101 | <property name="logo">../media/project_name.svg</property> |
102 | <child internal-child="vbox"> |
103 | - <object class="GtkVBox" id="dialog-vbox1"> |
104 | + <object class="GtkBox" id="dialog-vbox1"> |
105 | <property name="visible">True</property> |
106 | + <property name="can_focus">False</property> |
107 | <property name="orientation">vertical</property> |
108 | <property name="spacing">2</property> |
109 | - <child> |
110 | - <placeholder/> |
111 | - </child> |
112 | <child internal-child="action_area"> |
113 | - <object class="GtkHButtonBox" id="dialog-action_area1"> |
114 | + <object class="GtkButtonBox" id="dialog-action_area1"> |
115 | <property name="visible">True</property> |
116 | + <property name="can_focus">False</property> |
117 | <property name="layout_style">end</property> |
118 | </object> |
119 | <packing> |
120 | <property name="expand">False</property> |
121 | + <property name="fill">True</property> |
122 | <property name="pack_type">end</property> |
123 | <property name="position">0</property> |
124 | </packing> |
125 | </child> |
126 | + <child> |
127 | + <placeholder/> |
128 | + </child> |
129 | </object> |
130 | </child> |
131 | </object> |
132 | |
133 | === modified file 'data/templates/ubuntu-application/project_root/data/ui/Preferencescamel_case_nameDialog.ui' |
134 | --- data/templates/ubuntu-application/project_root/data/ui/Preferencescamel_case_nameDialog.ui 2010-12-20 15:44:44 +0000 |
135 | +++ data/templates/ubuntu-application/project_root/data/ui/Preferencescamel_case_nameDialog.ui 2011-11-08 16:10:57 +0000 |
136 | @@ -1,88 +1,107 @@ |
137 | <?xml version="1.0" encoding="UTF-8"?> |
138 | <interface> |
139 | - <requires lib="gtk+" version="2.16"/> |
140 | + <!-- interface-requires gtk+ 3.0 --> |
141 | <!-- interface-requires preferences_python_name_dialog 1.0 --> |
142 | - <!-- interface-naming-policy project-wide --> |
143 | <object class="Preferencescamel_case_nameDialog" id="preferences_python_name_dialog"> |
144 | - <property name="border_width">5</property> |
145 | + <property name="can_focus">False</property> |
146 | <property name="title" translatable="yes">sentence_name Preferences</property> |
147 | <property name="icon">../media/project_name.svg</property> |
148 | <property name="type_hint">normal</property> |
149 | <child internal-child="vbox"> |
150 | - <object class="GtkVBox" id="dialog-vbox1"> |
151 | + <object class="GtkBox" id="dialog-vbox1"> |
152 | <property name="visible">True</property> |
153 | - <property name="spacing">2</property> |
154 | + <property name="can_focus">False</property> |
155 | + <property name="orientation">vertical</property> |
156 | + <property name="spacing">12</property> |
157 | + <child internal-child="action_area"> |
158 | + <object class="GtkButtonBox" id="dialog-action_area1"> |
159 | + <property name="visible">True</property> |
160 | + <property name="can_focus">False</property> |
161 | + <property name="layout_style">end</property> |
162 | + <child> |
163 | + <object class="GtkButton" id="btn_help"> |
164 | + <property name="label">gtk-help</property> |
165 | + <property name="visible">True</property> |
166 | + <property name="can_focus">True</property> |
167 | + <property name="receives_default">True</property> |
168 | + <property name="use_action_appearance">False</property> |
169 | + <property name="use_stock">True</property> |
170 | + </object> |
171 | + <packing> |
172 | + <property name="expand">False</property> |
173 | + <property name="fill">False</property> |
174 | + <property name="position">0</property> |
175 | + <property name="secondary">True</property> |
176 | + </packing> |
177 | + </child> |
178 | + <child> |
179 | + <object class="GtkButton" id="btn_close"> |
180 | + <property name="label">gtk-close</property> |
181 | + <property name="visible">True</property> |
182 | + <property name="can_focus">True</property> |
183 | + <property name="receives_default">True</property> |
184 | + <property name="use_action_appearance">False</property> |
185 | + <property name="use_stock">True</property> |
186 | + </object> |
187 | + <packing> |
188 | + <property name="expand">False</property> |
189 | + <property name="fill">False</property> |
190 | + <property name="position">1</property> |
191 | + </packing> |
192 | + </child> |
193 | + </object> |
194 | + <packing> |
195 | + <property name="expand">False</property> |
196 | + <property name="fill">True</property> |
197 | + <property name="pack_type">end</property> |
198 | + <property name="position">0</property> |
199 | + </packing> |
200 | + </child> |
201 | <child> |
202 | - <object class="GtkTable" id="table1"> |
203 | + <object class="GtkGrid" id="table1"> |
204 | <property name="visible">True</property> |
205 | + <property name="can_focus">False</property> |
206 | + <property name="row_spacing">6</property> |
207 | + <property name="column_spacing">6</property> |
208 | + <property name="n_rows">1</property> |
209 | <property name="n_columns">2</property> |
210 | - <property name="column_spacing">6</property> |
211 | - <property name="row_spacing">6</property> |
212 | <child> |
213 | <object class="GtkEntry" id="example_entry"> |
214 | <property name="visible">True</property> |
215 | <property name="can_focus">True</property> |
216 | + <property name="hexpand">True</property> |
217 | <property name="invisible_char">•</property> |
218 | </object> |
219 | <packing> |
220 | <property name="left_attach">1</property> |
221 | - <property name="right_attach">2</property> |
222 | + <property name="top_attach">0</property> |
223 | + <property name="width">1</property> |
224 | + <property name="height">1</property> |
225 | </packing> |
226 | </child> |
227 | <child> |
228 | <object class="GtkLabel" id="example_entry_label"> |
229 | <property name="visible">True</property> |
230 | + <property name="can_focus">False</property> |
231 | <property name="xalign">0</property> |
232 | <property name="label" translatable="yes">_Example entry:</property> |
233 | <property name="use_underline">True</property> |
234 | <property name="mnemonic_widget">example_entry</property> |
235 | </object> |
236 | + <packing> |
237 | + <property name="left_attach">0</property> |
238 | + <property name="top_attach">0</property> |
239 | + <property name="width">1</property> |
240 | + <property name="height">1</property> |
241 | + </packing> |
242 | </child> |
243 | </object> |
244 | <packing> |
245 | + <property name="expand">False</property> |
246 | + <property name="fill">True</property> |
247 | <property name="position">1</property> |
248 | </packing> |
249 | </child> |
250 | - <child internal-child="action_area"> |
251 | - <object class="GtkHButtonBox" id="dialog-action_area1"> |
252 | - <property name="visible">True</property> |
253 | - <property name="layout_style">end</property> |
254 | - <child> |
255 | - <object class="GtkButton" id="btn_help"> |
256 | - <property name="label">gtk-help</property> |
257 | - <property name="visible">True</property> |
258 | - <property name="can_focus">True</property> |
259 | - <property name="receives_default">True</property> |
260 | - <property name="use_stock">True</property> |
261 | - </object> |
262 | - <packing> |
263 | - <property name="expand">False</property> |
264 | - <property name="fill">False</property> |
265 | - <property name="position">0</property> |
266 | - <property name="secondary">True</property> |
267 | - </packing> |
268 | - </child> |
269 | - <child> |
270 | - <object class="GtkButton" id="btn_close"> |
271 | - <property name="label">gtk-close</property> |
272 | - <property name="visible">True</property> |
273 | - <property name="can_focus">True</property> |
274 | - <property name="receives_default">True</property> |
275 | - <property name="use_stock">True</property> |
276 | - </object> |
277 | - <packing> |
278 | - <property name="expand">False</property> |
279 | - <property name="fill">False</property> |
280 | - <property name="position">1</property> |
281 | - </packing> |
282 | - </child> |
283 | - </object> |
284 | - <packing> |
285 | - <property name="expand">False</property> |
286 | - <property name="pack_type">end</property> |
287 | - <property name="position">0</property> |
288 | - </packing> |
289 | - </child> |
290 | </object> |
291 | </child> |
292 | <action-widgets> |
293 | |
294 | === modified file 'data/templates/ubuntu-application/project_root/data/ui/camel_case_nameWindow.ui' |
295 | --- data/templates/ubuntu-application/project_root/data/ui/camel_case_nameWindow.ui 2011-04-01 21:02:04 +0000 |
296 | +++ data/templates/ubuntu-application/project_root/data/ui/camel_case_nameWindow.ui 2011-11-08 16:10:57 +0000 |
297 | @@ -1,8 +1,7 @@ |
298 | <?xml version="1.0" encoding="UTF-8"?> |
299 | <interface> |
300 | - <requires lib="gtk+" version="2.16"/> |
301 | + <!-- interface-requires gtk+ 3.0 --> |
302 | <!-- interface-requires python_name_window 1.0 --> |
303 | - <!-- interface-naming-policy project-wide --> |
304 | <!-- interface-local-resource-path ../media --> |
305 | <object class="GtkImage" id="image2"> |
306 | <property name="visible">True</property> |
307 | |
308 | === modified file 'data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py' |
309 | --- data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py 2011-04-04 14:28:36 +0000 |
310 | +++ data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py 2011-11-08 16:10:57 +0000 |
311 | @@ -5,27 +5,11 @@ |
312 | |
313 | # This is your preferences dialog. |
314 | # |
315 | -# Define your preferences dictionary in the __init__.main() function. |
316 | -# The widget names in the PreferencesTestProjectDialog.ui |
317 | -# file need to correspond to the keys in the preferences dictionary. |
318 | -# |
319 | -# Each preference also need to be defined in the 'widget_methods' map below |
320 | -# to show up in the dialog itself. Provide three bits of information: |
321 | -# 1) The first entry is the method on the widget that grabs a value from the |
322 | -# widget. |
323 | -# 2) The second entry is the method on the widget that sets the widgets value |
324 | -# from a stored preference. |
325 | -# 3) The third entry is a signal the widget will send when the contents have |
326 | -# been changed by the user. The preferences dictionary is always up to |
327 | -# date and will signal the rest of the application about these changes. |
328 | -# The values will be saved to desktopcouch when the application closes. |
329 | -# |
330 | -# TODO: replace widget_methods with your own values |
331 | - |
332 | - |
333 | -widget_methods = { |
334 | - 'example_entry': ['get_text', 'set_text', 'changed'], |
335 | -} |
336 | +# Define your preferences in |
337 | +# data/glib-2.0/schemas/net.launchpad.project_name.gschema.xml |
338 | +# See http://developer.gnome.org/gio/stable/GSettings.html for more info. |
339 | + |
340 | +from gi.repository import Gio # pylint: disable=E0611 |
341 | |
342 | import gettext |
343 | from gettext import gettext as _ |
344 | @@ -43,9 +27,9 @@ |
345 | """Set up the preferences dialog""" |
346 | super(Preferencescamel_case_nameDialog, self).finish_initializing(builder) |
347 | |
348 | - # populate the dialog from the preferences dictionary |
349 | - # using the methods from widget_methods |
350 | - self.widget_methods = widget_methods |
351 | - self.set_widgets_from_preferences() # pylint: disable=E1101 |
352 | + # Bind each preference widget to gsettings |
353 | + settings = Gio.Settings("net.launchpad.project_name") |
354 | + widget = self.builder.get_object('example_entry') |
355 | + settings.bind("example", widget, "text", Gio.SettingsBindFlags.DEFAULT) |
356 | |
357 | # Code for other initialization actions should be added here. |
358 | |
359 | === modified file 'data/templates/ubuntu-application/project_root/python/__init__.py' |
360 | --- data/templates/ubuntu-application/project_root/python/__init__.py 2011-03-31 15:19:55 +0000 |
361 | +++ data/templates/ubuntu-application/project_root/python/__init__.py 2011-11-08 16:10:57 +0000 |
362 | @@ -9,11 +9,11 @@ |
363 | from gettext import gettext as _ |
364 | gettext.textdomain('project_name') |
365 | |
366 | -import gtk |
367 | +from gi.repository import Gtk # pylint: disable=E0611 |
368 | |
369 | from python_name import camel_case_nameWindow |
370 | |
371 | -from python_name_lib import set_up_logging, preferences, get_version |
372 | +from python_name_lib import set_up_logging, get_version |
373 | |
374 | def parse_options(): |
375 | """Support for command line options""" |
376 | @@ -29,20 +29,7 @@ |
377 | 'constructor for your class instances' |
378 | parse_options() |
379 | |
380 | - # preferences |
381 | - # set some values for our first session |
382 | - # TODO: replace defaults with your own values |
383 | - default_preferences = { |
384 | - 'example_entry': 'I remember stuff', |
385 | - } |
386 | - preferences.update(default_preferences) |
387 | - # user's stored preferences are used for 2nd and subsequent sessions |
388 | - preferences.db_connect() |
389 | - preferences.load() |
390 | - |
391 | # Run the application. |
392 | window = camel_case_nameWindow.camel_case_nameWindow() |
393 | window.show() |
394 | - gtk.main() |
395 | - |
396 | - preferences.save() |
397 | + Gtk.main() |
398 | |
399 | === modified file 'data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py' |
400 | --- data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py 2011-04-04 14:28:36 +0000 |
401 | +++ data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py 2011-11-08 16:10:57 +0000 |
402 | @@ -7,7 +7,7 @@ |
403 | from gettext import gettext as _ |
404 | gettext.textdomain('project_name') |
405 | |
406 | -import gtk |
407 | +from gi.repository import Gtk # pylint: disable=E0611 |
408 | import logging |
409 | logger = logging.getLogger('python_name') |
410 | |
411 | |
412 | === modified file 'data/templates/ubuntu-application/project_root/python_lib/AboutDialog.py' |
413 | --- data/templates/ubuntu-application/project_root/python_lib/AboutDialog.py 2011-03-31 17:05:41 +0000 |
414 | +++ data/templates/ubuntu-application/project_root/python_lib/AboutDialog.py 2011-11-08 16:10:57 +0000 |
415 | @@ -3,11 +3,11 @@ |
416 | # This file is in the public domain |
417 | ### END LICENSE |
418 | |
419 | -import gtk |
420 | +from gi.repository import Gtk # pylint: disable=E0611 |
421 | |
422 | from . helpers import get_builder |
423 | |
424 | -class AboutDialog(gtk.AboutDialog): |
425 | +class AboutDialog(Gtk.AboutDialog): |
426 | __gtype_name__ = "AboutDialog" |
427 | |
428 | def __new__(cls): |
429 | |
430 | === modified file 'data/templates/ubuntu-application/project_root/python_lib/Builder.py' |
431 | --- data/templates/ubuntu-application/project_root/python_lib/Builder.py 2011-09-06 07:47:36 +0000 |
432 | +++ data/templates/ubuntu-application/project_root/python_lib/Builder.py 2011-11-08 16:10:57 +0000 |
433 | @@ -5,9 +5,8 @@ |
434 | |
435 | '''Enhances builder connections, provides object to access glade objects''' |
436 | |
437 | -import gobject # pylint: disable=E0611 |
438 | +from gi.repository import GObject, Gtk # pylint: disable=E0611 |
439 | |
440 | -import gtk |
441 | import inspect |
442 | import functools |
443 | import logging |
444 | @@ -23,8 +22,8 @@ |
445 | |
446 | |
447 | # pylint: disable=R0904 |
448 | -# the many public methods is a feature of gtk.Builder |
449 | -class Builder(gtk.Builder): |
450 | +# the many public methods is a feature of Gtk.Builder |
451 | +class Builder(Gtk.Builder): |
452 | ''' extra features |
453 | connects glade defined handler to default_handler if necessary |
454 | auto connects widget to handler with matching name or alias |
455 | @@ -34,7 +33,7 @@ |
456 | ''' |
457 | |
458 | def __init__(self): |
459 | - gtk.Builder.__init__(self) |
460 | + Gtk.Builder.__init__(self) |
461 | self.widgets = {} |
462 | self.glade_handler_dict = {} |
463 | self.connections = [] |
464 | @@ -50,7 +49,7 @@ |
465 | An apprentice guru might wonder which signal does what he wants, |
466 | now he can define any likely candidates in glade and notice which |
467 | ones get triggered when he plays with the project. |
468 | - this method does not appear in gtk.Builder''' |
469 | + this method does not appear in Gtk.Builder''' |
470 | logger.debug('''tried to call non-existent function:%s() |
471 | expected in %s |
472 | args:%s |
473 | @@ -60,12 +59,12 @@ |
474 | def get_name(self, widget): |
475 | ''' allows a handler to get the name (id) of a widget |
476 | |
477 | - this method does not appear in gtk.Builder''' |
478 | + this method does not appear in Gtk.Builder''' |
479 | return self._reverse_widget_dict.get(widget) |
480 | |
481 | def add_from_file(self, filename): |
482 | '''parses xml file and stores wanted details''' |
483 | - gtk.Builder.add_from_file(self, filename) |
484 | + Gtk.Builder.add_from_file(self, filename) |
485 | |
486 | # extract data for the extra interfaces |
487 | tree = ElementTree() |
488 | @@ -121,7 +120,7 @@ |
489 | item[0], filename) |
490 | |
491 | # connect glade define handlers |
492 | - gtk.Builder.connect_signals(self, connection_dict) |
493 | + Gtk.Builder.connect_signals(self, connection_dict) |
494 | |
495 | # let's tell the user how we applied the glade design |
496 | for connection in self.connections: |
497 | @@ -133,7 +132,7 @@ |
498 | '''Creates the ui object with widgets as attributes |
499 | |
500 | connects signals by 2 methods |
501 | - this method does not appear in gtk.Builder''' |
502 | + this method does not appear in Gtk.Builder''' |
503 | |
504 | result = UiFactory(self.widgets) |
505 | |
506 | @@ -196,9 +195,25 @@ |
507 | return pyname |
508 | |
509 | |
510 | +# Until bug https://bugzilla.gnome.org/show_bug.cgi?id=652127 is fixed, we |
511 | +# need to reimplement inspect.getmembers. GObject introspection doesn't |
512 | +# play nice with it. |
513 | +def getmembers(obj, check): |
514 | + members = [] |
515 | + for k in dir(obj): |
516 | + try: |
517 | + attr = getattr(obj, k) |
518 | + except: |
519 | + continue |
520 | + if check(attr): |
521 | + members.append((k, attr)) |
522 | + members.sort() |
523 | + return members |
524 | + |
525 | + |
526 | def dict_from_callback_obj(callback_obj): |
527 | '''a dictionary interface to callback_obj''' |
528 | - methods = inspect.getmembers(callback_obj, inspect.ismethod) |
529 | + methods = getmembers(callback_obj, inspect.ismethod) |
530 | |
531 | aliased_methods = [x[1] for x in methods if hasattr(x[1], 'aliases')] |
532 | |
533 | @@ -238,11 +253,11 @@ |
534 | try: |
535 | widget_type = type(widget) |
536 | while widget_type: |
537 | - signal_ids.extend(gobject.signal_list_ids(widget_type)) |
538 | - widget_type = gobject.type_parent(widget_type) |
539 | + signal_ids.extend(GObject.signal_list_ids(widget_type)) |
540 | + widget_type = GObject.type_parent(widget_type) |
541 | except RuntimeError: # pylint wants a specific error |
542 | pass |
543 | - signal_names = [gobject.signal_name(sid) for sid in signal_ids] |
544 | + signal_names = [GObject.signal_name(sid) for sid in signal_ids] |
545 | |
546 | # Now, automatically find any the user didn't specify in glade |
547 | for sig in signal_names: |
548 | |
549 | === modified file 'data/templates/ubuntu-application/project_root/python_lib/PreferencesDialog.py' |
550 | --- data/templates/ubuntu-application/project_root/python_lib/PreferencesDialog.py 2011-03-31 17:05:41 +0000 |
551 | +++ data/templates/ubuntu-application/project_root/python_lib/PreferencesDialog.py 2011-11-08 16:10:57 +0000 |
552 | @@ -3,23 +3,16 @@ |
553 | # This file is in the public domain |
554 | ### END LICENSE |
555 | |
556 | -"""this dialog adjusts values in the preferences dictionary |
557 | - |
558 | -requirements: |
559 | -in module preferences: defaults[key] has a value |
560 | -self.builder.get_object(key) is a suitable widget to adjust value |
561 | -widget_methods[key] provides method names for the widget |
562 | -each widget calls set_preference(...) when it has adjusted value |
563 | +"""this dialog adjusts values in gsettings |
564 | """ |
565 | |
566 | -import gtk |
567 | +from gi.repository import Gtk # pylint: disable=E0611 |
568 | import logging |
569 | logger = logging.getLogger('python_name_lib') |
570 | |
571 | from . helpers import get_builder, show_uri, get_help_uri |
572 | -from . preferences import preferences |
573 | |
574 | -class PreferencesDialog(gtk.Dialog): |
575 | +class PreferencesDialog(Gtk.Dialog): |
576 | __gtype_name__ = "PreferencesDialog" |
577 | |
578 | def __new__(cls): |
579 | @@ -49,80 +42,6 @@ |
580 | self.ui = builder.get_ui(self, True) |
581 | |
582 | # code for other initialization actions should be added here |
583 | - self.widget_methods = [] |
584 | - |
585 | - def set_widgets_from_preferences(self): |
586 | - ''' these widgets show values in the preferences dictionary ''' |
587 | - for key in preferences.keys(): |
588 | - self.set_widget_from_preference(key) |
589 | - |
590 | - def set_widget_from_preference(self, key): |
591 | - '''set widget value from item in preferences''' |
592 | - |
593 | - value = preferences.get(key) |
594 | - widget = self.builder.get_object(key) |
595 | - if widget is None: |
596 | - # this preference is not adjustable by this dialog |
597 | - # for example: window and dialog geometries |
598 | - logger.debug('no widget for preference: %s' % key) |
599 | - return |
600 | - |
601 | - logger.debug('set_widget_from_preference: %s' % key) |
602 | - try: |
603 | - write_method_name = self.widget_methods[key][1] |
604 | - except KeyError: |
605 | - logger.warn('%s not in widget_methods' % key) |
606 | - return |
607 | - |
608 | - try: |
609 | - method = getattr(widget, write_method_name) |
610 | - except AttributeError: |
611 | - logger.warn("""'%s' does not have a '%s' method. |
612 | -Please edit 'widget_methods' in %s""" |
613 | - % (key, write_method_name, self.__gtype_name__)) |
614 | - return |
615 | - |
616 | - try: |
617 | - widget.connect(self.widget_methods[key][2], self.set_preference) |
618 | - except TypeError: |
619 | - logger.warn("""'%s' unknown signal name '%s' |
620 | -Please edit 'widget_methods' in %s""" |
621 | - % (key, self.widget_methods[key][2], self.__gtype_name__)) |
622 | - |
623 | - method(value) |
624 | - |
625 | - def get_key_for_widget(self, widget): |
626 | - key = None |
627 | - for key_try in preferences.keys(): |
628 | - obj = self.builder.get_object(key_try) |
629 | - if obj == widget: |
630 | - key = key_try |
631 | - return key |
632 | - |
633 | - def set_preference(self, widget, data=None): |
634 | - '''set a preference from a widget''' |
635 | - key = self.get_key_for_widget(widget) |
636 | - if key is None: |
637 | - logger.warn('''This widget will not write to a preference. |
638 | -The preference must already exist so add this widget's name |
639 | -to default_preferences in your main function''') |
640 | - return |
641 | - |
642 | - # set_widget_from_preference is called first |
643 | - # so no KeyError test is needed here |
644 | - read_method_name = self.widget_methods[key][0] |
645 | - |
646 | - try: |
647 | - read_method = getattr(widget, read_method_name) |
648 | - except AttributeError: |
649 | - logger.warn("""'%s' does not have a '%s' method. |
650 | -Please edit 'widget_methods' in %s""" |
651 | - % (key, read_method_name, self.__gtype_name__)) |
652 | - return |
653 | - |
654 | - value=read_method() |
655 | - logger.debug('set_preference: %s = %s' % (key, str(value))) |
656 | - preferences[key] = value |
657 | |
658 | def on_btn_close_clicked(self, widget, data=None): |
659 | self.destroy() |
660 | |
661 | === modified file 'data/templates/ubuntu-application/project_root/python_lib/Window.py' |
662 | --- data/templates/ubuntu-application/project_root/python_lib/Window.py 2011-04-04 14:28:36 +0000 |
663 | +++ data/templates/ubuntu-application/project_root/python_lib/Window.py 2011-11-08 16:10:57 +0000 |
664 | @@ -3,16 +3,15 @@ |
665 | # This file is in the public domain |
666 | ### END LICENSE |
667 | |
668 | -import gtk |
669 | +from gi.repository import Gio, Gtk # pylint: disable=E0611 |
670 | import logging |
671 | logger = logging.getLogger('python_name_lib') |
672 | |
673 | from . helpers import get_builder, show_uri, get_help_uri |
674 | -from . preferences import preferences |
675 | |
676 | # This class is meant to be subclassed by camel_case_nameWindow. It provides |
677 | # common functions and some boilerplate. |
678 | -class Window(gtk.Window): |
679 | +class Window(Gtk.Window): |
680 | __gtype_name__ = "Window" |
681 | |
682 | # To construct a new instance of this method, the following notable |
683 | @@ -50,14 +49,15 @@ |
684 | self.preferences_dialog = None # instance |
685 | self.AboutDialog = None # class |
686 | |
687 | - preferences.connect('changed', self.on_preferences_changed) |
688 | + self.settings = Gio.Settings("net.launchpad.project_name") |
689 | + self.settings.connect('changed', self.on_preferences_changed) |
690 | |
691 | # Optional Launchpad integration |
692 | # This shouldn't crash if not found as it is simply used for bug reporting. |
693 | # See https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding |
694 | # for more information about Launchpad integration. |
695 | try: |
696 | - import LaunchpadIntegration |
697 | + from gi.repository import LaunchpadIntegration # pylint: disable=E0611 |
698 | LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True) |
699 | LaunchpadIntegration.set_sourcepackagename('project_name') |
700 | except ImportError: |
701 | @@ -111,12 +111,10 @@ |
702 | def on_destroy(self, widget, data=None): |
703 | """Called when the camel_case_nameWindow is closed.""" |
704 | # Clean up code for saving application state should be added here. |
705 | - gtk.main_quit() |
706 | + Gtk.main_quit() |
707 | |
708 | - def on_preferences_changed(self, widget, data=None): |
709 | - logger.debug('main window received preferences changed') |
710 | - for key in data: |
711 | - logger.debug('preference changed: %s = %s' % (key, preferences[key])) |
712 | + def on_preferences_changed(self, settings, key, data=None): |
713 | + logger.debug('preference changed: %s = %s' % (key, str(settings.get_value(key)))) |
714 | |
715 | def on_preferences_dialog_destroyed(self, widget, data=None): |
716 | '''only affects gui |
717 | |
718 | === modified file 'data/templates/ubuntu-application/project_root/python_lib/__init__.py' |
719 | --- data/templates/ubuntu-application/project_root/python_lib/__init__.py 2011-03-31 17:05:41 +0000 |
720 | +++ data/templates/ubuntu-application/project_root/python_lib/__init__.py 2011-11-08 16:10:57 +0000 |
721 | @@ -7,7 +7,6 @@ |
722 | |
723 | while keeping its api constant''' |
724 | from . helpers import set_up_logging |
725 | -from . preferences import preferences |
726 | from . Window import Window |
727 | from . python_nameconfig import get_version |
728 | |
729 | |
730 | === modified file 'data/templates/ubuntu-application/project_root/python_lib/helpers.py' |
731 | --- data/templates/ubuntu-application/project_root/python_lib/helpers.py 2011-03-31 17:05:41 +0000 |
732 | +++ data/templates/ubuntu-application/project_root/python_lib/helpers.py 2011-11-08 16:10:57 +0000 |
733 | @@ -7,8 +7,6 @@ |
734 | import logging |
735 | import os |
736 | |
737 | -import gtk |
738 | - |
739 | from . python_nameconfig import get_data_file |
740 | from . Builder import Builder |
741 | |
742 | @@ -17,7 +15,7 @@ |
743 | gettext.textdomain('project_name') |
744 | |
745 | def get_builder(builder_file_name): |
746 | - """Return a fully-instantiated gtk.Builder instance from specified ui |
747 | + """Return a fully-instantiated Gtk.Builder instance from specified ui |
748 | file |
749 | |
750 | :param builder_file_name: The name of the builder file, without extension. |
751 | @@ -87,8 +85,9 @@ |
752 | return help_uri |
753 | |
754 | def show_uri(parent, link): |
755 | + from gi.repository import Gtk # pylint: disable=E0611 |
756 | screen = parent.get_screen() |
757 | - gtk.show_uri(screen, link, gtk.get_current_event_time()) |
758 | + Gtk.show_uri(screen, link, Gtk.get_current_event_time()) |
759 | |
760 | def alias(alternative_function_name): |
761 | '''see http://www.drdobbs.com/web-development/184406073#l9''' |
762 | |
763 | === removed file 'data/templates/ubuntu-application/project_root/python_lib/preferences.py' |
764 | --- data/templates/ubuntu-application/project_root/python_lib/preferences.py 2011-03-31 15:19:55 +0000 |
765 | +++ data/templates/ubuntu-application/project_root/python_lib/preferences.py 1970-01-01 00:00:00 +0000 |
766 | @@ -1,100 +0,0 @@ |
767 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
768 | -### BEGIN LICENSE |
769 | -# This file is in the public domain |
770 | -### END LICENSE |
771 | - |
772 | -"""Provides a shared preferences dictionary""" |
773 | - |
774 | -from desktopcouch.records.server import CouchDatabase |
775 | -from desktopcouch.records.record import Record |
776 | -import gtk |
777 | -import gobject |
778 | - |
779 | -class User_dict(dict): |
780 | - ''' a dictionary with extra methods: |
781 | - |
782 | - persistence: load, save and db_connect |
783 | - gobject signals: connect and emit. |
784 | - |
785 | - Don't use this directly. Please use the preferences instance.''' |
786 | - |
787 | - def __init__(self, *args, **kwds): |
788 | - dict.__init__(self, *args, **kwds) |
789 | - # Set up couchdb. |
790 | - self._db_name = "project_name" |
791 | - self._key = None |
792 | - self._database = None |
793 | - |
794 | - self._record_type = ( |
795 | - "http://wiki.ubuntu.com/Quickly/RecordTypes/camel_case_name/" |
796 | - "Preferences") |
797 | - |
798 | - class Publisher(gtk.Invisible): # pylint: disable=R0904 |
799 | - '''set up signals in a separate class |
800 | - |
801 | - gtk.Invisible has 230 public methods''' |
802 | - __gsignals__ = {'changed' : (gobject.SIGNAL_RUN_LAST, |
803 | - gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), |
804 | - 'loaded' : (gobject.SIGNAL_RUN_LAST, |
805 | - gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))} |
806 | - |
807 | - publisher = Publisher() |
808 | - self.emit = publisher.emit |
809 | - self.connect = publisher.connect |
810 | - |
811 | - def db_connect(self): |
812 | - '''connect to couchdb |
813 | - |
814 | - create if necessary''' |
815 | - # logging.basicConfig will be called now |
816 | - self._database = CouchDatabase(self._db_name, create=True) |
817 | - |
818 | - def save(self): |
819 | - 'save to couchdb' |
820 | - self._database.update_fields(self._key, self) |
821 | - |
822 | - |
823 | - def load(self): |
824 | - 'load from couchdb' |
825 | - self.update({"record_type": self._record_type}) |
826 | - |
827 | - results = self._database.get_records( |
828 | - record_type=self._record_type, create_view=True) |
829 | - |
830 | - if len(results.rows) == 0: |
831 | - # No preferences have ever been saved |
832 | - # save them before returning. |
833 | - self._key = self._database.put_record(Record(self)) |
834 | - else: |
835 | - self.update(results.rows[0].value) |
836 | - del self['_rev'] |
837 | - self._key = results.rows[0].value["_id"] |
838 | - self.emit('loaded', None) |
839 | - |
840 | - def update(self, *args, **kwds): |
841 | - ''' interface for dictionary |
842 | - |
843 | - send changed signal when appropriate ''' |
844 | - |
845 | - # parse args |
846 | - new_data = {} |
847 | - new_data.update(*args, **kwds) |
848 | - |
849 | - changed_keys = [] |
850 | - for key in new_data.keys(): |
851 | - if new_data.get(key) != dict.get(self, key): |
852 | - changed_keys.append(key) |
853 | - dict.update(self, new_data) |
854 | - if changed_keys: |
855 | - self.emit('changed', tuple(changed_keys)) |
856 | - |
857 | - def __setitem__(self, key, value): |
858 | - ''' interface for dictionary |
859 | - |
860 | - send changed signal when appropriate ''' |
861 | - if value != dict.get(self, key): |
862 | - dict.__setitem__(self, key, value) |
863 | - self.emit('changed', (key,)) |
864 | - |
865 | -preferences = User_dict() |
866 | - |
867 | |
868 | === modified file 'data/templates/ubuntu-application/project_root/tests/test_example.py' |
869 | --- data/templates/ubuntu-application/project_root/tests/test_example.py 2011-03-02 22:59:32 +0000 |
870 | +++ data/templates/ubuntu-application/project_root/tests/test_example.py 2011-11-08 16:10:57 +0000 |
871 | @@ -14,7 +14,7 @@ |
872 | class TestExample(unittest.TestCase): |
873 | def setUp(self): |
874 | self.Aboutcamel_case_nameDialog_members = [ |
875 | - 'Aboutcamel_case_nameDialog', 'get_builder', 'gettext', 'gtk'] |
876 | + 'Aboutcamel_case_nameDialog', 'get_builder', 'gettext', 'Gtk'] |
877 | |
878 | def test_Aboutcamel_case_nameDialog_members(self): |
879 | all_members = dir(Aboutcamel_case_nameDialog) |
880 | |
881 | === modified file 'data/templates/ubuntu-application/run.py' |
882 | --- data/templates/ubuntu-application/run.py 2011-07-22 10:47:34 +0000 |
883 | +++ data/templates/ubuntu-application/run.py 2011-11-08 16:10:57 +0000 |
884 | @@ -50,6 +50,18 @@ |
885 | print _("Can't access to X server, so can't run gtk application") |
886 | sys.exit(1) |
887 | |
888 | +# Compile schema if present |
889 | +schemapath = os.path.abspath("data/glib-2.0/schemas") |
890 | +if os.path.exists(schemapath): |
891 | + subprocess.call(["glib-compile-schemas", schemapath]) |
892 | + |
893 | + env = os.environ.copy() |
894 | + datadir = os.path.abspath("data") |
895 | + if 'XDG_DATA_DIRS' in env: |
896 | + env['XDG_DATA_DIRS'] = "%s:%s" % (datadir, env['XDG_DATA_DIRS']) |
897 | + else: |
898 | + env['XDG_DATA_DIRS'] = datadir |
899 | + |
900 | project_bin = 'bin/' + configurationhandler.project_config['project'] |
901 | command_line = [project_bin] |
902 | command_line.extend([arg for arg in sys.argv[1:] if arg != "--"]) |
903 | @@ -58,7 +70,7 @@ |
904 | st = os.stat(project_bin) |
905 | mode = st[stat.ST_MODE] |
906 | if mode & stat.S_IEXEC: |
907 | - subprocess.call(command_line) |
908 | + subprocess.call(command_line, env=env) |
909 | else: |
910 | print _("Can't execute %s") % project_bin |
911 | sys.exit(1) |
912 | |
913 | === modified file 'data/templates/ubuntu-application/store/data/ui/dialog_camel_case_nameDialog.ui' |
914 | --- data/templates/ubuntu-application/store/data/ui/dialog_camel_case_nameDialog.ui 2010-12-20 15:44:44 +0000 |
915 | +++ data/templates/ubuntu-application/store/data/ui/dialog_camel_case_nameDialog.ui 2011-11-08 16:10:57 +0000 |
916 | @@ -1,24 +1,22 @@ |
917 | -<?xml version="1.0"?> |
918 | +<?xml version="1.0" encoding="UTF-8"?> |
919 | <interface> |
920 | - <requires lib="gtk+" version="2.16"/> |
921 | + <!-- interface-requires gtk+ 3.0 --> |
922 | <!-- interface-requires dialog_python_name_dialog 1.0 --> |
923 | - <!-- interface-naming-policy project-wide --> |
924 | <object class="dialog_camel_case_nameDialog" id="dialog_python_name_dialog"> |
925 | + <property name="can_focus">False</property> |
926 | <property name="border_width">5</property> |
927 | <property name="icon">../media/project_name.svg</property> |
928 | <property name="type_hint">normal</property> |
929 | - <property name="has_separator">False</property> |
930 | <child internal-child="vbox"> |
931 | - <object class="GtkVBox" id="dialog-vbox1"> |
932 | + <object class="GtkBox" id="dialog-vbox1"> |
933 | <property name="visible">True</property> |
934 | + <property name="can_focus">False</property> |
935 | <property name="orientation">vertical</property> |
936 | <property name="spacing">2</property> |
937 | - <child> |
938 | - <placeholder/> |
939 | - </child> |
940 | <child internal-child="action_area"> |
941 | - <object class="GtkHButtonBox" id="dialog-action_area1"> |
942 | + <object class="GtkButtonBox" id="dialog-action_area1"> |
943 | <property name="visible">True</property> |
944 | + <property name="can_focus">False</property> |
945 | <property name="layout_style">end</property> |
946 | <child> |
947 | <object class="GtkButton" id="btn_cancel"> |
948 | @@ -26,6 +24,7 @@ |
949 | <property name="visible">True</property> |
950 | <property name="can_focus">True</property> |
951 | <property name="receives_default">True</property> |
952 | + <property name="use_action_appearance">False</property> |
953 | <property name="use_stock">True</property> |
954 | </object> |
955 | <packing> |
956 | @@ -40,6 +39,7 @@ |
957 | <property name="visible">True</property> |
958 | <property name="can_focus">True</property> |
959 | <property name="receives_default">True</property> |
960 | + <property name="use_action_appearance">False</property> |
961 | <property name="use_stock">True</property> |
962 | </object> |
963 | <packing> |
964 | @@ -51,10 +51,14 @@ |
965 | </object> |
966 | <packing> |
967 | <property name="expand">False</property> |
968 | + <property name="fill">True</property> |
969 | <property name="pack_type">end</property> |
970 | <property name="position">0</property> |
971 | </packing> |
972 | </child> |
973 | + <child> |
974 | + <placeholder/> |
975 | + </child> |
976 | </object> |
977 | </child> |
978 | <action-widgets> |
979 | |
980 | === modified file 'data/templates/ubuntu-application/store/data/ui/dialog_python_name_dialog.xml' |
981 | --- data/templates/ubuntu-application/store/data/ui/dialog_python_name_dialog.xml 2010-03-03 08:07:21 +0000 |
982 | +++ data/templates/ubuntu-application/store/data/ui/dialog_python_name_dialog.xml 2011-11-08 16:10:57 +0000 |
983 | @@ -1,4 +1,4 @@ |
984 | -<glade-catalog name="dialog_name_dialog" domain="glade-3" |
985 | +<glade-catalog name="dialog_python_name_dialog" domain="glade-3" |
986 | depends="gtk+" version="1.0"> |
987 | <glade-widget-classes> |
988 | <glade-widget-class title="dialog_sentence_name Dialog" name="dialog_camel_case_nameDialog" |
989 | |
990 | === modified file 'data/templates/ubuntu-application/store/dialog.py' |
991 | --- data/templates/ubuntu-application/store/dialog.py 2011-07-22 10:47:34 +0000 |
992 | +++ data/templates/ubuntu-application/store/dialog.py 2011-11-08 16:10:57 +0000 |
993 | @@ -31,7 +31,7 @@ |
994 | help_text= _("""Here, dialog-name is one or more words separated with dash |
995 | |
996 | For instance 'quickly add dialog dialog-name' will create: |
997 | -1. A subclass of gtk.Dialog called DialogNameDialog in the module |
998 | +1. A subclass of Gtk.Dialog called DialogNameDialog in the module |
999 | DialogNameDialog.py |
1000 | 2. A glade file called DialogNameDialog.ui in the ui directory |
1001 | 3. A catalog file called dialog_name_dialog.xml also in the ui directory |
1002 | |
1003 | === modified file 'data/templates/ubuntu-application/store/python/dialog_camel_case_nameDialog.py' |
1004 | --- data/templates/ubuntu-application/store/python/dialog_camel_case_nameDialog.py 2011-04-01 21:03:53 +0000 |
1005 | +++ data/templates/ubuntu-application/store/python/dialog_camel_case_nameDialog.py 2011-11-08 16:10:57 +0000 |
1006 | @@ -3,7 +3,7 @@ |
1007 | # This file is in the public domain |
1008 | ### END LICENSE |
1009 | |
1010 | -import gtk |
1011 | +from gi.repository import Gtk # pylint: disable=E0611 |
1012 | |
1013 | from python_name_lib.helpers import get_builder |
1014 | |
1015 | @@ -11,7 +11,7 @@ |
1016 | from gettext import gettext as _ |
1017 | gettext.textdomain('project_name') |
1018 | |
1019 | -class dialog_camel_case_nameDialog(gtk.Dialog): |
1020 | +class dialog_camel_case_nameDialog(Gtk.Dialog): |
1021 | __gtype_name__ = "dialog_camel_case_nameDialog" |
1022 | |
1023 | def __new__(cls): |
1024 | @@ -40,14 +40,14 @@ |
1025 | def on_btn_ok_clicked(self, widget, data=None): |
1026 | """The user has elected to save the changes. |
1027 | |
1028 | - Called before the dialog returns gtk.RESONSE_OK from run(). |
1029 | + Called before the dialog returns Gtk.ResponseType.OK from run(). |
1030 | """ |
1031 | pass |
1032 | |
1033 | def on_btn_cancel_clicked(self, widget, data=None): |
1034 | """The user has elected cancel changes. |
1035 | |
1036 | - Called before the dialog returns gtk.RESPONSE_CANCEL for run() |
1037 | + Called before the dialog returns Gtk.ResponseType.CANCEL for run() |
1038 | """ |
1039 | pass |
1040 | |
1041 | @@ -55,4 +55,4 @@ |
1042 | if __name__ == "__main__": |
1043 | dialog = dialog_camel_case_nameDialog() |
1044 | dialog.show() |
1045 | - gtk.main() |
1046 | + Gtk.main() |
1047 | |
1048 | === modified file 'data/templates/ubuntu-application/store/python/indicator.py' |
1049 | --- data/templates/ubuntu-application/store/python/indicator.py 2011-07-29 18:57:04 +0000 |
1050 | +++ data/templates/ubuntu-application/store/python/indicator.py 2011-11-08 16:10:57 +0000 |
1051 | @@ -6,7 +6,8 @@ |
1052 | |
1053 | """Code to add AppIndicator.""" |
1054 | |
1055 | -import gtk |
1056 | +from gi.repository import Gtk # pylint: disable=E0611 |
1057 | +from gi.repository import AppIndicator3 # pylint: disable=E0611 |
1058 | |
1059 | from python_name_lib.helpers import get_media_file |
1060 | |
1061 | @@ -14,12 +15,10 @@ |
1062 | from gettext import gettext as _ |
1063 | gettext.textdomain('project_name') |
1064 | |
1065 | -import appindicator |
1066 | - |
1067 | class Indicator: |
1068 | def __init__(self, window): |
1069 | - self.indicator = appindicator.Indicator('project_name','',appindicator.CATEGORY_APPLICATION_STATUS) |
1070 | - self.indicator.set_status(appindicator.STATUS_ACTIVE) |
1071 | + self.indicator = AppIndicator3.Indicator('project_name', '', AppIndicator3.IndicatorCategory.APPLICATION_STATUS) |
1072 | + self.indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE) |
1073 | |
1074 | icon_uri = get_media_file("project_name.svg") |
1075 | icon_path = icon_uri.replace("file:///", '') |
1076 | @@ -28,18 +27,18 @@ |
1077 | #Uncomment and choose an icon for attention state. |
1078 | #self.indicator.set_attention_icon("ICON-NAME") |
1079 | |
1080 | - self.menu = gtk.Menu() |
1081 | + self.menu = Gtk.Menu() |
1082 | |
1083 | # Add items to Menu and connect signals. |
1084 | |
1085 | #Adding preferences button |
1086 | #window represents the main Window object of your app |
1087 | - self.preferences = gtk.MenuItem("Preferences") |
1088 | + self.preferences = Gtk.MenuItem("Preferences") |
1089 | self.preferences.connect("activate",window.on_mnu_preferences_activate) |
1090 | self.preferences.show() |
1091 | self.menu.append(self.preferences) |
1092 | |
1093 | - self.quit = gtk.MenuItem("Quit") |
1094 | + self.quit = Gtk.MenuItem("Quit") |
1095 | self.quit.connect("activate",window.on_mnu_close_activate) |
1096 | self.quit.show() |
1097 | self.menu.append(self.quit) |
1098 | |
1099 | === modified file 'data/templates/ubuntu-application/test/apport/apport.sh' |
1100 | --- data/templates/ubuntu-application/test/apport/apport.sh 2011-11-08 00:50:34 +0000 |
1101 | +++ data/templates/ubuntu-application/test/apport/apport.sh 2011-11-08 16:10:57 +0000 |
1102 | @@ -12,6 +12,7 @@ |
1103 | cd test-project |
1104 | |
1105 | grep LaunchpadIntegration. test_project_lib/Window.py |
1106 | +# from gi.repository import LaunchpadIntegration # pylint: disable=E0611 |
1107 | # LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True) |
1108 | # LaunchpadIntegration.set_sourcepackagename('test-project') |
1109 | |
1110 | @@ -25,6 +26,7 @@ |
1111 | # Creating new apport hooks |
1112 | |
1113 | grep LaunchpadIntegration. test_project_lib/Window.py |
1114 | +# from gi.repository import LaunchpadIntegration # pylint: disable=E0611 |
1115 | # LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True) |
1116 | # LaunchpadIntegration.set_sourcepackagename('test-project') |
1117 | |
1118 | @@ -54,6 +56,7 @@ |
1119 | # Updating project name references in existing apport crashdb configuration |
1120 | |
1121 | grep LaunchpadIntegration. test_project_lib/Window.py |
1122 | +# from gi.repository import LaunchpadIntegration # pylint: disable=E0611 |
1123 | # LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True) |
1124 | # LaunchpadIntegration.set_sourcepackagename('test-project') |
1125 | |
1126 | @@ -119,6 +122,7 @@ |
1127 | # Updating project name references in existing apport crashdb configuration |
1128 | |
1129 | grep LaunchpadIntegration. test_project_lib/Window.py |
1130 | +# from gi.repository import LaunchpadIntegration # pylint: disable=E0611 |
1131 | # LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True) |
1132 | # LaunchpadIntegration.set_sourcepackagename('test-project') |
1133 | |
1134 | @@ -149,6 +153,7 @@ |
1135 | # Creating new apport hooks |
1136 | |
1137 | grep LaunchpadIntegration. test_project_lib/Window.py |
1138 | +# from gi.repository import LaunchpadIntegration # pylint: disable=E0611 |
1139 | # LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True) |
1140 | # LaunchpadIntegration.set_sourcepackagename('test-project') |
1141 | |
1142 | @@ -188,6 +193,7 @@ |
1143 | # Updating project name references in existing apport crashdb configuration |
1144 | |
1145 | grep LaunchpadIntegration. test_project_lib/Window.py |
1146 | +# from gi.repository import LaunchpadIntegration # pylint: disable=E0611 |
1147 | # LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True) |
1148 | # LaunchpadIntegration.set_sourcepackagename('test-project') |
1149 | |
1150 | @@ -283,7 +289,7 @@ |
1151 | # modified etc/apport/crashdb.conf.d/test-project-crashdb.conf |
1152 | # Committed revision 4. |
1153 | |
1154 | -quickly upgrade 0.3 0.4 |
1155 | +quickly upgrade 0.3 |
1156 | |
1157 | bzr status |
1158 | |
1159 | @@ -309,11 +315,12 @@ |
1160 | |
1161 | bzr status |
1162 | |
1163 | -quickly upgrade 0.3 0.4 |
1164 | +quickly upgrade 0.3 |
1165 | # Creating new apport crashdb configuration |
1166 | # Creating new apport hooks |
1167 | |
1168 | grep LaunchpadIntegration. test_project_lib/Window.py |
1169 | +# from gi.repository import LaunchpadIntegration # pylint: disable=E0611 |
1170 | # LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True) |
1171 | # LaunchpadIntegration.set_sourcepackagename('test-project') |
1172 | |
1173 | @@ -359,7 +366,7 @@ |
1174 | |
1175 | grep helpMenu test_project_lib/Window.py |
1176 | |
1177 | -quickly upgrade 0.3 0.4 |
1178 | +quickly upgrade 0.3 |
1179 | # Adding launchpad integration to existing application |
1180 | # Creating new apport crashdb configuration |
1181 | # Creating new apport hooks |
1182 | @@ -388,7 +395,7 @@ |
1183 | # modified test_project_lib/Window.py |
1184 | # Committed revision 6. |
1185 | |
1186 | -quickly upgrade 0.3 0.4 |
1187 | +quickly upgrade 0.3 |
1188 | # Creating new apport crashdb configuration |
1189 | # Creating new apport hooks |
1190 | |
1191 | @@ -409,4 +416,4 @@ |
1192 | |
1193 | grep helpMenu test_project_lib/Window.py |
1194 | |
1195 | -quickly upgrade 0.3 0.4 |
1196 | +quickly upgrade 0.3 |
1197 | |
1198 | === modified file 'data/templates/ubuntu-application/test/builder/builder.py' |
1199 | --- data/templates/ubuntu-application/test/builder/builder.py 2011-06-08 13:48:05 +0000 |
1200 | +++ data/templates/ubuntu-application/test/builder/builder.py 2011-11-08 16:10:57 +0000 |
1201 | @@ -4,7 +4,7 @@ |
1202 | import unittest |
1203 | import sys |
1204 | import os |
1205 | -import gtk |
1206 | +from gi.repository import Gtk # pylint: disable=E0611 |
1207 | import inspect |
1208 | import logging |
1209 | import glob |
1210 | @@ -85,7 +85,7 @@ |
1211 | 'wind?o-w two', 'wind_o_w_two', 'window'] # sorted list |
1212 | |
1213 | def test_interface(self): |
1214 | - builder = dir(gtk.Builder) |
1215 | + builder = dir(Gtk.Builder) |
1216 | |
1217 | # sanity test |
1218 | self.assertTrue('add_from_file' in builder) |
1219 | |
1220 | === modified file 'data/templates/ubuntu-application/test/configure.sh' |
1221 | --- data/templates/ubuntu-application/test/configure.sh 2010-10-15 20:26:19 +0000 |
1222 | +++ data/templates/ubuntu-application/test/configure.sh 2011-11-08 16:10:57 +0000 |
1223 | @@ -17,7 +17,6 @@ |
1224 | # #url='https://launchpad.net/test-project', |
1225 | |
1226 | grep website data/ui/AboutTestProjectDialog.ui |
1227 | -# <property name="website"></property> |
1228 | |
1229 | grep lp_id .quickly |
1230 | |
1231 | @@ -33,7 +32,7 @@ |
1232 | grep url= setup.py |
1233 | # url='https://launchpad.net/gpoweroff', |
1234 | |
1235 | -grep website data/ui/AboutTestProjectDialog.ui |
1236 | +grep website data/ui/AboutTestProjectDialog.ui | sed 's|</property>.*|</property>|' |
1237 | # <property name="website">https://launchpad.net/gpoweroff</property> |
1238 | |
1239 | (echo hudson-notifier > tmp) |
1240 | @@ -49,7 +48,7 @@ |
1241 | grep url= setup.py |
1242 | # url='https://launchpad.net/hudson-notifier', |
1243 | |
1244 | -grep website data/ui/AboutTestProjectDialog.ui |
1245 | +grep website data/ui/AboutTestProjectDialog.ui | sed 's|</property>.*|</property>|' |
1246 | # <property name="website">https://launchpad.net/hudson-notifier</property> |
1247 | |
1248 | ## Test configure bzr |
1249 | |
1250 | === modified file 'data/templates/ubuntu-application/test/filelist.sh' |
1251 | --- data/templates/ubuntu-application/test/filelist.sh 2011-03-31 15:19:55 +0000 |
1252 | +++ data/templates/ubuntu-application/test/filelist.sh 2011-11-08 16:10:57 +0000 |
1253 | @@ -13,12 +13,16 @@ |
1254 | |
1255 | bzr status |
1256 | |
1257 | -bzr ls -R |
1258 | +bzr ls -RV |
1259 | +# .bzrignore |
1260 | # .quickly |
1261 | # AUTHORS |
1262 | # bin/ |
1263 | # bin/test-project |
1264 | # data/ |
1265 | +# data/glib-2.0/ |
1266 | +# data/glib-2.0/schemas/ |
1267 | +# data/glib-2.0/schemas/net.launchpad.test-project.gschema.xml |
1268 | # data/media/ |
1269 | # data/media/background.png |
1270 | # data/media/test-project.svg |
1271 | @@ -50,7 +54,6 @@ |
1272 | # test_project_lib/Window.py |
1273 | # test_project_lib/__init__.py |
1274 | # test_project_lib/helpers.py |
1275 | -# test_project_lib/preferences.py |
1276 | # test_project_lib/test_projectconfig.py |
1277 | # tests/ |
1278 | # tests/test_example.py |
1279 | |
1280 | === modified file 'data/templates/ubuntu-application/test/metadata.sh' |
1281 | --- data/templates/ubuntu-application/test/metadata.sh 2011-11-08 00:50:34 +0000 |
1282 | +++ data/templates/ubuntu-application/test/metadata.sh 2011-11-08 16:10:57 +0000 |
1283 | @@ -38,10 +38,8 @@ |
1284 | # XB-Icon: test-project.svg |
1285 | # Depends: ${misc:Depends}, |
1286 | # ${python:Depends}, |
1287 | -# python-gobject-2, |
1288 | -# python-launchpad-integration, |
1289 | -# python-gtk2, |
1290 | -# python-desktopcouch-records, |
1291 | +# gir1.2-glib-2.0, |
1292 | +# gir1.2-launchpad-integration-3.0, |
1293 | # yelp |
1294 | # Description: UNKNOWN |
1295 | # UNKNOWN |
1296 | |
1297 | === removed file 'data/templates/ubuntu-application/test/preferences.py' |
1298 | --- data/templates/ubuntu-application/test/preferences.py 2011-03-31 17:38:31 +0000 |
1299 | +++ data/templates/ubuntu-application/test/preferences.py 1970-01-01 00:00:00 +0000 |
1300 | @@ -1,151 +0,0 @@ |
1301 | -import unittest |
1302 | -import os |
1303 | -import sys |
1304 | -import glob |
1305 | - |
1306 | -proj_root = os.path.abspath(os.path.join(os.path.dirname(__file__),"..","project_root")) |
1307 | -sys.path.insert(0, proj_root) |
1308 | -import logging |
1309 | -logging.debug(sys.path[0]) |
1310 | - |
1311 | -from python_lib.preferences import User_dict, preferences |
1312 | - |
1313 | -# Clean up after ourselves |
1314 | -for f in glob.glob(os.path.join(proj_root, 'python_lib', '*.pyc')): |
1315 | - os.remove(f) |
1316 | - |
1317 | -class TestUser_dict(unittest.TestCase): |
1318 | - |
1319 | - def test_interface(self): |
1320 | - foo = User_dict() |
1321 | - # provides gobject signals |
1322 | - self.assertTrue(callable(foo.emit)) |
1323 | - self.assertTrue(callable(foo.connect)) |
1324 | - |
1325 | - # provides load and save |
1326 | - self.assertTrue(callable(foo.load)) |
1327 | - self.assertTrue(callable(foo.save)) |
1328 | - |
1329 | - def test_update_from_dict(self): |
1330 | - foo = User_dict() |
1331 | - bar = {'pluto':2} |
1332 | - foo.update(bar) |
1333 | - self.assertEqual(foo.get('pluto'), 2) |
1334 | - |
1335 | - def test_update_from_pairs(self): |
1336 | - a = User_dict([['position', 'Public Relations'], ['name', 'Jayne Cobb']]) |
1337 | - b = {'name': 'Jayne Cobb', 'position': 'Public Relations'} |
1338 | - self.assertEqual(a, b) |
1339 | - |
1340 | - def test_serialisation(self): |
1341 | - # used in couchdb for instance |
1342 | - import json |
1343 | - a = User_dict([['position', 'Public Relations'], ['name', 'Jayne Cobb']]) |
1344 | - b = {'name': 'Jayne Cobb', 'position': 'Public Relations'} |
1345 | - c = json.loads(json.dumps(a)) |
1346 | - self.assertEqual(a, c) |
1347 | - |
1348 | - def test__setitem__(self): |
1349 | - foo = User_dict() |
1350 | - foo[2] = 3 |
1351 | - self.assertEqual(foo.get(2), 3) |
1352 | - |
1353 | - def test__delitem__(self): |
1354 | - foo = User_dict() |
1355 | - foo[2] = 3 |
1356 | - self.assertEqual(foo.get(2), 3) |
1357 | - del foo[2] |
1358 | - self.assertEqual(foo.get(2, 'default'), 'default') |
1359 | - |
1360 | - def test__getitem__(self): |
1361 | - foo = User_dict() |
1362 | - foo[2] = 3 |
1363 | - self.assertEqual(foo[2], 3) |
1364 | - |
1365 | -class TestSignals(unittest.TestCase): |
1366 | - |
1367 | - def setUp(self): |
1368 | - self.foo = User_dict() |
1369 | - self.messages = [] |
1370 | - self.foo.connect('changed', self.callback) |
1371 | - |
1372 | - def callback(self, *args): |
1373 | - self.messages.append(args) |
1374 | - |
1375 | - def test_update_with_additions(self): |
1376 | - bar = {'foobar': 7} |
1377 | - self.foo.update({'foobar': 7}) |
1378 | - self.assertEqual(self.messages[0][1], ('foobar',)) |
1379 | - self.foo.update({'fooey': 2}) |
1380 | - self.assertEqual(self.messages[1][1], ('fooey',)) |
1381 | - self.assertEqual(len(self.messages), 2) |
1382 | - |
1383 | - def test_update_with_changes(self): |
1384 | - bar = {'foobar': 7} |
1385 | - self.foo.update({'foobar': 7}) |
1386 | - self.assertEqual(self.messages[0][1], ('foobar',)) |
1387 | - self.foo.update({'foobar': 8}) |
1388 | - self.assertEqual(self.messages[1][1], ('foobar',)) |
1389 | - self.assertEqual(len(self.messages), 2) |
1390 | - |
1391 | - def test_update_without_changes(self): |
1392 | - bar = {'foobar': 7} |
1393 | - self.foo.update({'foobar': 7}) |
1394 | - self.assertEqual(self.messages[0][1], ('foobar',)) |
1395 | - self.foo.update({'foobar': 7}) |
1396 | - self.assertEqual(len(self.messages), 1) |
1397 | - |
1398 | - def test_update_with_several_items(self): |
1399 | - data = {'pluto': 7, 'mickey': 8, 'minnie': 9} |
1400 | - self.foo.update(data) |
1401 | - self.assertEqual(self.messages[0][1], ('mickey', 'minnie', 'pluto')) |
1402 | - self.assertEqual(len(self.messages), 1) |
1403 | - data = {'mickey': 1, 'minnie': 2} |
1404 | - self.foo.update(data) |
1405 | - self.assertEqual(self.messages[1][1], ('mickey', 'minnie')) |
1406 | - self.assertEqual(len(self.messages), 2) |
1407 | - |
1408 | - def test__setitem__with_additions(self): |
1409 | - self.foo['too'] = 3 |
1410 | - self.assertEqual(self.messages[0][1], ('too',)) |
1411 | - |
1412 | - def test__setitem__with_changes(self): |
1413 | - self.foo['too'] = 3 |
1414 | - self.assertEqual(self.messages[0][1], ('too',)) |
1415 | - self.assertEqual(len(self.messages), 1) |
1416 | - self.foo['too'] = 4 |
1417 | - self.assertEqual(len(self.messages), 2) |
1418 | - |
1419 | - def test__setitem__without_changes(self): |
1420 | - self.foo['too'] = 3 |
1421 | - self.assertEqual(self.messages[0][1], ('too',)) |
1422 | - self.assertEqual(len(self.messages), 1) |
1423 | - self.foo['too'] = 3 |
1424 | - self.assertEqual(len(self.messages), 1) |
1425 | - |
1426 | -class TestPreferences(unittest.TestCase): |
1427 | - ''' this one we really need ''' |
1428 | - |
1429 | - def setUp(self): |
1430 | - self.messages = [] |
1431 | - preferences.connect('changed', self.callback) |
1432 | - |
1433 | - def callback(self, *args): |
1434 | - self.messages.append(args) |
1435 | - |
1436 | - def test_update(self): |
1437 | - preferences.update({'foobar': 7}) |
1438 | - self.assertEqual(self.messages[0][1], ('foobar',)) |
1439 | - self.assertEqual(len(self.messages), 1) |
1440 | - # preferences persist so we need to clean our changes |
1441 | - del preferences['foobar'] |
1442 | - |
1443 | - def test__setitem__(self): |
1444 | - preferences['too'] = 3 |
1445 | - self.assertEqual(self.messages[0][1], ('too',)) |
1446 | - self.assertEqual(len(self.messages), 1) |
1447 | - # preferences persist so we need to clean our changes |
1448 | - del preferences['too'] |
1449 | - |
1450 | -if __name__ == '__main__': |
1451 | - unittest.main() |
1452 | |
1453 | === modified file 'data/templates/ubuntu-application/upgrade.py' |
1454 | --- data/templates/ubuntu-application/upgrade.py 2011-10-03 18:05:30 +0000 |
1455 | +++ data/templates/ubuntu-application/upgrade.py 2011-11-08 16:10:57 +0000 |
1456 | @@ -34,6 +34,8 @@ |
1457 | # get project version and template version if no argument given |
1458 | if len(sys.argv) < 3: |
1459 | (project_version, template_version) = templatetools.get_project_and_template_versions("ubuntu-application") |
1460 | + if len(sys.argv) == 2: # we have been given project but not template version |
1461 | + project_version = sys.argv[1] |
1462 | else: |
1463 | project_version = sys.argv[1] |
1464 | template_version = sys.argv[2] |
1465 | @@ -201,8 +203,8 @@ |
1466 | except templatetools.CantUpdateFile, e: |
1467 | print _("WARNING: can't update your project to support /opt. This doesn't matter if you don't plan to submit your project to the application review board. Cause is: %s" % e) |
1468 | |
1469 | -### 11.09 update |
1470 | -if project_version < '11.09': |
1471 | +### 11.09 update (but only through 11.10; later versions don't want this change) |
1472 | +if project_version < '11.09' and template_version <= '11.10': |
1473 | filename = './%s_lib/Builder.py' % python_name |
1474 | try: |
1475 | with open(filename) as fileobj: |
1476 | |
1477 | === removed file 'data/templates/ubuntu-flash-game/internal/apportutils.py' |
1478 | --- data/templates/ubuntu-flash-game/internal/apportutils.py 2011-06-06 10:14:40 +0000 |
1479 | +++ data/templates/ubuntu-flash-game/internal/apportutils.py 1970-01-01 00:00:00 +0000 |
1480 | @@ -1,143 +0,0 @@ |
1481 | -import os |
1482 | -import shutil |
1483 | -import subprocess |
1484 | - |
1485 | -from gettext import gettext as _ |
1486 | - |
1487 | -import quickly |
1488 | -import quicklyutils |
1489 | - |
1490 | -from lxml import etree |
1491 | - |
1492 | -LPI_import_block = """ |
1493 | -# optional Launchpad integration |
1494 | -# this shouldn't crash if not found as it is simply used for bug reporting |
1495 | -try: |
1496 | - import LaunchpadIntegration |
1497 | - launchpad_available = True |
1498 | -except: |
1499 | - launchpad_available = False |
1500 | - |
1501 | -""" |
1502 | - |
1503 | -LPI_init_menu_block = """ |
1504 | - global launchpad_available |
1505 | - if launchpad_available: |
1506 | - # see https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding for more information |
1507 | - # about LaunchpadIntegration |
1508 | - helpmenu = self.builder.get_object('%(help_menu)s') |
1509 | - if helpmenu: |
1510 | - LaunchpadIntegration.set_sourcepackagename('%(project_name)s') |
1511 | - LaunchpadIntegration.add_items(helpmenu, 0, False, True) |
1512 | - else: |
1513 | - launchpad_available = False""" |
1514 | - |
1515 | -def update_apport(project_name, old_lp_project, new_lp_project): |
1516 | - if not new_lp_project: |
1517 | - return |
1518 | - # crashdb file doesn't support spaces or dashes in the crash db name |
1519 | - safe_project_name = project_name.replace(" ", "_").replace("-","_") |
1520 | - crashdb_file = "%s-crashdb.conf"%project_name |
1521 | - hook_file = "source_%s.py"%project_name |
1522 | - |
1523 | - |
1524 | - pathname = quickly.templatetools.get_template_path_from_project() |
1525 | - template_pr_path = os.path.join(os.path.abspath(pathname), "store", |
1526 | - "apport") |
1527 | - relative_crashdb_dir = os.path.join("etc", "apport", "crashdb.conf.d") |
1528 | - relative_apport_dir = "apport" |
1529 | - |
1530 | - existing_crashdb = os.path.join(relative_crashdb_dir, crashdb_file) |
1531 | - existing_hook = os.path.join(relative_apport_dir, hook_file) |
1532 | - |
1533 | - template_crashdb_dir = os.path.join(template_pr_path, relative_crashdb_dir) |
1534 | - template_hook_dir = os.path.join(template_pr_path, relative_apport_dir) |
1535 | - |
1536 | - # if the project name has changed, or any of the files are missing, then |
1537 | - # attempt to set up the apport configuration and hooks |
1538 | - if not old_lp_project == new_lp_project \ |
1539 | - or not os.path.isfile(existing_crashdb) \ |
1540 | - or not os.path.isfile(existing_hook): |
1541 | - |
1542 | - subst_existing = ((old_lp_project, new_lp_project),) |
1543 | - subst_new = ( ("safe_project_name", safe_project_name), |
1544 | - ("project_name", project_name), |
1545 | - ("lp_project", new_lp_project)) |
1546 | - |
1547 | - if os.path.isfile(existing_crashdb): |
1548 | - print _("Updating project name references in existing apport crashdb configuration") |
1549 | - templatetools.file_from_template(relative_crashdb_dir, crashdb_file, relative_crashdb_dir, subst_existing) |
1550 | - elif os.path.isdir(template_crashdb_dir): |
1551 | - print _("Creating new apport crashdb configuration") |
1552 | - if not os.path.isdir(relative_crashdb_dir): |
1553 | - os.makedirs(relative_crashdb_dir) |
1554 | - templatetools.file_from_template(template_crashdb_dir, "project_name-crashdb.conf", relative_crashdb_dir, subst_new) |
1555 | - |
1556 | - if not os.path.isfile(existing_hook) and os.path.isdir(template_hook_dir): |
1557 | - print _("Creating new apport hooks") |
1558 | - if not os.path.isdir(relative_apport_dir): |
1559 | - os.makedirs(relative_apport_dir) |
1560 | - templatetools.file_from_template(template_hook_dir, "source_project_name.py", relative_apport_dir, subst_new) |
1561 | - |
1562 | -def insert_lpi_if_required(project_name): |
1563 | - existing_bin_filename = os.path.join("bin",project_name) |
1564 | - camel_case_project_name = quickly.templatetools.get_camel_case_name(project_name) |
1565 | - existing_ui_filename = os.path.join("data","ui", "%sWindow.ui"%camel_case_project_name) |
1566 | - |
1567 | - if os.path.isfile(existing_bin_filename) and os.path.isfile(existing_ui_filename): |
1568 | - tree = etree.parse(existing_ui_filename) |
1569 | - help_menu = find_about_menu(tree) |
1570 | - |
1571 | - if help_menu: |
1572 | - existing_bin_file = file(existing_bin_filename, "r") |
1573 | - existing_lines = existing_bin_file.readlines() |
1574 | - existing_bin_file.close() |
1575 | - new_lines = detect_or_insert_lpi(existing_lines, project_name, help_menu) |
1576 | - if new_lines: |
1577 | - print _("Adding launchpad integration to existing application") |
1578 | - ftarget_file_name_out = file(existing_bin_file.name + '.new', 'w') |
1579 | - ftarget_file_name_out.writelines(new_lines) |
1580 | - ftarget_file_name_out.close() |
1581 | - quickly.templatetools.apply_file_rights(existing_bin_file.name, ftarget_file_name_out.name) |
1582 | - os.rename(ftarget_file_name_out.name, existing_bin_file.name) |
1583 | - return True |
1584 | - return False |
1585 | - |
1586 | -def detect_or_insert_lpi(existing_lines, project_name, help_menu): |
1587 | - integration_present = False |
1588 | - import_insert_line = None |
1589 | - init_insert_line = None |
1590 | - current_line = 0 |
1591 | - for line in existing_lines: |
1592 | - if "import LaunchpadIntegration" in line \ |
1593 | - or "if launchpad_available:" in line: |
1594 | - integration_present = True |
1595 | - break |
1596 | - if not import_insert_line and "import gtk" in line: |
1597 | - import_insert_line = current_line |
1598 | - if not init_insert_line and "self.builder.connect_signals(self)" in line: |
1599 | - init_insert_line = current_line |
1600 | - current_line += 1 |
1601 | - |
1602 | - if not integration_present \ |
1603 | - and import_insert_line \ |
1604 | - and init_insert_line \ |
1605 | - and import_insert_line < init_insert_line: |
1606 | - init_menu_block = LPI_init_menu_block%{"project_name":project_name, "help_menu":help_menu} |
1607 | - existing_lines = existing_lines[:import_insert_line+1] + \ |
1608 | - ["%s\n"%l for l in LPI_import_block.splitlines()] + \ |
1609 | - existing_lines[import_insert_line+1:init_insert_line+1] + \ |
1610 | - ["%s\n"%l for l in init_menu_block.splitlines()] + \ |
1611 | - existing_lines[init_insert_line+1:] |
1612 | - return existing_lines |
1613 | - else: |
1614 | - return None |
1615 | - |
1616 | - |
1617 | -def find_about_menu(tree): |
1618 | - """Finds the current help menu in the passed xml document by looking for the gtk-about element""" |
1619 | - help_item = tree.xpath('//property[@name="label" and .="gtk-about"]/../../../@id') |
1620 | - if len(help_item) == 1: # only one element matching this should be found |
1621 | - return help_item[0] |
1622 | - else: |
1623 | - return None |
1624 | |
1625 | === modified file 'data/templates/ubuntu-flash-game/project_root/bin/project_name' |
1626 | --- data/templates/ubuntu-flash-game/project_root/bin/project_name 2011-01-03 16:05:40 +0000 |
1627 | +++ data/templates/ubuntu-flash-game/project_root/bin/project_name 2011-11-08 16:10:57 +0000 |
1628 | @@ -18,7 +18,7 @@ |
1629 | ########################################################################### |
1630 | |
1631 | |
1632 | -import webkit, gtk, gio |
1633 | +from gi.repository import WebKit, Gtk, Gio |
1634 | import json, os |
1635 | |
1636 | # Where your project will look for your data (for instance, images and ui |
1637 | @@ -55,17 +55,18 @@ |
1638 | |
1639 | |
1640 | if __name__ == "__main__": |
1641 | - w = gtk.Window() |
1642 | - v = webkit.WebView() |
1643 | + w = Gtk.Window() |
1644 | + v = WebKit.WebView() |
1645 | w.add(v) |
1646 | w.show_all() # have to have this before set_size_request |
1647 | - w.connect("destroy", lambda q: gtk.main_quit()) |
1648 | + w.connect("destroy", lambda q: Gtk.main_quit()) |
1649 | w.set_title(GAME_NAME) |
1650 | - htmlfp = gio.File(get_data_file('index.html')) |
1651 | + htmlfp = Gio.file_new_for_path(get_data_file('index.html')) |
1652 | uri = htmlfp.get_uri() |
1653 | - html, _, _ = htmlfp.load_contents() |
1654 | + _, html, _ = htmlfp.load_contents(None) |
1655 | + print html, "hello", uri |
1656 | v.load_html_string(html, uri) |
1657 | w.set_size_request(*WINDOW_SIZE) |
1658 | v.queue_resize() # force a reallocation, https://bugs.webkit.org/show_bug.cgi?id=47742 |
1659 | - gtk.main() |
1660 | + Gtk.main() |
1661 | |
1662 | |
1663 | === modified file 'quickly/quicklyconfig.py' |
1664 | --- quickly/quicklyconfig.py 2011-09-26 13:02:43 +0000 |
1665 | +++ quickly/quicklyconfig.py 2011-11-08 16:10:57 +0000 |
1666 | @@ -20,7 +20,7 @@ |
1667 | # you're warned :) |
1668 | |
1669 | # quickly version used for project format compatibility |
1670 | -__version__ = '11.10' |
1671 | +__version__ = '11.11' |
1672 | |
1673 | # where quickly will head for quickly data (for instance, templates) |
1674 | # by default, this is ../data, relative to trunk layout |
1675 | |
1676 | === modified file 'quickly/test/pylint.sh' |
1677 | --- quickly/test/pylint.sh 2010-12-04 17:28:41 +0000 |
1678 | +++ quickly/test/pylint.sh 2011-11-08 16:10:57 +0000 |
1679 | @@ -2,4 +2,4 @@ |
1680 | |
1681 | if ! which pylint >/dev/null; then echo 'Please install pylint'; fi |
1682 | |
1683 | -(pylint -E --output-format=parseable --include-ids=y --ignored-classes=Credentials,Launchpad $(find "$ORIGINAL_DIR" -name '*.py' | grep -v "^$ORIGINAL_DIR/debian" | grep -v "^$ORIGINAL_DIR/build") 2>/dev/null) |
1684 | +(pylint -E --output-format=parseable --include-ids=y --disable=E1101 --ignored-classes=Credentials,Launchpad $(find "$ORIGINAL_DIR" -name '*.py' | grep -v "^$ORIGINAL_DIR/debian" | grep -v "^$ORIGINAL_DIR/build") 2>/dev/null) |
1685 | |
1686 | === modified file 'setup.py' |
1687 | --- setup.py 2011-09-26 13:02:43 +0000 |
1688 | +++ setup.py 2011-11-08 16:10:57 +0000 |
1689 | @@ -18,7 +18,7 @@ |
1690 | |
1691 | |
1692 | # UPDATE VERSION WHEN NEEDED (it updates all versions needed to be updated) |
1693 | -VERSION = '11.10' |
1694 | +VERSION = '11.11' |
1695 | |
1696 | import glob |
1697 | import os |
1698 | |
1699 | === modified file 'ubuntudevbar.py' |
1700 | --- ubuntudevbar.py 2010-12-02 16:03:30 +0000 |
1701 | +++ ubuntudevbar.py 2011-11-08 16:10:57 +0000 |
1702 | @@ -1,10 +1,7 @@ |
1703 | #!/usr/bin/python |
1704 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1705 | |
1706 | -import nautilus |
1707 | -import pygtk |
1708 | -import gtk |
1709 | -import vte |
1710 | +from gi.repository import GLib, GdkPixbuf, Gtk, Nautilus, Vte # pylint: disable=E0611 |
1711 | |
1712 | try: |
1713 | from quickly import api as quicklyapi |
1714 | @@ -16,7 +13,7 @@ |
1715 | command_order = ('create', 'edit', 'design', 'save', 'package', 'share', 'release', 'tutorial') |
1716 | command_without_output = ('edit', 'design', 'save', 'tutorial') |
1717 | |
1718 | -class DevBar(nautilus.LocationWidgetProvider): |
1719 | +class DevBar(Nautilus.LocationWidgetProvider): |
1720 | pass |
1721 | def __init__(self): |
1722 | self.bars = {} |
1723 | @@ -73,12 +70,12 @@ |
1724 | return bar |
1725 | |
1726 | |
1727 | -class UbuntuDevBar(gtk.HBox): |
1728 | +class UbuntuDevBar(Gtk.HBox): |
1729 | '''Container to all buttons in nautilus.''' |
1730 | |
1731 | def __init__(self, *args, **kwargs): |
1732 | '''create a Ubuntu Dev Bar''' |
1733 | - super(UbuntuDevBar, self).__init__(*args, **kwargs) |
1734 | + Gtk.HBox.__init__(*args, **kwargs) |
1735 | self._logo = None |
1736 | self._image = None |
1737 | self._subtitle = None |
1738 | @@ -87,16 +84,16 @@ |
1739 | |
1740 | def add_image(self, image_name, subtitle=None): |
1741 | """Add an image to the bar and a subtitle below if one.""" |
1742 | - self._logo = gtk.VBox(homogeneous=False, spacing=0) |
1743 | - self._image = gtk.Image() |
1744 | + self._logo = Gtk.VBox(homogeneous=False, spacing=0) |
1745 | + self._image = Gtk.Image() |
1746 | self._logo.pack_start(self._image, expand=True, fill=True, padding=0) |
1747 | - pixbuf = gtk.gdk.pixbuf_new_from_file(image_name) |
1748 | + pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_name) |
1749 | if pixbuf: |
1750 | - scaled_pixbuf = pixbuf.scale_simple(48, 48, gtk.gdk.INTERP_BILINEAR) |
1751 | + scaled_pixbuf = pixbuf.scale_simple(48, 48, GdkPixbuf.InterpType.BILINEAR) |
1752 | self._image.set_from_pixbuf(scaled_pixbuf) |
1753 | self._image.show() |
1754 | if subtitle: |
1755 | - self._subtitle = gtk.Label(subtitle) |
1756 | + self._subtitle = Gtk.Label(subtitle) |
1757 | self._logo.pack_start(self._subtitle, expand=True, fill=True, padding=0) |
1758 | self._subtitle.show() |
1759 | self.pack_start(self._logo, expand=False, fill=False, padding=0) |
1760 | @@ -104,17 +101,17 @@ |
1761 | |
1762 | def add_button(self, signal, label, command_line, path, icon=None): |
1763 | """Adds a new new button to the bar widget.""" |
1764 | - button = gtk.Button() |
1765 | + button = Gtk.Button() |
1766 | button.connect("clicked", signal, command_line, path) |
1767 | button.set_label(label) |
1768 | if icon: |
1769 | - image = gtk.Image() |
1770 | + image = Gtk.Image() |
1771 | image.set_from_file(icon) |
1772 | settings = button.get_settings() |
1773 | settings.set_property("gtk-button-images", True) |
1774 | button.set_image(image) |
1775 | button.show() |
1776 | - vbox = gtk.VBox(homogeneous=False, spacing=0) |
1777 | + vbox = Gtk.VBox(homogeneous=False, spacing=0) |
1778 | vbox.pack_start(button, expand=True, fill=False, padding=0) |
1779 | vbox.show() |
1780 | self._buttons.append(button) |
1781 | @@ -123,21 +120,21 @@ |
1782 | def add_button_with_selection(self, signal, label, selection, command_line, |
1783 | path, icon=None): |
1784 | """Adds a new button with a multiple selection widget""" |
1785 | - combobox = gtk.combo_box_new_text() |
1786 | + combobox = Gtk.ComboBoxText() |
1787 | for item in selection: |
1788 | combobox.append_text(item) |
1789 | combobox.show() |
1790 | - button = gtk.Button() |
1791 | + button = Gtk.Button() |
1792 | button.set_label(label) |
1793 | button.connect("clicked", signal, command_line, path, combobox) |
1794 | if icon: |
1795 | - image = gtk.Image() |
1796 | + image = Gtk.Image() |
1797 | image.set_from_file(icon) |
1798 | settings = button.get_settings() |
1799 | settings.set_property("gtk-button-images", True) |
1800 | button.set_image(image) |
1801 | button.show() |
1802 | - vbox = gtk.VBox(homogeneous=False, spacing=0) |
1803 | + vbox = Gtk.VBox(homogeneous=False, spacing=0) |
1804 | vbox.pack_start(combobox, expand=True, fill=False, padding=0) |
1805 | vbox.pack_start(button, expand=True, fill=False, padding=0) |
1806 | self._buttons_with_selection.append((combobox,button)) |
1807 | @@ -158,13 +155,14 @@ |
1808 | except IndexError: |
1809 | pass |
1810 | command = self.add_additional_actions(command) |
1811 | - v = vte.Terminal() |
1812 | - v.fork_command(command[0], argv=command, directory=argscommand[1]) |
1813 | - window = gtk.Window() |
1814 | + v = Vte.Terminal() |
1815 | + v.fork_command_full(Vte.PtyFlags.DEFAULT, argscommand[1], command, |
1816 | + None, GLib.SpawnFlags.SEARCH_PATH, None, None) |
1817 | + window = Gtk.Window() |
1818 | window.add(v) |
1819 | if command[1] not in command_without_output: |
1820 | window.show_all() |
1821 | - gtk.main() |
1822 | + Gtk.main() |
1823 | |
1824 | def add_additional_actions(self, command): |
1825 | """Some commands needs additional args, filter them here""" |
1826 | @@ -172,7 +170,7 @@ |
1827 | # TODO: Add missing prompts module |
1828 | #if command[1] == "create": |
1829 | # response, val = prompts.string("Project Name","Please enter a project name") |
1830 | - # if response == gtk.RESPONSE_OK: |
1831 | + # if response == Gtk.ResponseType.OK: |
1832 | # command.append(val) |
1833 | |
1834 | return command |
Excellent work Michael! It's even frustrating that I have nothing to say about it as your much as your work there rocks!
Just a small questions though, in the test apport file:
1154 -quickly upgrade 0.3 0.4
1155 +quickly upgrade 0.3
at multiple time, do you need that and why?
However, I get a lot of error in the testsuite here. Seems to be more a setup issue than anything and not really have the time to run it. So if you confirm that all the tests are passing, please, feel free to merge :)