Status: | Needs review |
---|---|
Proposed branch: | lp:~noskcaj/testdrive/pep8 |
Merge into: | lp:testdrive |
Diff against target: |
3322 lines (+922/-571) 17 files modified
bin/testdrive (+106/-51) bin/testdrive-gtk (+250/-152) debian/changelog (+4/-6) debian/control (+2/-1) debian/copyright (+5/-0) debian/release.sh (+1/-1) po/testdrive.pot (+177/-132) setup.py (+30/-28) testdrive/testdrive.py (+75/-36) testdrive/virt/kvm.py (+22/-8) testdrive/virt/parallels.py (+18/-7) testdrive/virt/virtualbox.py (+55/-25) testdrivegtk/AboutTestdrivegtkDialog.py (+20/-17) testdrivegtk/AddOtherTestdrivegtkDialog.py (+31/-19) testdrivegtk/PreferencesTestdrivegtkDialog.py (+101/-65) testdrivegtk/helpers.py (+13/-12) testdrivegtk/testdrivegtkconfig.py (+12/-11) |
To merge this branch: | bzr merge lp:~noskcaj/testdrive/pep8 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andres Rodriguez | Needs Fixing | ||
Review via email: mp+189491@code.launchpad.net |
Commit message
Description of the change
makes the program pep8 compliant and adds some minor fixes.
- 434. By Jackson Doak
-
prevent testdrive from importing gettext twice
- 435. By Jackson Doak
-
Comment out unused imports
- 436. By Jackson Doak
-
Fix minor text bugs i made.
Jackson Doak (noskcaj) wrote : | # |
first, thanks for having time to review.
second, I'll re-do this in separate branches one the PyGI (and maybe
python3) port is over. Is there any chance you could help with either,
since glade keep breaking for me and dan hasn't got the time.
On Sun, Oct 27, 2013 at 5:24 AM, Andres Rodriguez
<email address hidden>wrote:
> Review: Needs Fixing
>
> Hi Jackson!
>
> I like this fixes for sure.. however, it is way too big to review.. is
> there anyway you can split this in smaller branches? (Say one branch per
> binary, so that it is easier to test and review).
>
> thank you! this is awesome!
> --
> https:/
> You are the owner of lp:~noskcaj/testdrive/pep8.
>
Unmerged revisions
- 436. By Jackson Doak
-
Fix minor text bugs i made.
- 435. By Jackson Doak
-
Comment out unused imports
- 434. By Jackson Doak
-
prevent testdrive from importing gettext twice
- 433. By Jackson Doak
-
* debian/control: Add working VCS fields
* debian/release.sh: Update current ubuntu release - 432. By Jackson Doak
-
Add copyright entry for testdrivegtk/
AddOtherTestdri vegtkDialog. py - 431. By Jackson Doak
-
Finish pep8 changes
- 430. By Jackson Doak
-
Make testdrive pep8 compliant
Preview Diff
1 | === modified file 'bin/testdrive' |
2 | --- bin/testdrive 2013-08-10 20:52:38 +0000 |
3 | +++ bin/testdrive 2013-10-06 20:59:44 +0000 |
4 | @@ -19,11 +19,21 @@ |
5 | # You should have received a copy of the GNU General Public License |
6 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
7 | |
8 | -import commands, hashlib, os, string, sys, tempfile, time, platform, subprocess, tarfile, logging |
9 | +import commands |
10 | +#import hashlib |
11 | +import os |
12 | +import string |
13 | +import sys |
14 | +#import tempfile |
15 | +import time |
16 | +#import platform |
17 | +import subprocess |
18 | +import tarfile |
19 | +import logging |
20 | from optparse import OptionParser |
21 | |
22 | import gettext |
23 | -from gettext import gettext as _ |
24 | +_ = gettext.gettext |
25 | gettext.textdomain('testdrive') |
26 | |
27 | from testdrive import testdrive |
28 | @@ -57,9 +67,12 @@ |
29 | filename = os.path.basename(iso["url"]) |
30 | path = "%s/%s_%s" % (td.CACHE_ISO, iso["category"], filename) |
31 | if os.path.exists(path): |
32 | - print(_(" +-cache--> [%s] %s") % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(path))), filename)) |
33 | - i=i+1 |
34 | - menu.append({"id":i, "url":iso["url"], "cat": iso["category"]}) |
35 | + print(_(" +-cache--> [%s] %s") % (time.strftime( |
36 | + "%Y-%m-%d %H:%M:%S", time.localtime( |
37 | + os.path.getmtime(path))), filename)) |
38 | + i += 1 |
39 | + menu.append({"id": i, "url": iso["url"], |
40 | + "cat": iso["category"]}) |
41 | print(_(" %d. Other (prompt for ISO URL)") % i) |
42 | try: |
43 | input = raw_input(_("\nSelect an image to testdrive [1]: ")) |
44 | @@ -84,38 +97,46 @@ |
45 | logger.error(_("\nERROR: Invalid selection\n")) |
46 | return(url) |
47 | |
48 | + |
49 | def error(str): |
50 | logger.error(_("\n%s\n") % str) |
51 | sys.exit(1) |
52 | |
53 | + |
54 | def is_iso(file): |
55 | # If it's a URL, assume it's good |
56 | for i in ("http", "ftp", "rsync", "file", "zsync"): |
57 | if string.find(file, "%s://" % i) == 0: |
58 | return(file) |
59 | # If it's a local path, test it for viability |
60 | - if commands.getstatusoutput("file \"%s\" | grep -qs \"ISO 9660\"" % file)[0] == 0: |
61 | + if commands.getstatusoutput("file \"%s\" | grep -qs \"ISO 9660\"" |
62 | + % file)[0] == 0: |
63 | return("file://%s" % file) |
64 | elif tarfile.is_tarfile(file): |
65 | return("file://%s" % file) |
66 | else: |
67 | error(_("Invalid ISO URL [%s]") % file) |
68 | |
69 | + |
70 | def is_disk_img(file): |
71 | - (status, output) = commands.getstatusoutput("file %s | grep -qs 'Qemu Image'" % file) |
72 | - if status == 0: |
73 | - # qemu/kvm qcow2 image |
74 | - return True |
75 | - (status, output) = commands.getstatusoutput("file %s | grep -qs 'QEMU QCOW Image'" % file) |
76 | - if status == 0: |
77 | - # qemu/kvm qcow2 image |
78 | - return True |
79 | - (status, output) = commands.getstatusoutput("file %s | grep -qs '.img: data$'" % file) |
80 | + (status, output) = commands.getstatusoutput( |
81 | + "file %s | grep -qs 'Qemu Image'" % file) |
82 | + if status == 0: |
83 | + # qemu/kvm qcow2 image |
84 | + return True |
85 | + (status, output) = commands.getstatusoutput( |
86 | + "file %s | grep -qs 'QEMU QCOW Image'" % file) |
87 | + if status == 0: |
88 | + # qemu/kvm qcow2 image |
89 | + return True |
90 | + (status, output) = commands.getstatusoutput( |
91 | + "file %s | grep -qs '.img: data$'" % file) |
92 | if status == 0: |
93 | # probably a virtual box image |
94 | return True |
95 | return False |
96 | |
97 | + |
98 | def is_cloud_img(file): |
99 | img = False |
100 | floppy = False |
101 | @@ -136,19 +157,23 @@ |
102 | else: |
103 | return False |
104 | |
105 | + |
106 | def run(cmd): |
107 | return(os.system(cmd)) |
108 | |
109 | + |
110 | def run_or_die(cmd): |
111 | if run(cmd) != 0: |
112 | error(_("Command failed\n `%s`") % cmd) |
113 | |
114 | + |
115 | def run_vm(cmd, td, curses): |
116 | if not curses: |
117 | p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) |
118 | if td.VIRT == 'kvm': |
119 | if curses: |
120 | - logger.info(_("Launching Virtual Machine using CURSES as screen mode")) |
121 | + logger.info(_( |
122 | + "Launching Virtual Machine using CURSES as screen mode")) |
123 | run_or_die(cmd) |
124 | else: |
125 | p.wait() |
126 | @@ -156,15 +181,20 @@ |
127 | # Give this VM a few seconds to start up |
128 | time.sleep(5) |
129 | # Loop as long as this VM is running |
130 | - while commands.getstatusoutput("VBoxManage list runningvms | grep -qs %s" % td.VBOX_NAME)[0] == 0: |
131 | + while commands.getstatusoutput( |
132 | + "VBoxManage list runningvms | grep -qs %s" % td.VBOX_NAME |
133 | + )[0] == 0: |
134 | time.sleep(2) |
135 | elif td.VIRT == 'parallels': |
136 | # Loop as long as this VM is running |
137 | - while commands.getstatusoutput("prlctl list %s | grep -qs stopped" % td.VBOX_NAME)[0] != 0: |
138 | + while commands.getstatusoutput( |
139 | + "prlctl list %s | grep -qs stopped" % td.VBOX_NAME)[0] != 0: |
140 | time.sleep(2) |
141 | |
142 | + |
143 | def main(): |
144 | - # Initialize Testdrive Class, sending section used to retrieve settings from config file |
145 | + # Initialize Testdrive Class, |
146 | + # sending section used to retrieve settings from config file |
147 | td = testdrive.Testdrive('testdrive') |
148 | |
149 | # Local UI |
150 | @@ -190,36 +220,48 @@ |
151 | Users wanting to change the behavior default configuration can make a\n\ |
152 | copy of /etc/%progrc, and pass this as a parameter to %prog.\n" |
153 | |
154 | - |
155 | parser = OptionParser(usage) |
156 | - parser.add_option('-f', '--config', action='store', type='string', dest='config', |
157 | + parser.add_option( |
158 | + '-f', '--config', action='store', type='string', dest='config', |
159 | help=_('user configuration file (overriding default values')) |
160 | - parser.add_option('-v', '--version', action='store_true', dest='version', default=False, |
161 | + parser.add_option( |
162 | + '-v', '--version', action='store_true', dest='version', default=False, |
163 | help=_('print version and system data, and exit')) |
164 | - parser.add_option('-u', '--url', action='store', type='string', dest='url', |
165 | + parser.add_option( |
166 | + '-u', '--url', action='store', type='string', dest='url', |
167 | help=_('get ISO image from this URL location')) |
168 | - parser.add_option('-d', '--desktop', action='store_true', dest='desktop', default=False, |
169 | + parser.add_option( |
170 | + '-d', '--desktop', action='store_true', dest='desktop', default=False, |
171 | help=_('try to launch usb-creator for further testing')) |
172 | - parser.add_option('-r', '--release', action='store', type='string', dest='release', |
173 | + parser.add_option( |
174 | + '-r', '--release', action='store', type='string', dest='release', |
175 | help=_('hardcode Ubuntu RELEASE codename')) |
176 | - parser.add_option('-l', '--flavor', action='store', type='string', dest='flavor', |
177 | + parser.add_option( |
178 | + '-l', '--flavor', action='store', type='string', dest='flavor', |
179 | help=_('hardcode Ubuntu flavor. Available Flavors:\n\ |
180 | - ubuntu/kubuntu/xubuntu/edubuntu/mythbuntu/ubuntustudio/lubuntu/ubuntukylin')) |
181 | - parser.add_option('-p', '--repo', action='store', type='string', dest='repository', |
182 | + ubuntu/kubuntu/xubuntu/edubuntu/mythbuntu/' |
183 | + 'ubuntustudio/lubuntu/ubuntukylin')) |
184 | + parser.add_option( |
185 | + '-p', '--repo', action='store', type='string', dest='repository', |
186 | help=_('hardcode Ubuntu repository from where to obtain ISOs:\n\ |
187 | releases/cdimage/cloud-daily/cloud-releases')) |
188 | - parser.add_option('-c', '--curses', action='store_true', default=False, dest='curses', |
189 | - help=_('displays the Virtual Machine in the shell. Only valid for Cloud images.')) |
190 | - #parser.add_option('-v', '--verbose', action='store_true', default=False, dest='verbose', |
191 | + parser.add_option( |
192 | + '-c', '--curses', action='store_true', default=False, dest='curses', |
193 | + help=_('displays the Virtual Machine in the shell. ' |
194 | + 'Only valid for Cloud images.')) |
195 | + #parser.add_option( |
196 | + # '-v', '--verbose', action='store_true', default=False, dest='verbose', |
197 | # help=_('show debug messages')) |
198 | |
199 | (opt, args) = parser.parse_args() |
200 | logger.info(_("version passed: %s") % opt.version) |
201 | if opt.version: |
202 | hasOptions = True |
203 | - version = commands.getstatusoutput("dpkg -l testdrive-cli | tail -n1 | awk '{print $3}'") |
204 | + version = commands.getstatusoutput( |
205 | + "dpkg -l testdrive-cli | tail -n1 | awk '{print $3}'") |
206 | logger.info(_("testdrive %s") % version[1]) |
207 | - #TODO: Why is get_virt() here? Disable until is determined if we really need it or not. If yes, we'll have to add same code as below, |
208 | + #TODO: Why is get_virt() here? Disable until is determined if we really |
209 | + # need it or not. If yes, we'll have to add same code as below, |
210 | # for same function |
211 | td.get_virt() |
212 | sys.exit(0) |
213 | @@ -229,8 +271,9 @@ |
214 | ############################## |
215 | |
216 | # prime configuration with defaults |
217 | - config_files = ["/etc/%s" % td.PKGRC, "%s/.%s" % (td.HOME, td.PKGRC), "%s/.config/%s/%s" % (td.HOME, td.PKG, td.PKGRC) ] |
218 | - logger.info(_("config passed: %s") %opt.config) |
219 | + config_files = ["/etc/%s" % td.PKGRC, "%s/.%s" % (td.HOME, td.PKGRC), |
220 | + "%s/.config/%s/%s" % (td.HOME, td.PKG, td.PKGRC)] |
221 | + logger.info(_("config passed: %s") % opt.config) |
222 | if opt.config: |
223 | hasOptions = True |
224 | if opt.config[0] != '/': |
225 | @@ -257,21 +300,23 @@ |
226 | error(_("Your CPU supports KVM acceleration; please install KVM:\n\ |
227 | sudo apt-get install qemu-kvm")) |
228 | elif td.VIRT == 0: |
229 | - error(_("Your CPU does not support acceleration; run kvm-ok for more information; then please install VirtualBox:\n\ |
230 | + error(_("Your CPU does not support acceleration; run kvm-ok for more " |
231 | + "information; then please install VirtualBox:\n\ |
232 | kvm-ok\n\ |
233 | sudo apt-get install virtualbox")) |
234 | elif td.VIRT == "kvm": |
235 | - logger.info(_("Using KVM for virtual machine hosting...")); |
236 | + logger.info(_("Using KVM for virtual machine hosting.")) |
237 | elif td.VIRT == "virtualbox": |
238 | - logger.info(_("Using VirtualBox for virtual machine hosting...")) |
239 | + logger.info(_("Using VirtualBox for virtual machine hosting.")) |
240 | elif td.VIRT == "paralels": |
241 | - logger.info(_("Using Parallels Desktop for virtual machine hosting...")) |
242 | + logger.info(_("Using Parallels Desktop for virtual machine hosting.")) |
243 | |
244 | ########################################## |
245 | ## UI Options needed after config files ## |
246 | ########################################## |
247 | |
248 | - # TODO: is_iso function is locally used to see if the url is indeed one or not. Could be used by the front-end |
249 | + # TODO: is_iso function is locally used to see if the url is indeed one |
250 | + # or not. Could be used by the front-end |
251 | # Process the rest of the options |
252 | if opt.url: |
253 | hasOptions = True |
254 | @@ -281,7 +326,8 @@ |
255 | td.ISO_URL = "file:///dev/null" |
256 | elif is_cloud_img(opt.url): |
257 | if td.VIRT != 'kvm': |
258 | - error(_("Launching Cloud images only works with KVM. Please switch your virtualization method...")) |
259 | + error(_("Launching Cloud images only works with KVM. Please " |
260 | + "switch your virtualization method...")) |
261 | td.p = 'cloud-daily' |
262 | if opt.curses: |
263 | td.KVM_ARGS = td.KVM_ARGS + ' -curses' |
264 | @@ -297,7 +343,7 @@ |
265 | else: |
266 | DESKTOP = 0 |
267 | |
268 | - # Hardcoded release codename from executable. Overrides value in config file |
269 | + # Hardcoded release codename from executable. Override value in config file |
270 | if opt.release: |
271 | hasOptions = True |
272 | td.r = opt.release |
273 | @@ -323,20 +369,24 @@ |
274 | ## Obtain Release Codename from ISO cache ## |
275 | ################################################# |
276 | |
277 | - # Verify if the ISO list is cached, if not, set variable to update/create it. |
278 | + # Verify if the ISO list is cached, if not, |
279 | + # set variable to update/create it |
280 | if td.is_iso_list_cached() is False: |
281 | update_cache = 1 |
282 | - # If ISO list is cached, verify if it is expired. If it is, set variable to update it. |
283 | + # If ISO list is cached, verify if it is expired. |
284 | + # If it is, set variable to update it. |
285 | elif td.is_iso_list_cache_expired() is True: |
286 | update_cache = 1 |
287 | |
288 | - # If variable set to update, obtain the ISO list from the Ubuntu CD Image repository. |
289 | + # If variable set to update, obtain the ISO list |
290 | + # from the Ubuntu CD Image repository. |
291 | if update_cache == 1: |
292 | logger.info(_("Obtaining Ubuntu ISO list from %s...") % td.u) |
293 | try: |
294 | cdimage = td.obtain_ubuntu_iso_list_from_repo() |
295 | except: |
296 | - error(_("ERROR: Could not obtain the Ubuntu ISO list from %s...") % td.u) |
297 | + error(_("ERROR: Could not obtain the Ubuntu ISO list from %s..." |
298 | + ) % td.u) |
299 | # If the ISO List was obtained, update the cache fle |
300 | if cdimage: |
301 | try: |
302 | @@ -374,12 +424,14 @@ |
303 | if cmd == 1: |
304 | error(_("Unsupported protocol [%s]") % td.PROTO) |
305 | if td.PROTO != 'file' and td.PROTO != 'rsync': |
306 | - if run("wget --spider -S %s 2>&1 | grep 'HTTP/1.. 200 OK'" % td.ISO_URL) != 0: |
307 | + if run("wget --spider -S %s 2>&1 | grep 'HTTP/1.. 200 OK'" |
308 | + % td.ISO_URL) != 0: |
309 | error(_("ISO not found at [%s]") % td.ISO_URL) |
310 | if cmd != 0: |
311 | run_or_die(cmd) |
312 | if td.p == 'cloud-daily' or td.p == 'cloud-releases': |
313 | - logger.info("Preparing Cloud image [%s]" % os.path.basename(td.PATH_TO_ISO).split("_")[-1]) |
314 | + logger.info("Preparing Cloud image [%s]" % os.path.basename( |
315 | + td.PATH_TO_ISO).split("_")[-1]) |
316 | td.prepare_cloud_img_tarball() |
317 | |
318 | ########################## |
319 | @@ -428,12 +480,15 @@ |
320 | logger.info(_("You may wish to clean up the cache directory...")) |
321 | print(_(" %s and %s") % (td.CACHE_ISO, td.CACHE_IMG)) |
322 | #run("ls -HhalF %s %s" % (CACHE_ISO, CACHE_IMG)) |
323 | - #run("du -sh --apparent-size %s %s 2>/dev/null || du -sh %s %s" % (CACHE_ISO, CACHE_IMG)) |
324 | + #run("du -sh --apparent-size %s %s 2>/dev/null || \ |
325 | + #du -sh %s %s" % (CACHE_ISO, CACHE_IMG)) |
326 | |
327 | # Launch Desktop |
328 | if DESKTOP == 1: |
329 | - if os.path.exists("/usr/bin/usb-creator-gtk") or os.path.exists("/usr/bin/usb-creator-kde"): |
330 | - input = raw_input(_("\nLaunch USB Startup Disk Creator for further testing of this ISO? [y/N] ")) |
331 | + if os.path.exists("/usr/bin/usb-creator-gtk") or \ |
332 | + os.path.exists("/usr/bin/usb-creator-kde"): |
333 | + input = raw_input(_("\nLaunch USB Startup Disk Creator for " |
334 | + "further testing of this ISO? [y/N] ")) |
335 | if input == "y" or input == "Y": |
336 | td.launch_usb_creator() |
337 | else: |
338 | |
339 | === modified file 'bin/testdrive-gtk' |
340 | --- bin/testdrive-gtk 2013-08-10 20:52:38 +0000 |
341 | +++ bin/testdrive-gtk 2013-10-06 20:59:44 +0000 |
342 | @@ -2,20 +2,20 @@ |
343 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
344 | ### BEGIN LICENSE |
345 | # Copyright (C) 2010 Canonical Ltd. |
346 | -# |
347 | +# |
348 | # Authors: |
349 | # Andres Rodriguez <andreserl@ubuntu.com> |
350 | -# |
351 | -# This program is free software: you can redistribute it and/or modify it |
352 | -# under the terms of the GNU General Public License version 3, as published |
353 | +# |
354 | +# This program is free software: you can redistribute it and/or modify it |
355 | +# under the terms of the GNU General Public License version 3, as published |
356 | # by the Free Software Foundation. |
357 | -# |
358 | -# This program is distributed in the hope that it will be useful, but |
359 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
360 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
361 | +# |
362 | +# This program is distributed in the hope that it will be useful, but |
363 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
364 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
365 | # PURPOSE. See the GNU General Public License for more details. |
366 | -# |
367 | -# You should have received a copy of the GNU General Public License along |
368 | +# |
369 | +# You should have received a copy of the GNU General Public License along |
370 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
371 | ### END LICENSE |
372 | |
373 | @@ -25,28 +25,30 @@ |
374 | import time |
375 | |
376 | import gettext |
377 | -from gettext import gettext as _ |
378 | +_ = gettext.gettext |
379 | gettext.textdomain('testdrive') |
380 | |
381 | from testdrive import testdrive |
382 | from testdrive.virt import kvm, parallels, virtualbox |
383 | -import threading, subprocess, commands |
384 | -import random |
385 | +import threading |
386 | +import subprocess |
387 | +import commands |
388 | +#import random |
389 | import re |
390 | |
391 | gtk.gdk.threads_init() |
392 | |
393 | TAB_LABEL = [] |
394 | -TAB_LABEL.append({"dist":"ubuntu", "label":"Ubuntu"}) |
395 | -TAB_LABEL.append({"dist":"kubuntu", "label":"Kubuntu"}) |
396 | -TAB_LABEL.append({"dist":"xubuntu", "label":"Xubuntu"}) |
397 | -TAB_LABEL.append({"dist":"ubuntu-server", "label":"Server"}) |
398 | -TAB_LABEL.append({"dist":"edubuntu", "label":"Edubuntu"}) |
399 | -TAB_LABEL.append({"dist":"mythbuntu", "label":"Mythbuntu"}) |
400 | -TAB_LABEL.append({"dist":"ubuntustudio", "label":"Ubuntu Studio"}) |
401 | -TAB_LABEL.append({"dist":"lubuntu", "label":"Lubuntu"}) |
402 | -TAB_LABEL.append({"dist":"ubuntukylin", "label":"UbuntuKylin"}) |
403 | -TAB_LABEL.append({"dist":"other", "label":_("Other")}) |
404 | +TAB_LABEL.append({"dist": "ubuntu", "label": "Ubuntu"}) |
405 | +TAB_LABEL.append({"dist": "kubuntu", "label": "Kubuntu"}) |
406 | +TAB_LABEL.append({"dist": "xubuntu", "label": "Xubuntu"}) |
407 | +TAB_LABEL.append({"dist": "ubuntu-server", "label": "Server"}) |
408 | +TAB_LABEL.append({"dist": "edubuntu", "label": "Edubuntu"}) |
409 | +TAB_LABEL.append({"dist": "mythbuntu", "label": "Mythbuntu"}) |
410 | +TAB_LABEL.append({"dist": "ubuntustudio", "label": "Ubuntu Studio"}) |
411 | +TAB_LABEL.append({"dist": "lubuntu", "label": "Lubuntu"}) |
412 | +TAB_LABEL.append({"dist": "ubuntukylin", "label": "UbuntuKylin"}) |
413 | +TAB_LABEL.append({"dist": "other", "label": _("Other")}) |
414 | |
415 | global ISOLIST |
416 | |
417 | @@ -57,9 +59,9 @@ |
418 | os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0])))) |
419 | |
420 | if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'testdrivegtk')) |
421 | - and PROJECT_ROOT_DIRECTORY not in sys.path): |
422 | + and PROJECT_ROOT_DIRECTORY not in sys.path): |
423 | sys.path.insert(0, PROJECT_ROOT_DIRECTORY) |
424 | - os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses |
425 | + os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses |
426 | |
427 | try: |
428 | import pynotify |
429 | @@ -70,7 +72,8 @@ |
430 | notifications_available = False |
431 | |
432 | from testdrivegtk import ( |
433 | - AboutTestdrivegtkDialog, PreferencesTestdrivegtkDialog, AddOtherTestdrivegtkDialog) |
434 | + AboutTestdrivegtkDialog, PreferencesTestdrivegtkDialog, |
435 | + AddOtherTestdrivegtkDialog) |
436 | from testdrivegtk.helpers import get_builder |
437 | |
438 | try: |
439 | @@ -93,7 +96,7 @@ |
440 | class TestdrivegtkWindow(gtk.Window): |
441 | __gtype_name__ = "TestdrivegtkWindow" |
442 | |
443 | - # To construct a new instance of this method, the following notable |
444 | + # To construct a new instance of this method, the following notable |
445 | # methods are called in this order: |
446 | # __new__(cls) |
447 | # __init__(self) |
448 | @@ -104,7 +107,7 @@ |
449 | # your inialization code in finish_intializing |
450 | |
451 | def __new__(cls): |
452 | - """Special static method that's automatically called by Python when |
453 | + """Special static method that's automatically called by Python when |
454 | constructing a new instance of this class. |
455 | |
456 | Returns a fully instantiated TestdrivegtkWindow object. |
457 | @@ -166,8 +169,10 @@ |
458 | self.application_indicator_menu() |
459 | |
460 | def application_indicator_menu(self): |
461 | - self.appindicator = appindicator.Indicator ("testdrive", "indicator-messages", appindicator.CATEGORY_APPLICATION_STATUS) |
462 | - self.appindicator.set_status (appindicator.STATUS_PASSIVE) |
463 | + self.appindicator = appindicator.Indicator( |
464 | + "testdrive", "indicator-messages", |
465 | + appindicator.CATEGORY_APPLICATION_STATUS) |
466 | + self.appindicator.set_status(appindicator.STATUS_PASSIVE) |
467 | #self.appindicator.set_icon("testdrive-indicator") |
468 | self.appindicator.set_icon("testdrive-attention") |
469 | #self.appindicator.set_attention_icon("distributor-logo") |
470 | @@ -175,7 +180,8 @@ |
471 | # create a menu |
472 | self.app_indicator_menu = gtk.Menu() |
473 | |
474 | - # create items for the menu - labels, checkboxes, radio buttons and images are supported: |
475 | + # create items for the menu - labels, checkboxes, |
476 | + # radio buttons and images are supported: |
477 | item = gtk.MenuItem("Pre-release available for testing!") |
478 | item.connect("activate", self.on_indicator_message_clicked, item) |
479 | item.show() |
480 | @@ -189,8 +195,10 @@ |
481 | self.app_indicator_menu.show() |
482 | self.appindicator.set_menu(self.app_indicator_menu) |
483 | |
484 | - gobject.timeout_add_seconds(self.timea, self.on_check_qa_releases_available, self.timea) |
485 | - gobject.timeout_add_seconds(self.timeb, self.on_check_qa_releases_available, self.timeb) |
486 | + gobject.timeout_add_seconds( |
487 | + self.timea, self.on_check_qa_releases_available, self.timea) |
488 | + gobject.timeout_add_seconds( |
489 | + self.timeb, self.on_check_qa_releases_available, self.timeb) |
490 | |
491 | # Initializes the indicator |
492 | def messaging_indicator_menu(self): |
493 | @@ -204,25 +212,34 @@ |
494 | |
495 | # Initializes the Indicator |
496 | self.indicator = indicate.Indicator() |
497 | - self.indicator.set_property("name", "Pre-release available for testing!") |
498 | + self.indicator.set_property( |
499 | + "name", "Pre-release available for testing!") |
500 | self.indicator.set_property_time("time", time.time()) |
501 | #indicator.show() |
502 | |
503 | - self.indicator.connect("user-display", self.on_indicator_message_clicked) |
504 | + self.indicator.connect( |
505 | + "user-display", self.on_indicator_message_clicked) |
506 | |
507 | # Checks every 3600 seconds - hour - (If TestDrive is open that long) |
508 | - gobject.timeout_add_seconds(self.timea, self.on_check_qa_releases_available, self.timea) |
509 | - gobject.timeout_add_seconds(self.timeb, self.on_check_qa_releases_available, self.timeb) |
510 | + gobject.timeout_add_seconds( |
511 | + self.timea, self.on_check_qa_releases_available, self.timea) |
512 | + gobject.timeout_add_seconds( |
513 | + self.timeb, self.on_check_qa_releases_available, self.timeb) |
514 | |
515 | - # Checks for the availability of ISOs at iso.qa.ubuntu.com and displays notification if so. |
516 | + # Checks for the availability of ISOs at iso.qa.ubuntu.com |
517 | + # and displays notification if so. |
518 | def on_check_qa_releases_available(self, time): |
519 | output = "" |
520 | if self.notified is True: |
521 | return False |
522 | - logging.info(_("Checking available ISOs at the ISO tracker [http://iso.qa.ubuntu.com] every %s seconds") % time) |
523 | + logging.info(_("Checking available ISOs at the ISO tracker " |
524 | + "[http://iso.qa.ubuntu.com] every %s seconds") % time) |
525 | try: |
526 | - #(status, output) = commands.getstatusoutput("wget -q -O- http://iso.qa.ubuntu.com/qatracker/dllist") |
527 | - (status, output) = commands.getstatusoutput("wget -q -O- http://iso.qa.ubuntu.com/qatracker | egrep 'iso.qa.ubuntu.com/qatracker/test'") |
528 | + #(status, output) = commands.getstatusoutput( |
529 | + # "wget -q -O- http://iso.qa.ubuntu.com/qatracker/dllist") |
530 | + (status, output) = commands.getstatusoutput( |
531 | + "wget -q -O- http://iso.qa.ubuntu.com/qatracker | egrep " |
532 | + "'iso.qa.ubuntu.com/qatracker/test'") |
533 | except: |
534 | logging.error(_("Unable to check the ISO tracker")) |
535 | |
536 | @@ -231,7 +248,9 @@ |
537 | global notifications_available |
538 | if notifications_available: |
539 | # Notification |
540 | - self.notification = pynotify.Notification("TestDrive an Ubuntu ISO!", "Pre-release available for testing!", imageURI) |
541 | + self.notification = pynotify.Notification( |
542 | + "TestDrive an Ubuntu ISO!", |
543 | + "Pre-release available for testing!", imageURI) |
544 | self.notification.show() |
545 | global message_indicator |
546 | if message_indicator: |
547 | @@ -248,7 +267,8 @@ |
548 | |
549 | return True |
550 | |
551 | - # Click event for Indicator: Opens website when the notification is being clicked. |
552 | + # Click event for Indicator: |
553 | + # Opens website when the notification is being clicked. |
554 | def on_indicator_message_clicked(self, indicator, timestamp): |
555 | webbrowser.open("http://iso.qa.ubuntu.com/") |
556 | if message_indicator: |
557 | @@ -287,8 +307,10 @@ |
558 | |
559 | # Obtain preferences |
560 | td = prefs.get_preferences() |
561 | - # If Repo (p), Release, Arch (m), Flavor, or ISO CACHE are different, then, regenerate the UI |
562 | - if self.td.p != td.p or self.td.r != td.r or self.td.m != td.m or self.td.f != td.f or self.td.CACHE_ISO != td.CACHE_ISO: |
563 | + # If Repo (p), Release, Arch (m), Flavor, or ISO CACHE are |
564 | + # different, then, regenerate the UI |
565 | + if self.td.p != td.p or self.td.r != td.r or self.td.m != td.m or \ |
566 | + self.td.f != td.f or self.td.CACHE_ISO != td.CACHE_ISO: |
567 | ui_recreate = True |
568 | # Update preferences |
569 | self.td = td |
570 | @@ -302,7 +324,8 @@ |
571 | |
572 | def new_other_iso(self, widget, data=None): |
573 | """Display Add Other ISO dialog""" |
574 | - other = AddOtherTestdrivegtkDialog.AddOtherTestdrivegtkDialog(self.td.CACHE) |
575 | + other = AddOtherTestdrivegtkDialog.AddOtherTestdrivegtkDialog( |
576 | + self.td.CACHE) |
577 | other.set_title(_("Add an ISO to TestDrive")) |
578 | response = other.run() |
579 | if response == gtk.RESPONSE_OK: |
580 | @@ -319,9 +342,10 @@ |
581 | ################################################################### |
582 | |
583 | if commands.getstatusoutput("which testdrive")[0] != 0: |
584 | - self.on_error_dialog( _("Unable to open because 'testdrive' is not installed.\n" |
585 | - "Please install testdrive: \n\n" |
586 | - "sudo apt-get install testdrive-cli")) |
587 | + self.on_error_dialog(_("Unable to open because 'testdrive' " |
588 | + "is not installed.\n" |
589 | + "Please install testdrive: \n\n" |
590 | + "sudo apt-get install testdrive-cli")) |
591 | return |
592 | title = _("TestDrive an ISO or Disk Image") |
593 | filename = None |
594 | @@ -329,15 +353,19 @@ |
595 | testdrives.add_pattern("*.iso") |
596 | testdrives.add_pattern("*.img") |
597 | |
598 | - chooser = gtk.FileChooserDialog(title,action=gtk.FILE_CHOOSER_ACTION_SAVE, |
599 | - buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)) |
600 | + chooser = gtk.FileChooserDialog( |
601 | + title, action=gtk.FILE_CHOOSER_ACTION_SAVE, |
602 | + buttons=( |
603 | + gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, |
604 | + gtk.STOCK_OPEN, gtk.RESPONSE_OK)) |
605 | chooser.add_filter(testdrives) |
606 | # Run Chooser Dialog |
607 | response = chooser.run() |
608 | |
609 | if response == gtk.RESPONSE_OK: |
610 | filename = chooser.get_filename() |
611 | - subprocess.Popen(['testdrive', '-u', filename], stdout=subprocess.PIPE) |
612 | + subprocess.Popen([ |
613 | + 'testdrive', '-u', filename], stdout=subprocess.PIPE) |
614 | pass |
615 | chooser.destroy() |
616 | |
617 | @@ -350,31 +378,31 @@ |
618 | # Clean up code for saving application state should be added here. |
619 | # Stop all the syncs and launched ISOs |
620 | for t in self.isos_to_run: |
621 | - if t[0] != None: |
622 | + if t[0] is not None: |
623 | t[0].stop() |
624 | - if t[1] != None: |
625 | + if t[1] is not None: |
626 | t[1].stop() |
627 | # Class function to cleanup the IMG Cache |
628 | self.cleanup_img_cache() |
629 | gtk.main_quit() |
630 | |
631 | def on_warn_dialog(self, data=None): |
632 | - warnbox = gtk.MessageDialog(self, |
633 | - gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING, |
634 | + warnbox = gtk.MessageDialog( |
635 | + self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING, |
636 | gtk.BUTTONS_CLOSE, data) |
637 | warnbox.run() |
638 | warnbox.destroy() |
639 | |
640 | def on_error_dialog(self, data=None): |
641 | - errorbox = gtk.MessageDialog(self, |
642 | - gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, |
643 | + errorbox = gtk.MessageDialog( |
644 | + self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, |
645 | gtk.BUTTONS_CLOSE, data) |
646 | errorbox.run() |
647 | errorbox.destroy() |
648 | |
649 | def on_info_dialog(self, data=None): |
650 | - infobox = gtk.MessageDialog(self, |
651 | - gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, |
652 | + infobox = gtk.MessageDialog( |
653 | + self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, |
654 | gtk.BUTTONS_CLOSE, data) |
655 | infobox.run() |
656 | infobox.destroy() |
657 | @@ -387,7 +415,8 @@ |
658 | imagelist = os.listdir(self.td.CACHE_IMG) |
659 | for disk in imagelist: |
660 | path = "%s/%s" % (self.td.CACHE_IMG, disk) |
661 | - (status, output) = commands.getstatusoutput("file %s | grep -qs 'empty'" % path) |
662 | + (status, output) = commands.getstatusoutput( |
663 | + "file %s | grep -qs 'empty'" % path) |
664 | if status == 0: |
665 | os.unlink(path) |
666 | for disk in self.isos_to_run: |
667 | @@ -401,7 +430,8 @@ |
668 | logging.info(_("Obtaining the sync protocol for the specified ISO...")) |
669 | cmd = self.td.get_proto() |
670 | if cmd == 1: |
671 | - self.on_error_dialog(_("Unsupported protocol [%s]") % self.td.PROTO) |
672 | + self.on_error_dialog(_( |
673 | + "Unsupported protocol [%s]") % self.td.PROTO) |
674 | if cmd != 0: |
675 | return cmd |
676 | return False |
677 | @@ -416,18 +446,22 @@ |
678 | if not self.td.VIRT: |
679 | self.td.VIRT = self.td.get_virt() |
680 | if self.td.VIRT == 1: |
681 | - logging.error(_("Your CPU supports KVM acceleration; please install KVM")) |
682 | - self.on_warn_dialog( _("Your CPU supports KVM acceleration; please install KVM:" |
683 | - "\n\n" |
684 | - "sudo apt-get install qemu-kvm")) |
685 | + logging.error(_("Your CPU supports KVM acceleration; " |
686 | + "please install KVM")) |
687 | + self.on_warn_dialog(_("Your CPU supports KVM acceleration; " |
688 | + "please install KVM:" |
689 | + "\n\n" |
690 | + "sudo apt-get install qemu-kvm")) |
691 | if self.td.VIRT == 0: |
692 | - logging.error(_("Your CPU does not support acceleration; run kvm-ok for more information; then install VBox")) |
693 | - self.on_warn_dialog( _("Your CPU does not support acceleration; run kvm-ok for more information;\n" |
694 | - "then please install VirtualBox" |
695 | - "\n\n" |
696 | - "kvm-ok" |
697 | - "\n" |
698 | - "sudo apt-get install virtualbox")) |
699 | + logging.error(_("Your CPU does not support acceleration; " |
700 | + "run kvm-ok for more information; then install VBox")) |
701 | + self.on_warn_dialog(_("Your CPU does not support acceleration; " |
702 | + "run kvm-ok for more information;\n" |
703 | + "then please install VirtualBox" |
704 | + "\n\n" |
705 | + "kvm-ok" |
706 | + "\n" |
707 | + "sudo apt-get install virtualbox")) |
708 | |
709 | def obtain_isos_list(self): |
710 | ################################################################### |
711 | @@ -439,8 +473,10 @@ |
712 | try: |
713 | isos = self.td.get_ubuntu_iso_list() |
714 | except: |
715 | - logging.error(_("Unable to retrieve the Ubuntu ISO list from cache...")) |
716 | - self.on_error_dialog(_("Unable to retrieve the Ubuntu ISO list from cache...")) |
717 | + logging.error(_( |
718 | + "Unable to retrieve the Ubuntu ISO list from cache...")) |
719 | + self.on_error_dialog(_( |
720 | + "Unable to retrieve the Ubuntu ISO list from cache...")) |
721 | return [] |
722 | return isos |
723 | |
724 | @@ -461,12 +497,14 @@ |
725 | # Processing ISOS from file into ISO list |
726 | for iso in ISOS: |
727 | category = iso.split()[0] |
728 | - distro = iso.split()[1] #This will be the distro showed instead of arch |
729 | + #This will be the distro showed instead of arch |
730 | + distro = iso.split()[1] |
731 | url = iso.split()[2] |
732 | if url.partition("://")[0] == "wget": |
733 | url = url.replace('wget', 'http') |
734 | name = iso.split()[3] |
735 | - ISO.append({"name":name, "url":url, "arch":distro, "category":category}) |
736 | + ISO.append({"name": name, "url": url, |
737 | + "arch": distro, "category": category}) |
738 | return ISO |
739 | |
740 | def on_distro_tab_change(self, widget, none=None, current_page=None): |
741 | @@ -491,7 +529,7 @@ |
742 | self.create_iso_menu(ISO) |
743 | self.update_status_bar() |
744 | |
745 | - def create_iso_menu(self, iso_list = None): |
746 | + def create_iso_menu(self, iso_list=None): |
747 | ################################################################### |
748 | ############ Creates all the Distro Tabs and the ISO's ############ |
749 | ################################################################### |
750 | @@ -542,7 +580,7 @@ |
751 | vbox = gtk.VBox() |
752 | scroll.add_with_viewport(vbox) |
753 | scroll.get_children()[0].set_shadow_type(gtk.SHADOW_NONE) |
754 | - scroll.set_policy(gtk.POLICY_NEVER,gtk.POLICY_AUTOMATIC) |
755 | + scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) |
756 | scroll.show() |
757 | for arch in self.td.m: |
758 | c = 0 |
759 | @@ -555,30 +593,45 @@ |
760 | if iso['category'] == dist and iso['arch'] == arch: |
761 | c = c + 1 |
762 | table = gtk.Table(2, 3, False) |
763 | - lb_iso_name = gtk.CheckButton("%s - (%s)" % (iso["name"], self.td.r)) |
764 | + lb_iso_name = gtk.CheckButton("%s - (%s)" % ( |
765 | + iso["name"], self.td.r)) |
766 | lb_iso_name.show() |
767 | filename = os.path.basename(iso["url"]) |
768 | - path = "%s/%s_%s" % (self.td.CACHE_ISO, iso["category"], filename) |
769 | + path = "%s/%s_%s" % (self.td.CACHE_ISO, |
770 | + iso["category"], filename) |
771 | if os.path.exists(path): |
772 | - lb_cache = gtk.Label(_("<i> CACHE: [%s]</i>") % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(path))))) |
773 | + lb_cache = gtk.Label(_( |
774 | + "<i> CACHE: [%s]</i>") % (time.strftime( |
775 | + "%Y-%m-%d %H:%M:%S", time.localtime( |
776 | + os.path.getmtime(path))))) |
777 | else: |
778 | - lb_cache = gtk.Label(_("<i> CACHE: [empty]</i>")) |
779 | + lb_cache = gtk.Label(_( |
780 | + "<i> CACHE: [empty]</i>")) |
781 | lb_cache.set_use_markup(True) |
782 | # To align to righ otherwise it is centered |
783 | - lb_cache.set_alignment(0,0) |
784 | + lb_cache.set_alignment(0, 0) |
785 | lb_cache.show() |
786 | # Adding the Spiiner |
787 | spin = gtk.Spinner() |
788 | - spin.set_size_request(18, -1); |
789 | + spin.set_size_request(18, -1) |
790 | spin.hide() |
791 | - #lb_iso_name.connect("clicked", self.on_select_iso_clicked, spin, lb_cache, iso["url"], iso["category"], vm_id) |
792 | - lb_iso_name.connect("clicked", self.on_select_iso_clicked, vm_id) |
793 | - ISOLIST.append({"vm_id":vm_id, "url":iso["url"], "prefix":iso["category"], "spinner":spin, "lb_status":lb_cache}) |
794 | + #lb_iso_name.connect( |
795 | + # "clicked", self.on_select_iso_clicked, spin, |
796 | + # lb_cache, iso["url"], iso["category"], vm_id) |
797 | + lb_iso_name.connect( |
798 | + "clicked", self.on_select_iso_clicked, vm_id) |
799 | + ISOLIST.append({"vm_id": vm_id, "url": iso["url"], |
800 | + "prefix": iso["category"], "spinner": |
801 | + spin, "lb_status": lb_cache}) |
802 | vm_id += 1 |
803 | - table.attach(lb_iso_name, 0, 3, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND) |
804 | - table.attach(spin, 0, 1, 1, 2, gtk.FILL, gtk.FILL | gtk.EXPAND) |
805 | - table.attach(lb_cache, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 5) |
806 | - #table.attach(lb_progress, 2, 3, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND) |
807 | + table.attach(lb_iso_name, 0, 3, 0, 1, gtk.FILL | |
808 | + gtk.EXPAND, gtk.FILL | gtk.EXPAND) |
809 | + table.attach(spin, 0, 1, 1, 2, gtk.FILL, |
810 | + gtk.FILL | gtk.EXPAND) |
811 | + table.attach(lb_cache, 1, 2, 1, 2, gtk.FILL | |
812 | + gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 5) |
813 | + #table.attach(lb_progress, 2, 3, 1, 2, gtk.FILL | |
814 | + # gtk.EXPAND, gtk.FILL | gtk.EXPAND) |
815 | table.show() |
816 | viewport = gtk.Viewport() |
817 | viewport.add(table) |
818 | @@ -593,27 +646,42 @@ |
819 | lb_iso_name = gtk.CheckButton("%s" % iso["name"]) |
820 | lb_iso_name.show() |
821 | filename = os.path.basename(iso["url"]) |
822 | - path = "%s/%s_%s" % (self.td.CACHE_ISO, iso["category"], filename) |
823 | + path = "%s/%s_%s" % (self.td.CACHE_ISO, |
824 | + iso["category"], filename) |
825 | if os.path.exists(path): |
826 | - lb_cache = gtk.Label(_("<i> CACHE: [%s]</i>") % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(path))))) |
827 | + lb_cache = gtk.Label(_("<i> CACHE: [%s]</i>") |
828 | + % (time.strftime("%Y-%m-%d %H" |
829 | + ":%M:%S", time.localtime( |
830 | + os.path.getmtime(path))))) |
831 | else: |
832 | - lb_cache = gtk.Label(_("<i> CACHE: [empty]</i>")) |
833 | + lb_cache = gtk.Label(_( |
834 | + "<i> CACHE: [empty]</i>")) |
835 | lb_cache.set_use_markup(True) |
836 | - # To align to righ otherwise it is centered |
837 | - lb_cache.set_alignment(0,0) |
838 | + # To align to right otherwise it is centered |
839 | + lb_cache.set_alignment(0, 0) |
840 | lb_cache.show() |
841 | # Adding the Spiiner |
842 | spin = gtk.Spinner() |
843 | - spin.set_size_request(18, -1); |
844 | + spin.set_size_request(18, -1) |
845 | spin.hide() |
846 | - #lb_iso_name.connect("clicked", self.on_select_iso_clicked, spin, lb_cache, iso["url"], iso["category"], vm_id) |
847 | - lb_iso_name.connect("clicked", self.on_select_iso_clicked, vm_id) |
848 | - ISOLIST.append({"vm_id":vm_id, "url":iso["url"], "prefix":iso["category"], "spinner":spin, "lb_status":lb_cache}) |
849 | + #lb_iso_name.connect("clicked", |
850 | + # self.on_select_iso_clicked, spin, |
851 | + # lb_cache, iso["url"], |
852 | + # iso["category"], vm_id) |
853 | + lb_iso_name.connect("clicked", |
854 | + self.on_select_iso_clicked, vm_id) |
855 | + ISOLIST.append({"vm_id": vm_id, "url": iso["url"], |
856 | + "prefix": iso["category"], "spinner": |
857 | + spin, "lb_status": lb_cache}) |
858 | vm_id += 1 |
859 | - table.attach(lb_iso_name, 0, 3, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND) |
860 | - table.attach(spin, 0, 1, 1, 2, gtk.FILL, gtk.FILL | gtk.EXPAND) |
861 | - table.attach(lb_cache, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 5) |
862 | - #table.attach(lb_progress, 2, 3, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND) |
863 | + table.attach(lb_iso_name, 0, 3, 0, 1, gtk.FILL | |
864 | + gtk.EXPAND, gtk.FILL | gtk.EXPAND) |
865 | + table.attach(spin, 0, 1, 1, 2, gtk.FILL, |
866 | + gtk.FILL | gtk.EXPAND) |
867 | + table.attach(lb_cache, 1, 2, 1, 2, gtk.FILL | |
868 | + gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 5) |
869 | + #table.attach(lb_progress, 2, 3, 1, 2, gtk.FILL | |
870 | + # gtk.EXPAND, gtk.FILL | gtk.EXPAND) |
871 | table.show() |
872 | viewport = gtk.Viewport() |
873 | viewport.add(table) |
874 | @@ -625,10 +693,12 @@ |
875 | if c == 0: |
876 | if dist == 'other': |
877 | no_isos_label = gtk.Label() |
878 | - no_isos_label.set_markup(_("<b><i>There are no Other ISOs yet...</i></b>")) |
879 | + no_isos_label.set_markup(_("<b><i>There are no Other " |
880 | + "ISOs yet...</i></b>")) |
881 | else: |
882 | no_isos_label = gtk.Label() |
883 | - no_isos_label.set_markup(_("<b><i>There are no ISOs for this architecture yet...</i></b>")) |
884 | + no_isos_label.set_markup(_("<b><i>There are no ISOs " |
885 | + "for this architecture yet...</i></b>")) |
886 | no_isos_label.show() |
887 | vbox2.add(no_isos_label) |
888 | |
889 | @@ -637,7 +707,8 @@ |
890 | if dist != 'other': |
891 | fr_arch.add(vbox2) |
892 | fr_arch.show() |
893 | - vbox.pack_start(fr_arch, expand=False, fill=False, padding=0) |
894 | + vbox.pack_start( |
895 | + fr_arch, expand=False, fill=False, padding=0) |
896 | vbox.show() |
897 | else: |
898 | vbox.pack_start(vbox2, expand=False, fill=False, padding=0) |
899 | @@ -647,7 +718,8 @@ |
900 | # Create Tabs |
901 | for lb_iso_name in TAB_LABEL: |
902 | if dist == lb_iso_name["dist"]: |
903 | - self.notebook.append_page(scroll, gtk.Label(lb_iso_name["label"])) |
904 | + self.notebook.append_page( |
905 | + scroll, gtk.Label(lb_iso_name["label"])) |
906 | break |
907 | self.notebook.show() |
908 | |
909 | @@ -670,7 +742,8 @@ |
910 | |
911 | # Create Buttons |
912 | button = gtk.Button(_("Create USB Disk")) |
913 | - button.connect("clicked", self.on_create_iso_disk_clicked, 'Create Disk') |
914 | + button.connect( |
915 | + "clicked", self.on_create_iso_disk_clicked, 'Create Disk') |
916 | button.show() |
917 | bbox.pack_start(button) |
918 | |
919 | @@ -687,9 +760,12 @@ |
920 | |
921 | vbox.pack_start(bbox, True, True) |
922 | |
923 | - #def on_select_iso_clicked(self, widget, spin, status_label, url=None, iso_path_header=None, vm_id=None): |
924 | - #ISOLIST.append({"vm_id":vm_id, "url":iso["url"], "prefix":iso["category"], "spin":spin, "lb_status":lb_cache}) |
925 | - #lb_iso_name.connect("clicked", self.on_select_iso_clicked, spin, lb_cache, iso["url"], iso["category"], vm_id) |
926 | + #def on_select_iso_clicked(self, widget, spin, status_label, |
927 | + #url=None, iso_path_header=None, vm_id=None): |
928 | + #ISOLIST.append({"vm_id":vm_id, "url":iso["url"], |
929 | + #"prefix":iso["category"], "spin":spin, "lb_status":lb_cache}) |
930 | + #lb_iso_name.connect("clicked", self.on_select_iso_clicked, |
931 | + # spin, lb_cache, iso["url"], iso["category"], vm_id) |
932 | def on_select_iso_clicked(self, widget, vm_id): |
933 | ################################################################### |
934 | # When ISO is clicked, does the setup to be ready to launch/sync ## |
935 | @@ -704,7 +780,7 @@ |
936 | #ISOLIST[vm_id]["sync_cmd"] # Sync command used |
937 | #ISOLIST[vm_id]["vbox_name"] # Name for VBOX/Parallels |
938 | #ISOLIST[vm_id]["virt"] # Holds the Virt Object |
939 | - #ISOLIST[vm_id]["virt_type"] # Defines the type of virt (kvm, vbox, parallels) |
940 | + #ISOLIST[vm_id]["virt_type"] # Defines kvm, vbox, or parallels |
941 | |
942 | launch_cmd = None |
943 | sync_cmd = None |
944 | @@ -716,14 +792,15 @@ |
945 | self.td.set_launch_path() |
946 | |
947 | ISOLIST[vm_id]["path_to_iso"] = self.td.PATH_TO_ISO |
948 | - # TODO - This is a workaround to issue of zsync command. See testdrive.py 'cd '%s' && zsync etc etc' |
949 | + # TODO - This is a workaround to issue of zsync command. |
950 | + # See testdrive.py 'cd '%s' && zsync etc etc' |
951 | cmd = self.obtain_sync_protocol_cmd() |
952 | if self.td.PROTO == "zsync": |
953 | ISOLIST[vm_id]["sync_cmd"] = cmd.split("&&")[1].strip() |
954 | else: |
955 | ISOLIST[vm_id]["sync_cmd"] = cmd |
956 | |
957 | - if widget.get_active() == True: |
958 | + if widget.get_active() is True: |
959 | self.td.DISK_FILE = self.td.create_disk_file() |
960 | self.td.VBOX_NAME = "%s-%s" % (self.td.PKG, vm_id) |
961 | ISOLIST[vm_id]["vbox_name"] = self.td.VBOX_NAME |
962 | @@ -733,13 +810,16 @@ |
963 | |
964 | # Selecting virt method and Instancing VIRT object |
965 | if self.td.VIRT == "kvm": |
966 | - logging.info(_("Using KVM for virtual machine hosting...")) |
967 | + logging.info(_( |
968 | + "Using KVM for virtual machine hosting...")) |
969 | virt = kvm.KVM(self.td) |
970 | if self.td.VIRT == "virtualbox": |
971 | - logging.info(_("Using VirtualBox for virtual machine hosting...")) |
972 | + logging.info(_( |
973 | + "Using VirtualBox for virtual machine hosting...")) |
974 | virt = virtualbox.VBox(self.td) |
975 | if self.td.VIRT == "paralels": |
976 | - logging.info(_("Using Parallels Desktop for virtual machine hosting...")) |
977 | + logging.info(_( |
978 | + "Using Parallels Desktop for virtual machine hosting...")) |
979 | virt = parallels.Parallels(self.td) |
980 | |
981 | # Passing VIRT object to ISOLIST |
982 | @@ -749,9 +829,10 @@ |
983 | # Instancing Launch Thread |
984 | launch_thread = LaunchThread(vm_id) |
985 | |
986 | - self.isos_to_run.append([sync_thread, launch_thread, self.td.DISK_FILE, status]) |
987 | + self.isos_to_run.append([ |
988 | + sync_thread, launch_thread, self.td.DISK_FILE, status]) |
989 | |
990 | - if widget.get_active() == False: |
991 | + if not widget.get_active(): |
992 | for t in self.isos_to_run: |
993 | if t[0].command == ISOLIST[vm_id]["sync_cmd"]: |
994 | t[0].stop() |
995 | @@ -760,8 +841,8 @@ |
996 | self.td.delete_image() |
997 | self.isos_to_run.remove(t) |
998 | |
999 | - ############################################################################### |
1000 | - # TODO - TODO - TODO - Determine better method to stop des-selected ISO's |
1001 | + ####################################################################### |
1002 | + # TODO - Determine better method to stop des-selected ISO's |
1003 | """ |
1004 | if widget.get_active() == False: |
1005 | for t in self.isos_to_run: |
1006 | @@ -814,40 +895,44 @@ |
1007 | except: |
1008 | pass |
1009 | else: |
1010 | - logging.debug(_("launch_iso: Thread is executing or syncing...")) |
1011 | + logging.debug(_( |
1012 | + "launch_iso: Thread is executing or syncing...")) |
1013 | |
1014 | def on_create_iso_disk_clicked(self, widget, data=None): |
1015 | ################################################################### |
1016 | ############ Launches USB Creator for the selected ISO ############ |
1017 | ################################################################### |
1018 | if not self.isos_to_run: |
1019 | - self.on_error_dialog( _("No ISO has been selected." |
1020 | - "\n\n" |
1021 | - "Please select an ISO to create an USB Startup Disk.")) |
1022 | + self.on_error_dialog(_("No ISO has been selected." |
1023 | + "\n\n" |
1024 | + "Please select an ISO to create an " |
1025 | + "USB Startup Disk.")) |
1026 | return |
1027 | if len(self.isos_to_run) > 1: |
1028 | - self.on_error_dialog( _("More than 1 ISO has been selected." |
1029 | - "\n\n" |
1030 | - "Please select only 1 ISO to continue!")) |
1031 | + self.on_error_dialog(_("More than 1 ISO has been selected." |
1032 | + "\n\n" |
1033 | + "Please select only 1 ISO to continue!")) |
1034 | return |
1035 | if not os.path.exists(self.td.PATH_TO_ISO): |
1036 | - self.on_error_dialog( _("The specified ISO does not exist!" |
1037 | - "\n\n" |
1038 | - "Please, synchronize the ISO to continue.")) |
1039 | + self.on_error_dialog(_("The specified ISO does not exist!" |
1040 | + "\n\n" |
1041 | + "Please synchronize the ISO to continue.")) |
1042 | return |
1043 | try: |
1044 | - self.p = subprocess.Popen(["usb-creator-gtk", "-i", self.td.PATH_TO_ISO]) |
1045 | + self.p = subprocess.Popen(["usb-creator-gtk", "-i", |
1046 | + self.td.PATH_TO_ISO]) |
1047 | except: |
1048 | self.on_error_dialog(_("Unable to launch USB Creator!")) |
1049 | return |
1050 | |
1051 | + |
1052 | ################################################################### |
1053 | ########## Class that support threading for ISO Syncing ########### |
1054 | ################################################################### |
1055 | class SyncThread(threading.Thread): |
1056 | #def __init__(self, label, spinner, progress, cmd, url): |
1057 | def __init__(self, vm_id): |
1058 | - threading.Thread.__init__ (self) |
1059 | + threading.Thread.__init__(self) |
1060 | self.spin = ISOLIST[vm_id]["spinner"] |
1061 | self.status_label = ISOLIST[vm_id]["lb_status"] |
1062 | self.previous_text = self.status_label.get_text() |
1063 | @@ -859,16 +944,19 @@ |
1064 | |
1065 | def run(self): |
1066 | cmd = self.command.split() |
1067 | - self.p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines = True) |
1068 | + self.p = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
1069 | + universal_newlines=True) |
1070 | percent = re.compile(r'(\d+)%') |
1071 | self.status_label.show() |
1072 | self.spin.show() |
1073 | self.spin.start() |
1074 | - text = _(" Downloading %s (0%%)") % os.path.basename(self.url).partition("_")[2] |
1075 | - self.status_label.set_markup("<b><span size='10000'>%s</span></b>" % text) |
1076 | + text = _(" Downloading %s (0%%)") % os.path.basename( |
1077 | + self.url).partition("_")[2] |
1078 | + self.status_label.set_markup( |
1079 | + "<b><span size='10000'>%s</span></b>" % text) |
1080 | prev = None |
1081 | while not self.stopthread.isSet(): |
1082 | - if self.p.poll() != None: |
1083 | + if self.p.poll() is not None: |
1084 | self.update_status_label() |
1085 | self.p = None |
1086 | self.spin.stop() |
1087 | @@ -880,12 +968,14 @@ |
1088 | #gtk.gdk.threads_leave() |
1089 | line = self.p.stdout.readline(1024).strip() |
1090 | match = percent.search(line) |
1091 | - if match != None: |
1092 | + if match is not None: |
1093 | cur = match.group(1) |
1094 | if prev != cur: |
1095 | prev = match.group(1) |
1096 | - text = _(" Downloading %s (%s%%)") % (os.path.basename(self.url).partition("_")[2], prev) |
1097 | - self.status_label.set_markup("<b><span size='10000'>%s</span></b>" % text) |
1098 | + text = _(" Downloading %s (%s%%)") % (os.path.basename( |
1099 | + self.url).partition("_")[2], prev) |
1100 | + self.status_label.set_markup( |
1101 | + "<b><span size='10000'>%s</span></b>" % text) |
1102 | time.sleep(1) |
1103 | |
1104 | def stop(self): |
1105 | @@ -902,10 +992,13 @@ |
1106 | |
1107 | def update_status_label(self): |
1108 | if os.path.exists(self.url): |
1109 | - self.status_label.set_markup(_("<i> CACHE: [%s]</i>") % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(self.url))))) |
1110 | + self.status_label.set_markup(_("<i> CACHE: [%s]</i>") % ( |
1111 | + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime( |
1112 | + os.path.getmtime(self.url))))) |
1113 | else: |
1114 | self.status_label.set_markup(_("<i> CACHE: [empty]</i>")) |
1115 | |
1116 | + |
1117 | ################################################################### |
1118 | ########## Class that supports threading for VM Running ########### |
1119 | ################################################################### |
1120 | @@ -923,9 +1016,9 @@ |
1121 | self.p = None |
1122 | |
1123 | def prepare_to_launch_vm(self): |
1124 | - ################################################################### |
1125 | - ######## Prepare the VM to launch and return launch command ####### |
1126 | - ################################################################### |
1127 | + ############################################################### |
1128 | + ##### Prepare the VM to launch and return launch command ###### |
1129 | + ############################################################### |
1130 | # TODO TODO TODO - Re-add validation |
1131 | self.ovirt.validate_virt() |
1132 | self.ovirt.setup_virt() |
1133 | @@ -945,8 +1038,9 @@ |
1134 | |
1135 | if self.virt == 'kvm': |
1136 | while not self.stopthread.isSet(): |
1137 | - if self.p.poll() != None: |
1138 | - self.status_label.set_markup("<i>%s</i>" % self.previous_text) |
1139 | + if self.p.poll() is not None: |
1140 | + self.status_label.set_markup( |
1141 | + "<i>%s</i>" % self.previous_text) |
1142 | self.p = None |
1143 | break |
1144 | time.sleep(0.1) |
1145 | @@ -954,16 +1048,20 @@ |
1146 | elif self.virt == 'virtualbox': |
1147 | time.sleep(5) |
1148 | while not self.stopthread.isSet(): |
1149 | - if commands.getstatusoutput("VBoxManage list runningvms | grep -qs %s" % self.VBOX_NAME)[0] != 0: |
1150 | - self.status_label.set_markup("<i>%s</i>" % self.previous_text) |
1151 | + if commands.getstatusoutput("VBoxManage list runningvms | " |
1152 | + "grep -qs %s" % self.VBOX_NAME)[0] != 0: |
1153 | + self.status_label.set_markup("<i>%s</i>" |
1154 | + % self.previous_text) |
1155 | self.p = None |
1156 | break |
1157 | time.sleep(2) |
1158 | |
1159 | elif self.virt == 'parallels': |
1160 | while not self.stopthread.isSet(): |
1161 | - if commands.getstatusoutput("prlctl list %s | grep -qs stopped" % td.VBOX_NAME)[0] == 0: |
1162 | - self.status_label.set_markup("<i>%s</i>" % self.previous_text) |
1163 | + if commands.getstatusoutput("prlctl list %s | grep -qs stopped" |
1164 | + % td.VBOX_NAME)[0] == 0: |
1165 | + self.status_label.set_markup( |
1166 | + "<i>%s</i>" % self.previous_text) |
1167 | self.p = None |
1168 | break |
1169 | time.sleep(2) |
1170 | |
1171 | === modified file 'debian/changelog' |
1172 | --- debian/changelog 2013-09-28 02:34:10 +0000 |
1173 | +++ debian/changelog 2013-10-06 20:59:44 +0000 |
1174 | @@ -2,15 +2,13 @@ |
1175 | |
1176 | * Fixed VirtualBox PAE option bug. LP: #940755 |
1177 | Thanks Ben Blankley |
1178 | + * Follow pep8 standards |
1179 | + * debian/copyright: Add testdrivegtk/AddOtherTestdrivegtkDialog.py |
1180 | + * debian/control: Add working VCS fields |
1181 | + * debian/release.sh: Update current ubuntu release |
1182 | |
1183 | -- Jackson Doak <noskcaj@ubuntu.com> Sat, 28 Sep 2013 12:30:24 +1000 |
1184 | |
1185 | -testdrive (3.25) unreleased; urgency=low |
1186 | - |
1187 | - * UNRELEASED |
1188 | - |
1189 | - -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 27 Aug 2013 11:31:59 -0500 |
1190 | - |
1191 | testdrive (3.24-0ubuntu1) saucy; urgency=low |
1192 | |
1193 | [ Jackson Doak ] |
1194 | |
1195 | === modified file 'debian/control' |
1196 | --- debian/control 2013-08-27 16:23:53 +0000 |
1197 | +++ debian/control 2013-10-06 20:59:44 +0000 |
1198 | @@ -6,7 +6,8 @@ |
1199 | Build-Depends: debhelper (>= 9), gettext-base, python (>= 2.6.6-3~), python-distutils-extra (>= 2.10) |
1200 | X-Python-Version: >= 2.6 |
1201 | Homepage: http://launchpad.net/testdrive |
1202 | -Vcs-Bzr: http://bazaar.launchpad.net/~kirkland/testdrive/trunk |
1203 | +Vcs-Bzr: bzr://bazaar.launchpad.net/+branch/testdrive/ |
1204 | +Vcr-Browser: https://code.launchpad.net/~testdrive/testdrive/trunk |
1205 | |
1206 | Package: testdrive |
1207 | Architecture: all |
1208 | |
1209 | === modified file 'debian/copyright' |
1210 | --- debian/copyright 2013-08-13 06:10:36 +0000 |
1211 | +++ debian/copyright 2013-10-06 20:59:44 +0000 |
1212 | @@ -22,3 +22,8 @@ |
1213 | . |
1214 | On Debian systems, the complete text of the GNU General Public |
1215 | License, version 3, can be found in /usr/share/common-licenses/GPL-3. |
1216 | + |
1217 | +Files: testdrivegtk/AddOtherTestdrivegtkDialog.py |
1218 | +Copyright: Public domain |
1219 | +License: Public domain |
1220 | + This file is in the public domain |
1221 | |
1222 | === modified file 'debian/release.sh' |
1223 | --- debian/release.sh 2009-11-12 23:26:08 +0000 |
1224 | +++ debian/release.sh 2013-10-06 20:59:44 +0000 |
1225 | @@ -8,7 +8,7 @@ |
1226 | exit 1 |
1227 | } |
1228 | |
1229 | -head -n1 debian/changelog | grep "lucid" || error "This version must be ready for 'lucid'" |
1230 | +head -n1 debian/changelog | grep "saucy" || error "This version must be ready for 'saucy'" |
1231 | |
1232 | # Tag the release in bzr |
1233 | minor=`head -n1 debian/changelog | sed "s/^.*($MAJOR.//" | sed "s/-.*$//"` |
1234 | |
1235 | === modified file 'po/testdrive.pot' |
1236 | --- po/testdrive.pot 2013-08-10 21:31:38 +0000 |
1237 | +++ po/testdrive.pot 2013-10-06 20:59:44 +0000 |
1238 | @@ -8,7 +8,7 @@ |
1239 | msgstr "" |
1240 | "Project-Id-Version: PACKAGE VERSION\n" |
1241 | "Report-Msgid-Bugs-To: \n" |
1242 | -"POT-Creation-Date: 2013-08-11 07:31+1000\n" |
1243 | +"POT-Creation-Date: 2013-10-06 19:12+1100\n" |
1244 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
1245 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
1246 | "Language-Team: LANGUAGE <LL@li.org>\n" |
1247 | @@ -29,62 +29,63 @@ |
1248 | msgid "ISO;Testing;Ubuntu;Daily;VM;Virtual Machine;zsync;rsync;Testdrive" |
1249 | msgstr "" |
1250 | |
1251 | -#: ../bin/testdrive-gtk.py:49 |
1252 | +#: ../bin/testdrive-gtk.py:51 |
1253 | msgid "Other" |
1254 | msgstr "" |
1255 | |
1256 | #. ################################################################## |
1257 | #. ####### Obtaining the settings from the Preferences Class ######## |
1258 | #. ################################################################## |
1259 | -#: ../bin/testdrive-gtk.py:139 |
1260 | +#: ../bin/testdrive-gtk.py:142 |
1261 | msgid "Instancing Preferences..." |
1262 | msgstr "" |
1263 | |
1264 | -#: ../bin/testdrive-gtk.py:222 |
1265 | +#: ../bin/testdrive-gtk.py:235 |
1266 | #, python-format |
1267 | msgid "" |
1268 | -"Checking available ISOs at the ISO tracker [http://iso.qa.ubuntu.com] every " |
1269 | -"%s seconds" |
1270 | +"Checking available ISOs at the ISO tracker [http://" |
1271 | +"iso.qa.ubuntu.com] every %s seconds" |
1272 | msgstr "" |
1273 | |
1274 | -#: ../bin/testdrive-gtk.py:227 |
1275 | +#: ../bin/testdrive-gtk.py:244 |
1276 | msgid "Unable to check the ISO tracker" |
1277 | msgstr "" |
1278 | |
1279 | -#: ../bin/testdrive-gtk.py:265 |
1280 | +#: ../bin/testdrive-gtk.py:285 |
1281 | #, python-format |
1282 | msgid "<b>Release:</b> %s" |
1283 | msgstr "" |
1284 | |
1285 | -#: ../bin/testdrive-gtk.py:266 |
1286 | +#: ../bin/testdrive-gtk.py:286 |
1287 | #, python-format |
1288 | msgid "<b>ISO Repository:</b> http://%s.ubuntu.com/" |
1289 | msgstr "" |
1290 | |
1291 | -#: ../bin/testdrive-gtk.py:306 |
1292 | +#: ../bin/testdrive-gtk.py:329 |
1293 | msgid "Add an ISO to TestDrive" |
1294 | msgstr "" |
1295 | |
1296 | -#: ../bin/testdrive-gtk.py:322 |
1297 | +#: ../bin/testdrive-gtk.py:345 |
1298 | msgid "" |
1299 | -"Unable to open because 'testdrive' is not installed.\n" |
1300 | +"Unable to open because 'testdrive' is " |
1301 | +"not installed.\n" |
1302 | "Please install testdrive: \n" |
1303 | "\n" |
1304 | "sudo apt-get install testdrive-cli" |
1305 | msgstr "" |
1306 | |
1307 | -#: ../bin/testdrive-gtk.py:326 |
1308 | +#: ../bin/testdrive-gtk.py:350 |
1309 | msgid "TestDrive an ISO or Disk Image" |
1310 | msgstr "" |
1311 | |
1312 | #. ################################################################## |
1313 | #. ## Obtains the command for the Sync process based on Protocol #### |
1314 | #. ################################################################## |
1315 | -#: ../bin/testdrive-gtk.py:401 |
1316 | +#: ../bin/testdrive-gtk.py:430 |
1317 | msgid "Obtaining the sync protocol for the specified ISO..." |
1318 | msgstr "" |
1319 | |
1320 | -#: ../bin/testdrive-gtk.py:404 ../bin/testdrive.py:375 |
1321 | +#: ../bin/testdrive-gtk.py:434 ../bin/testdrive.py:425 |
1322 | #, python-format |
1323 | msgid "Unsupported protocol [%s]" |
1324 | msgstr "" |
1325 | @@ -93,30 +94,34 @@ |
1326 | #. #### Obtains the Virtualization Method, if not shows warnings #### |
1327 | #. ################################################################## |
1328 | #. Choose the virtualization engine |
1329 | -#: ../bin/testdrive-gtk.py:415 |
1330 | +#: ../bin/testdrive-gtk.py:445 |
1331 | msgid "Obtaining the virtualization method..." |
1332 | msgstr "" |
1333 | |
1334 | -#: ../bin/testdrive-gtk.py:419 |
1335 | -msgid "Your CPU supports KVM acceleration; please install KVM" |
1336 | +#: ../bin/testdrive-gtk.py:449 |
1337 | +msgid "" |
1338 | +"Your CPU supports KVM acceleration; please " |
1339 | +"install KVM" |
1340 | msgstr "" |
1341 | |
1342 | -#: ../bin/testdrive-gtk.py:420 |
1343 | +#: ../bin/testdrive-gtk.py:451 |
1344 | msgid "" |
1345 | -"Your CPU supports KVM acceleration; please install KVM:\n" |
1346 | +"Your CPU supports KVM acceleration; please " |
1347 | +"install KVM:\n" |
1348 | "\n" |
1349 | "sudo apt-get install qemu-kvm" |
1350 | msgstr "" |
1351 | |
1352 | -#: ../bin/testdrive-gtk.py:424 |
1353 | +#: ../bin/testdrive-gtk.py:456 |
1354 | msgid "" |
1355 | -"Your CPU does not support acceleration; run kvm-ok for more information; " |
1356 | -"then install VBox" |
1357 | +"Your CPU does not support acceleration; run kvm-ok " |
1358 | +"for more information; then install VBox" |
1359 | msgstr "" |
1360 | |
1361 | -#: ../bin/testdrive-gtk.py:425 |
1362 | +#: ../bin/testdrive-gtk.py:458 |
1363 | msgid "" |
1364 | -"Your CPU does not support acceleration; run kvm-ok for more information;\n" |
1365 | +"Your CPU does not support acceleration; " |
1366 | +"run kvm-ok for more information;\n" |
1367 | "then please install VirtualBox\n" |
1368 | "\n" |
1369 | "kvm-ok\n" |
1370 | @@ -127,292 +132,307 @@ |
1371 | #. ### Obtains the list of ISO available from the iso list cache #### |
1372 | #. ################################################################## |
1373 | #. Try to retrieve the ISO list from the cache |
1374 | -#: ../bin/testdrive-gtk.py:438 ../bin/testdrive.py:348 |
1375 | +#: ../bin/testdrive-gtk.py:472 ../bin/testdrive.py:398 |
1376 | msgid "Retrieving the Ubuntu ISO list from cache..." |
1377 | msgstr "" |
1378 | |
1379 | -#: ../bin/testdrive-gtk.py:442 ../bin/testdrive-gtk.py:443 |
1380 | -#: ../bin/testdrive.py:352 |
1381 | +#: ../bin/testdrive-gtk.py:477 ../bin/testdrive-gtk.py:479 |
1382 | +#: ../bin/testdrive.py:402 |
1383 | msgid "Unable to retrieve the Ubuntu ISO list from cache..." |
1384 | msgstr "" |
1385 | |
1386 | -#: ../bin/testdrive-gtk.py:563 ../bin/testdrive-gtk.py:598 |
1387 | -#: ../bin/testdrive-gtk.py:905 |
1388 | +#: ../bin/testdrive-gtk.py:604 ../bin/testdrive-gtk.py:652 |
1389 | +#: ../bin/testdrive-gtk.py:995 |
1390 | #, python-format |
1391 | msgid "<i> CACHE: [%s]</i>" |
1392 | msgstr "" |
1393 | |
1394 | -#: ../bin/testdrive-gtk.py:565 ../bin/testdrive-gtk.py:600 |
1395 | -#: ../bin/testdrive-gtk.py:907 |
1396 | +#: ../bin/testdrive-gtk.py:609 ../bin/testdrive-gtk.py:658 |
1397 | +#: ../bin/testdrive-gtk.py:999 |
1398 | msgid "<i> CACHE: [empty]</i>" |
1399 | msgstr "" |
1400 | |
1401 | -#: ../bin/testdrive-gtk.py:628 |
1402 | -msgid "<b><i>There are no Other ISOs yet...</i></b>" |
1403 | +#: ../bin/testdrive-gtk.py:696 |
1404 | +msgid "<b><i>There are no Other ISOs yet...</i></b>" |
1405 | msgstr "" |
1406 | |
1407 | -#: ../bin/testdrive-gtk.py:631 |
1408 | -msgid "<b><i>There are no ISOs for this architecture yet...</i></b>" |
1409 | +#: ../bin/testdrive-gtk.py:700 |
1410 | +msgid "" |
1411 | +"<b><i>There are no ISOs for this architecture yet..." |
1412 | +"</i></b>" |
1413 | msgstr "" |
1414 | |
1415 | #. Add Button |
1416 | -#: ../bin/testdrive-gtk.py:665 |
1417 | +#: ../bin/testdrive-gtk.py:737 |
1418 | msgid "Add ISO" |
1419 | msgstr "" |
1420 | |
1421 | #. Create Buttons |
1422 | -#: ../bin/testdrive-gtk.py:672 |
1423 | +#: ../bin/testdrive-gtk.py:744 |
1424 | msgid "Create USB Disk" |
1425 | msgstr "" |
1426 | |
1427 | -#: ../bin/testdrive-gtk.py:677 |
1428 | +#: ../bin/testdrive-gtk.py:750 |
1429 | msgid "Sync" |
1430 | msgstr "" |
1431 | |
1432 | -#: ../bin/testdrive-gtk.py:682 |
1433 | +#: ../bin/testdrive-gtk.py:755 |
1434 | msgid "Launch" |
1435 | msgstr "" |
1436 | |
1437 | -#: ../bin/testdrive-gtk.py:736 ../bin/testdrive.py:264 |
1438 | +#: ../bin/testdrive-gtk.py:814 |
1439 | msgid "Using KVM for virtual machine hosting..." |
1440 | msgstr "" |
1441 | |
1442 | -#: ../bin/testdrive-gtk.py:739 ../bin/testdrive.py:266 |
1443 | +#: ../bin/testdrive-gtk.py:818 |
1444 | msgid "Using VirtualBox for virtual machine hosting..." |
1445 | msgstr "" |
1446 | |
1447 | -#: ../bin/testdrive-gtk.py:742 ../bin/testdrive.py:268 |
1448 | +#: ../bin/testdrive-gtk.py:822 |
1449 | msgid "Using Parallels Desktop for virtual machine hosting..." |
1450 | msgstr "" |
1451 | |
1452 | -#: ../bin/testdrive-gtk.py:796 |
1453 | +#: ../bin/testdrive-gtk.py:877 |
1454 | msgid "sync_iso: Thread is executing..." |
1455 | msgstr "" |
1456 | |
1457 | -#: ../bin/testdrive-gtk.py:817 |
1458 | +#: ../bin/testdrive-gtk.py:899 |
1459 | msgid "launch_iso: Thread is executing or syncing..." |
1460 | msgstr "" |
1461 | |
1462 | -#: ../bin/testdrive-gtk.py:824 |
1463 | +#: ../bin/testdrive-gtk.py:906 |
1464 | msgid "" |
1465 | "No ISO has been selected.\n" |
1466 | "\n" |
1467 | -"Please select an ISO to create an USB Startup Disk." |
1468 | +"Please select an ISO to create an USB " |
1469 | +"Startup Disk." |
1470 | msgstr "" |
1471 | |
1472 | -#: ../bin/testdrive-gtk.py:829 |
1473 | +#: ../bin/testdrive-gtk.py:912 |
1474 | msgid "" |
1475 | "More than 1 ISO has been selected.\n" |
1476 | "\n" |
1477 | "Please select only 1 ISO to continue!" |
1478 | msgstr "" |
1479 | |
1480 | -#: ../bin/testdrive-gtk.py:834 |
1481 | +#: ../bin/testdrive-gtk.py:917 |
1482 | msgid "" |
1483 | "The specified ISO does not exist!\n" |
1484 | "\n" |
1485 | -"Please, synchronize the ISO to continue." |
1486 | +"Please synchronize the ISO to continue." |
1487 | msgstr "" |
1488 | |
1489 | -#: ../bin/testdrive-gtk.py:841 |
1490 | +#: ../bin/testdrive-gtk.py:925 |
1491 | msgid "Unable to launch USB Creator!" |
1492 | msgstr "" |
1493 | |
1494 | -#: ../bin/testdrive-gtk.py:867 |
1495 | +#: ../bin/testdrive-gtk.py:953 |
1496 | #, python-format |
1497 | msgid " Downloading %s (0%%)" |
1498 | msgstr "" |
1499 | |
1500 | -#: ../bin/testdrive-gtk.py:887 |
1501 | +#: ../bin/testdrive-gtk.py:975 |
1502 | #, python-format |
1503 | msgid " Downloading %s (%s%%)" |
1504 | msgstr "" |
1505 | |
1506 | -#: ../bin/testdrive-gtk.py:936 |
1507 | +#: ../bin/testdrive-gtk.py:1029 |
1508 | msgid " Configuring Virtual Machine..." |
1509 | msgstr "" |
1510 | |
1511 | -#: ../bin/testdrive-gtk.py:942 |
1512 | +#: ../bin/testdrive-gtk.py:1035 |
1513 | msgid " Running Virtual Machine..." |
1514 | msgstr "" |
1515 | |
1516 | -#: ../bin/testdrive-gtk.py:991 |
1517 | +#: ../bin/testdrive-gtk.py:1089 |
1518 | msgid "Show debug messages" |
1519 | msgstr "" |
1520 | |
1521 | -#: ../bin/testdrive.py:52 |
1522 | +#: ../bin/testdrive.py:62 |
1523 | msgid "" |
1524 | "\n" |
1525 | "Welcome to Testdrive!\n" |
1526 | msgstr "" |
1527 | |
1528 | -#: ../bin/testdrive.py:60 |
1529 | +#: ../bin/testdrive.py:70 |
1530 | #, python-format |
1531 | msgid " +-cache--> [%s] %s" |
1532 | msgstr "" |
1533 | |
1534 | -#: ../bin/testdrive.py:63 |
1535 | +#: ../bin/testdrive.py:76 |
1536 | #, python-format |
1537 | msgid " %d. Other (prompt for ISO URL)" |
1538 | msgstr "" |
1539 | |
1540 | -#: ../bin/testdrive.py:65 |
1541 | +#: ../bin/testdrive.py:78 |
1542 | msgid "" |
1543 | "\n" |
1544 | "Select an image to testdrive [1]: " |
1545 | msgstr "" |
1546 | |
1547 | -#: ../bin/testdrive.py:74 |
1548 | +#: ../bin/testdrive.py:87 |
1549 | msgid "" |
1550 | "\n" |
1551 | "ERROR: Invalid input\n" |
1552 | msgstr "" |
1553 | |
1554 | -#: ../bin/testdrive.py:77 |
1555 | +#: ../bin/testdrive.py:90 |
1556 | msgid "" |
1557 | "\n" |
1558 | "Enter an ISO URL to testdrive: " |
1559 | msgstr "" |
1560 | |
1561 | -#: ../bin/testdrive.py:84 |
1562 | +#: ../bin/testdrive.py:97 |
1563 | msgid "" |
1564 | "\n" |
1565 | "ERROR: Invalid selection\n" |
1566 | msgstr "" |
1567 | |
1568 | -#: ../bin/testdrive.py:88 |
1569 | +#: ../bin/testdrive.py:102 |
1570 | #, python-format |
1571 | msgid "" |
1572 | "\n" |
1573 | "%s\n" |
1574 | msgstr "" |
1575 | |
1576 | -#: ../bin/testdrive.py:102 ../testdrivegtk/AddOtherTestdrivegtkDialog.py:155 |
1577 | +#: ../bin/testdrive.py:118 ../testdrivegtk/AddOtherTestdrivegtkDialog.py:161 |
1578 | #, python-format |
1579 | msgid "Invalid ISO URL [%s]" |
1580 | msgstr "" |
1581 | |
1582 | -#: ../bin/testdrive.py:144 |
1583 | +#: ../bin/testdrive.py:167 |
1584 | #, python-format |
1585 | msgid "" |
1586 | "Command failed\n" |
1587 | " `%s`" |
1588 | msgstr "" |
1589 | |
1590 | -#: ../bin/testdrive.py:151 |
1591 | +#: ../bin/testdrive.py:176 |
1592 | msgid "Launching Virtual Machine using CURSES as screen mode" |
1593 | msgstr "" |
1594 | |
1595 | -#: ../bin/testdrive.py:196 |
1596 | +#: ../bin/testdrive.py:226 |
1597 | msgid "user configuration file (overriding default values" |
1598 | msgstr "" |
1599 | |
1600 | -#: ../bin/testdrive.py:198 |
1601 | +#: ../bin/testdrive.py:229 |
1602 | msgid "print version and system data, and exit" |
1603 | msgstr "" |
1604 | |
1605 | -#: ../bin/testdrive.py:200 |
1606 | +#: ../bin/testdrive.py:232 |
1607 | msgid "get ISO image from this URL location" |
1608 | msgstr "" |
1609 | |
1610 | -#: ../bin/testdrive.py:202 |
1611 | +#: ../bin/testdrive.py:235 |
1612 | msgid "try to launch usb-creator for further testing" |
1613 | msgstr "" |
1614 | |
1615 | -#: ../bin/testdrive.py:204 |
1616 | +#: ../bin/testdrive.py:238 |
1617 | msgid "hardcode Ubuntu RELEASE codename" |
1618 | msgstr "" |
1619 | |
1620 | -#: ../bin/testdrive.py:206 |
1621 | +#: ../bin/testdrive.py:241 |
1622 | msgid "" |
1623 | "hardcode Ubuntu flavor. Available Flavors:\n" |
1624 | -" ubuntu/kubuntu/xubuntu/edubuntu/mythbuntu/ubuntustudio/lubuntu/" |
1625 | -"ubuntukylin" |
1626 | +" ubuntu/kubuntu/xubuntu/edubuntu/mythbuntu/ " |
1627 | +"ubuntustudio/lubuntu/ubuntukylin" |
1628 | msgstr "" |
1629 | |
1630 | -#: ../bin/testdrive.py:209 |
1631 | +#: ../bin/testdrive.py:246 |
1632 | msgid "" |
1633 | "hardcode Ubuntu repository from where to obtain ISOs:\n" |
1634 | " releases/cdimage/cloud-daily/cloud-releases" |
1635 | msgstr "" |
1636 | |
1637 | -#: ../bin/testdrive.py:212 |
1638 | -msgid "displays the Virtual Machine in the shell. Only valid for Cloud images." |
1639 | +#: ../bin/testdrive.py:250 |
1640 | +msgid "" |
1641 | +"displays the Virtual Machine in the shell. Only valid for Cloud " |
1642 | +"images." |
1643 | msgstr "" |
1644 | |
1645 | -#: ../bin/testdrive.py:217 |
1646 | +#: ../bin/testdrive.py:257 |
1647 | #, python-format |
1648 | msgid "version passed: %s" |
1649 | msgstr "" |
1650 | |
1651 | -#: ../bin/testdrive.py:221 |
1652 | +#: ../bin/testdrive.py:262 |
1653 | #, python-format |
1654 | msgid "testdrive %s" |
1655 | msgstr "" |
1656 | |
1657 | -#: ../bin/testdrive.py:233 |
1658 | +#: ../bin/testdrive.py:276 |
1659 | #, python-format |
1660 | msgid "config passed: %s" |
1661 | msgstr "" |
1662 | |
1663 | -#: ../bin/testdrive.py:243 |
1664 | +#: ../bin/testdrive.py:286 |
1665 | #, python-format |
1666 | msgid "Trying config in %s" |
1667 | msgstr "" |
1668 | |
1669 | -#: ../bin/testdrive.py:247 |
1670 | +#: ../bin/testdrive.py:290 |
1671 | #, python-format |
1672 | msgid "Using configuration in %s" |
1673 | msgstr "" |
1674 | |
1675 | -#: ../bin/testdrive.py:249 |
1676 | +#: ../bin/testdrive.py:292 |
1677 | #, python-format |
1678 | msgid "Invalid configuration [%s]" |
1679 | msgstr "" |
1680 | |
1681 | -#: ../bin/testdrive.py:257 |
1682 | +#: ../bin/testdrive.py:300 |
1683 | msgid "" |
1684 | "Your CPU supports KVM acceleration; please install KVM:\n" |
1685 | " sudo apt-get install qemu-kvm" |
1686 | msgstr "" |
1687 | |
1688 | -#: ../bin/testdrive.py:260 |
1689 | +#: ../bin/testdrive.py:303 |
1690 | msgid "" |
1691 | -"Your CPU does not support acceleration; run kvm-ok for more information; " |
1692 | -"then please install VirtualBox:\n" |
1693 | +"Your CPU does not support acceleration; run kvm-ok for more " |
1694 | +"information; then please install VirtualBox:\n" |
1695 | " kvm-ok\n" |
1696 | " sudo apt-get install virtualbox" |
1697 | msgstr "" |
1698 | |
1699 | -#: ../bin/testdrive.py:284 |
1700 | +#: ../bin/testdrive.py:308 |
1701 | +msgid "Using KVM for virtual machine hosting." |
1702 | +msgstr "" |
1703 | + |
1704 | +#: ../bin/testdrive.py:310 |
1705 | +msgid "Using VirtualBox for virtual machine hosting." |
1706 | +msgstr "" |
1707 | + |
1708 | +#: ../bin/testdrive.py:312 |
1709 | +msgid "Using Parallels Desktop for virtual machine hosting." |
1710 | +msgstr "" |
1711 | + |
1712 | +#: ../bin/testdrive.py:329 |
1713 | msgid "" |
1714 | -"Launching Cloud images only works with KVM. Please switch your " |
1715 | -"virtualization method..." |
1716 | +"Launching Cloud images only works with KVM. Please switch " |
1717 | +"your virtualization method..." |
1718 | msgstr "" |
1719 | |
1720 | -#: ../bin/testdrive.py:335 |
1721 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:339 |
1722 | +#: ../bin/testdrive.py:384 |
1723 | #, python-format |
1724 | msgid "Obtaining Ubuntu ISO list from %s..." |
1725 | msgstr "" |
1726 | |
1727 | -#: ../bin/testdrive.py:339 |
1728 | +#: ../bin/testdrive.py:388 |
1729 | #, python-format |
1730 | msgid "ERROR: Could not obtain the Ubuntu ISO list from %s..." |
1731 | msgstr "" |
1732 | |
1733 | -#: ../bin/testdrive.py:345 |
1734 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:351 |
1735 | +#: ../bin/testdrive.py:395 |
1736 | msgid "Unable to update the Ubuntu ISO list cache..." |
1737 | msgstr "" |
1738 | |
1739 | #. BUG: should check disk space availability in CACHE dir |
1740 | #. Update the cache |
1741 | -#: ../bin/testdrive.py:371 |
1742 | +#: ../bin/testdrive.py:421 |
1743 | msgid "Syncing the specified ISO..." |
1744 | msgstr "" |
1745 | |
1746 | -#: ../bin/testdrive.py:378 ../testdrivegtk/AddOtherTestdrivegtkDialog.py:167 |
1747 | +#: ../bin/testdrive.py:429 ../testdrivegtk/AddOtherTestdrivegtkDialog.py:174 |
1748 | #, python-format |
1749 | msgid "ISO not found at [%s]" |
1750 | msgstr "" |
1751 | @@ -420,75 +440,78 @@ |
1752 | #. ################## |
1753 | #. # Launch the VM ## |
1754 | #. ################## |
1755 | -#: ../bin/testdrive.py:401 |
1756 | +#: ../bin/testdrive.py:453 |
1757 | msgid "Validating Virtualization Method...." |
1758 | msgstr "" |
1759 | |
1760 | -#: ../bin/testdrive.py:405 |
1761 | +#: ../bin/testdrive.py:457 |
1762 | #, python-format |
1763 | msgid "Unable to validate Virtualization Method [%s]" |
1764 | msgstr "" |
1765 | |
1766 | -#: ../bin/testdrive.py:407 |
1767 | +#: ../bin/testdrive.py:459 |
1768 | msgid "Setting up Virtual Machine..." |
1769 | msgstr "" |
1770 | |
1771 | -#: ../bin/testdrive.py:411 |
1772 | +#: ../bin/testdrive.py:463 |
1773 | msgid "Unable to setup Virtual Machine" |
1774 | msgstr "" |
1775 | |
1776 | -#: ../bin/testdrive.py:413 |
1777 | +#: ../bin/testdrive.py:465 |
1778 | msgid "Launching Virtual Machine..." |
1779 | msgstr "" |
1780 | |
1781 | -#: ../bin/testdrive.py:421 |
1782 | +#: ../bin/testdrive.py:473 |
1783 | msgid "Unable to launch Virtual Machine" |
1784 | msgstr "" |
1785 | |
1786 | -#: ../bin/testdrive.py:425 |
1787 | +#: ../bin/testdrive.py:477 |
1788 | #, python-format |
1789 | msgid "Cleaning up disk image [%s]..." |
1790 | msgstr "" |
1791 | |
1792 | #. Remind about cache cleanup |
1793 | -#: ../bin/testdrive.py:428 |
1794 | +#: ../bin/testdrive.py:480 |
1795 | msgid "You may wish to clean up the cache directory..." |
1796 | msgstr "" |
1797 | |
1798 | -#: ../bin/testdrive.py:429 |
1799 | +#: ../bin/testdrive.py:481 |
1800 | #, python-format |
1801 | msgid " %s and %s" |
1802 | msgstr "" |
1803 | |
1804 | -#: ../bin/testdrive.py:436 |
1805 | +#: ../bin/testdrive.py:490 |
1806 | msgid "" |
1807 | "\n" |
1808 | -"Launch USB Startup Disk Creator for further testing of this ISO? [y/N] " |
1809 | +"Launch USB Startup Disk Creator for further testing of this ISO? " |
1810 | +"[y/N] " |
1811 | msgstr "" |
1812 | |
1813 | -#: ../bin/testdrive.py:440 |
1814 | +#: ../bin/testdrive.py:495 |
1815 | msgid "" |
1816 | "\n" |
1817 | "Press <enter> to exit..." |
1818 | msgstr "" |
1819 | |
1820 | -#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:135 |
1821 | +#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:140 |
1822 | msgid "Please insert a Description" |
1823 | msgstr "" |
1824 | |
1825 | -#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:140 |
1826 | +#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:145 |
1827 | msgid "Please insert a URL" |
1828 | msgstr "" |
1829 | |
1830 | -#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:171 |
1831 | -msgid "No sync protocol has been selected, please select one." |
1832 | +#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:178 |
1833 | +msgid "" |
1834 | +"No sync protocol has been selected, please " |
1835 | +"select one." |
1836 | msgstr "" |
1837 | |
1838 | -#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:196 |
1839 | +#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:204 |
1840 | msgid "Description" |
1841 | msgstr "" |
1842 | |
1843 | -#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:227 |
1844 | +#: ../testdrivegtk/AddOtherTestdrivegtkDialog.py:238 |
1845 | msgid "Select Protocol:" |
1846 | msgstr "" |
1847 | |
1848 | @@ -497,54 +520,76 @@ |
1849 | msgid "Other..." |
1850 | msgstr "" |
1851 | |
1852 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:72 |
1853 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:73 |
1854 | msgid "TestDrive Preferences" |
1855 | msgstr "" |
1856 | |
1857 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:98 |
1858 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:99 |
1859 | msgid "finish_initialization()" |
1860 | msgstr "" |
1861 | |
1862 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:138 |
1863 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:143 |
1864 | msgid "Select Repository:" |
1865 | msgstr "" |
1866 | |
1867 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:149 |
1868 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:496 |
1869 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:155 |
1870 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:532 |
1871 | msgid "Select Release:" |
1872 | msgstr "" |
1873 | |
1874 | #. Load config files for local variables |
1875 | #. self.load_config_files(file) |
1876 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:217 |
1877 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:238 |
1878 | #, python-format |
1879 | msgid "Reading config file: [%s]" |
1880 | msgstr "" |
1881 | |
1882 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:219 |
1883 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:241 |
1884 | #, python-format |
1885 | msgid "Unable to load config file [%s]" |
1886 | msgstr "" |
1887 | |
1888 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:282 |
1889 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:305 |
1890 | #, python-format |
1891 | msgid " of %s available." |
1892 | msgstr "" |
1893 | |
1894 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:343 |
1895 | -#, python-format |
1896 | -msgid "Could not obtain the Ubuntu ISO list from %s..." |
1897 | -msgstr "" |
1898 | - |
1899 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:347 |
1900 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:366 |
1901 | +#, python-format |
1902 | +msgid "" |
1903 | +"\n" |
1904 | +" Obtaining Ubuntu ISO list from %s...\n" |
1905 | +" " |
1906 | +msgstr "" |
1907 | + |
1908 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:372 |
1909 | +#, python-format |
1910 | +msgid "" |
1911 | +"\n" |
1912 | +" Could not obtain the Ubuntu ISO list from %s...\n" |
1913 | +" " |
1914 | +msgstr "" |
1915 | + |
1916 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:378 |
1917 | msgid "Updating the Ubuntu ISO list cache..." |
1918 | msgstr "" |
1919 | |
1920 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:355 |
1921 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:382 |
1922 | +msgid "" |
1923 | +"\n" |
1924 | +" Unable to update the Ubuntu ISO list cache...\n" |
1925 | +" " |
1926 | +msgstr "" |
1927 | + |
1928 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:388 |
1929 | msgid "get_preferences()" |
1930 | msgstr "" |
1931 | |
1932 | -#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:478 |
1933 | +#: ../testdrivegtk/PreferencesTestdrivegtkDialog.py:512 |
1934 | #, python-format |
1935 | msgid "Unable to clean up files from [%s]" |
1936 | msgstr "" |
1937 | + |
1938 | +#: ../testdrivegtk/AboutTestdrivegtkDialog.py:48 |
1939 | +msgid "PyGTK Front-end for TestDrive" |
1940 | +msgstr "" |
1941 | |
1942 | === modified file 'setup.py' |
1943 | --- setup.py 2013-08-27 16:31:59 +0000 |
1944 | +++ setup.py 2013-10-06 20:59:44 +0000 |
1945 | @@ -2,24 +2,25 @@ |
1946 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1947 | ### BEGIN LICENSE |
1948 | # Copyright (C) 2010 Canonical Ltd. |
1949 | -# |
1950 | +# |
1951 | # Authors: |
1952 | # Andres Rodriguez <andreserl@ubuntu.com> |
1953 | -# |
1954 | -# This program is free software: you can redistribute it and/or modify it |
1955 | -# under the terms of the GNU General Public License version 3, as published |
1956 | +# |
1957 | +# This program is free software: you can redistribute it and/or modify it |
1958 | +# under the terms of the GNU General Public License version 3, as published |
1959 | # by the Free Software Foundation. |
1960 | -# |
1961 | -# This program is distributed in the hope that it will be useful, but |
1962 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
1963 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
1964 | +# |
1965 | +# This program is distributed in the hope that it will be useful, but |
1966 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
1967 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
1968 | # PURPOSE. See the GNU General Public License for more details. |
1969 | -# |
1970 | -# You should have received a copy of the GNU General Public License along |
1971 | +# |
1972 | +# You should have received a copy of the GNU General Public License along |
1973 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
1974 | ### END LICENSE |
1975 | |
1976 | -###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ###################### |
1977 | + |
1978 | +################# DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ################# |
1979 | |
1980 | import os |
1981 | import sys |
1982 | @@ -28,9 +29,11 @@ |
1983 | try: |
1984 | import DistUtilsExtra.auto |
1985 | except ImportError: |
1986 | - print >> sys.stderr, 'To build testdrivegtk you need https://launchpad.net/python-distutils-extra' |
1987 | + print >> sys.stderr, 'To build testdrive you need python-distutils-extra' |
1988 | sys.exit(1) |
1989 | -assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18' |
1990 | +assert DistUtilsExtra.auto.__version__ >= '2.18', \ |
1991 | + 'needs DistUtilsExtra.auto >= 2.18' |
1992 | + |
1993 | |
1994 | def update_data_path(prefix, oldvalue=None): |
1995 | |
1996 | @@ -38,14 +41,14 @@ |
1997 | fin = file('testdrivegtk/testdrivegtkconfig.py', 'r') |
1998 | fout = file(fin.name + '.new', 'w') |
1999 | |
2000 | - for line in fin: |
2001 | - fields = line.split(' = ') # Separate variable from value |
2002 | + for line in fin: |
2003 | + fields = line.split(' = ') # Separate variable from value |
2004 | if fields[0] == '__testdrivegtk_data_directory__': |
2005 | # update to prefix, store oldvalue |
2006 | if not oldvalue: |
2007 | oldvalue = fields[1] |
2008 | line = "%s = '%s'\n" % (fields[0], prefix) |
2009 | - else: # restore oldvalue |
2010 | + else: # restore oldvalue |
2011 | line = "%s = %s" % (fields[0], oldvalue) |
2012 | fout.write(line) |
2013 | |
2014 | @@ -53,7 +56,7 @@ |
2015 | fout.close() |
2016 | fin.close() |
2017 | os.rename(fout.name, fin.name) |
2018 | - except (OSError, IOError), e: |
2019 | + except (OSError, IOError): |
2020 | print ("ERROR: Can't find testdrivegtk/testdrivegtkconfig.py") |
2021 | sys.exit(1) |
2022 | return oldvalue |
2023 | @@ -65,7 +68,7 @@ |
2024 | fin = file('testdrive-gtk.desktop.in', 'r') |
2025 | fout = file(fin.name + '.new', 'w') |
2026 | |
2027 | - for line in fin: |
2028 | + for line in fin: |
2029 | if 'Icon=' in line: |
2030 | line = "Icon=%s\n" % (datadir + 'media/testdrive-gtk.xpm') |
2031 | fout.write(line) |
2032 | @@ -73,7 +76,7 @@ |
2033 | fout.close() |
2034 | fin.close() |
2035 | os.rename(fout.name, fin.name) |
2036 | - except (OSError, IOError), e: |
2037 | + except (OSError, IOError): |
2038 | print ("ERROR: Can't find testdrive-gtk.desktop.in") |
2039 | sys.exit(1) |
2040 | |
2041 | @@ -86,10 +89,9 @@ |
2042 | update_data_path(self.prefix, previous_value) |
2043 | |
2044 | |
2045 | - |
2046 | -################################################################################## |
2047 | -###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ###################### |
2048 | -################################################################################## |
2049 | +############################################################################### |
2050 | +#################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ##################### |
2051 | +############################################################################### |
2052 | |
2053 | DistUtilsExtra.auto.setup( |
2054 | name='testdrive', |
2055 | @@ -100,11 +102,11 @@ |
2056 | description='Test Drive an Ubuntu ISO', |
2057 | long_description='Download and run an Ubuntu ISO in a Virtual Machine', |
2058 | url='https://launchpad.net/testdrive', |
2059 | - packages=[ 'testdrive', |
2060 | + packages=['testdrive', |
2061 | 'testdrive.virt', |
2062 | 'testdrivegtk'], |
2063 | scripts=['bin/testdrive', 'bin/testdrive-gtk'], |
2064 | - data_files=[ ('/etc', ['testdriverc']), |
2065 | + data_files=[('/etc', ['testdriverc']), |
2066 | ('share/testdrive', ['testdriverc']), |
2067 | ('share/testdrivegtk/ui', glob('data/ui/*.ui')), |
2068 | ('share/testdrivegtk/ui', glob('data/ui/*.xml')), |
2069 | @@ -112,8 +114,8 @@ |
2070 | ('share/testdrivegtk/media', glob('data/media/*.svg')) |
2071 | #('share/pixmaps', glob('data/media/testdrive-gtk.xpm')), |
2072 | #('share/testdrivegtk/indicator', glob('indicator/testdrive-gtk')) |
2073 | - #('share/indicators/messages/applications', glob('indicator/testdrive-gtk')) |
2074 | - ], |
2075 | + #('share/indicators/messages/applications', |
2076 | + # glob('indicator/testdrive-gtk')) |
2077 | + ], |
2078 | cmdclass={'install': InstallAndUpdateDataDirectory} |
2079 | ) |
2080 | - |
2081 | |
2082 | === modified file 'testdrive/testdrive.py' |
2083 | --- testdrive/testdrive.py 2013-08-10 09:59:15 +0000 |
2084 | +++ testdrive/testdrive.py 2013-10-06 20:59:44 +0000 |
2085 | @@ -19,9 +19,16 @@ |
2086 | # You should have received a copy of the GNU General Public License |
2087 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
2088 | |
2089 | -import os, platform, commands, tempfile, hashlib, ConfigParser, time |
2090 | +import os |
2091 | +import platform |
2092 | +import commands |
2093 | +import tempfile |
2094 | +import hashlib |
2095 | +import ConfigParser |
2096 | +import time |
2097 | import xdg.BaseDirectory |
2098 | |
2099 | + |
2100 | class Testdrive: |
2101 | def __init__(self, pkg_section): |
2102 | self.HOME = os.getenv("HOME", "") |
2103 | @@ -42,10 +49,11 @@ |
2104 | self.PROTO = None |
2105 | self.ISO_PATH_HEADER = None |
2106 | self.PKG_SECTION = pkg_section |
2107 | - self.r = None #Release (maverick, lucid, etc) |
2108 | - self.m = None #Arch (amd64, i386) |
2109 | - self.f = None #Flavor (ubuntu, kubuntu, etc) |
2110 | - self.p = None # Ubuntu ISO Repository (cdimage, releases, cloud-daily, cloud-releases) |
2111 | + self.r = None # Release (precise, saucy, etc) |
2112 | + self.m = None # Arch (amd64, i386) |
2113 | + self.f = None # Flavor (ubuntu, kubuntu, etc) |
2114 | + self.p = None # Ubuntu ISO Repository |
2115 | + # (cdimage, releases, cloud-daily, cloud-releases) |
2116 | |
2117 | def set_values(self, var, value): |
2118 | if var == 'kvm_args': |
2119 | @@ -95,7 +103,8 @@ |
2120 | except: |
2121 | pass |
2122 | |
2123 | - ## TODO: This possible needs to go outside the class due to in PyGTK front end we might need the list of ISO's before even instancing an object |
2124 | + ## TODO: This possible needs to go outside the class due to in PyGTK front |
2125 | + ## end we might need the list of ISO's before even instancing an object |
2126 | def list_isos(self, ISOS): |
2127 | ISO = [] |
2128 | for iso in ISOS: |
2129 | @@ -141,19 +150,23 @@ |
2130 | url = iso.split()[2] |
2131 | if self.p == 'cloud-daily' or self.p == 'cloud-releases': |
2132 | arch = url.split(".tar.gz")[0].split("-")[-1] |
2133 | - name = "%s" % flavor |
2134 | + name = "%s" % flavor |
2135 | else: |
2136 | arch = url.split(".iso")[0].split("-")[-1] |
2137 | - image = url.split("-%s.iso" % arch)[0].split("-")[-1].capitalize() |
2138 | + image = url.split("-%s.iso" % arch)[0].split( |
2139 | + "-")[-1].capitalize() |
2140 | if image == 'Dvd': |
2141 | - image = url.split("-%s.iso" % arch)[0].split("-")[-1].swapcase() |
2142 | + image = url.split("-%s.iso" % arch)[0].split( |
2143 | + "-")[-1].swapcase() |
2144 | name = "%s %s" % (flavor, image) |
2145 | # Name: Shows a description |
2146 | # URL: Shows the URL from where it downloads the ISO |
2147 | # Arch: Shows the architecture (amd64|i386) |
2148 | - # Category: The header used to save the ISO, i.e.: ubuntu_lucid-desktop-i386.iso kubuntu_lucid-desktop-i386.iso |
2149 | + # Category: The header used to save the ISO, i.e.: |
2150 | + # ubuntu_saucy-desktop-i386.iso kubuntu_saucy-desktop-i386.iso |
2151 | if arch in self.m: |
2152 | - ISO.append({"name":name, "url":"%s%s" % (self.u, url), "arch":arch, "category":category}) |
2153 | + ISO.append({"name": name, "url": "%s%s" % (self.u, url), |
2154 | + "arch": arch, "category": category}) |
2155 | return ISO |
2156 | |
2157 | def get_virt(self): |
2158 | @@ -165,7 +178,9 @@ |
2159 | acceleration = 1 |
2160 | else: |
2161 | # Okay, we don't have kvm-ok, so let's hack it... |
2162 | - if commands.getstatusoutput("egrep \"^flags.*:.*(svm|vmx)\" /proc/cpuinfo")[0] == 0: |
2163 | + if commands.getstatusoutput( |
2164 | + "egrep \"^flags.*:.*(svm|vmx)\" /proc/cpuinfo" |
2165 | + )[0] == 0: |
2166 | acceleration = 1 |
2167 | # Prefer KVM if acceleration available and installed |
2168 | if acceleration == 1 and commands.getstatusoutput("which kvm")[0] == 0: |
2169 | @@ -186,7 +201,8 @@ |
2170 | # Set defaults where undefined |
2171 | if self.CACHE is None: |
2172 | if xdg.BaseDirectory.xdg_cache_home: |
2173 | - self.CACHE = "%s/%s" % (xdg.BaseDirectory.xdg_cache_home, self.PKG) |
2174 | + self.CACHE = "%s/%s" % ( |
2175 | + xdg.BaseDirectory.xdg_cache_home, self.PKG) |
2176 | else: |
2177 | self.CACHE = "%s/.cache/%s" % (self.HOME, self.PKG) |
2178 | |
2179 | @@ -214,7 +230,8 @@ |
2180 | self.DISK_SIZE = "6G" |
2181 | |
2182 | if len(self.MEM) == 0: |
2183 | - total = commands.getoutput("grep ^MemTotal /proc/meminfo | awk '{print $2}'") |
2184 | + total = commands.getoutput( |
2185 | + "grep ^MemTotal /proc/meminfo | awk '{print $2}'") |
2186 | if total > 4000000: |
2187 | self.MEM = "2048" |
2188 | elif total > 2000000: |
2189 | @@ -227,15 +244,16 @@ |
2190 | self.MEM = "256" |
2191 | |
2192 | if len(self.KVM_ARGS) == 0: |
2193 | - self.KVM_ARGS = "-usb -usbdevice tablet -net nic,model=virtio -net user -soundhw es1370" |
2194 | + self.KVM_ARGS = "-usb -usbdevice tablet -net nic,model=virtio", |
2195 | + "-net user -soundhw es1370" |
2196 | |
2197 | if len(self.VBOX_NAME) == 0: |
2198 | self.VBOX_NAME = self.PKG |
2199 | |
2200 | - if self.ISO_PATH_HEADER == None: |
2201 | + if self.ISO_PATH_HEADER is None: |
2202 | self.ISO_PATH_HEADER = 'other' |
2203 | |
2204 | - if self.f == None: |
2205 | + if self.f is None: |
2206 | self.f = 'ubuntu' |
2207 | |
2208 | if self.m is None: |
2209 | @@ -244,7 +262,7 @@ |
2210 | else: |
2211 | self.m = ["i386"] |
2212 | |
2213 | - if self.p == None: |
2214 | + if self.p is None: |
2215 | self.p = 'cdimage' |
2216 | |
2217 | if self.p == 'cdimage': |
2218 | @@ -263,11 +281,14 @@ |
2219 | if self.PROTO == "rsync": |
2220 | cmd = "rsync -azPL %s %s" % (self.ISO_URL, self.PATH_TO_ISO) |
2221 | return cmd |
2222 | - elif self.PROTO == "zsync" or self.PROTO == "http" or self.PROTO == "ftp": |
2223 | + elif self.PROTO == "zsync" or \ |
2224 | + self.PROTO == "http" or self.PROTO == "ftp": |
2225 | if commands.getstatusoutput("which zsync")[0] == 0: |
2226 | if self.ISO_URL.partition("://")[0] == "zsync": |
2227 | self.ISO_URL = self.ISO_URL.replace('zsync', 'http') |
2228 | - cmd = "cd '%s' && zsync %s.zsync -o %s" % (self.CACHE_ISO, self.ISO_URL, self.PATH_TO_ISO) |
2229 | + cmd = "cd '%s' && zsync %s.zsync -o %s" % ( |
2230 | + self.CACHE_ISO, self.ISO_URL, self.PATH_TO_ISO |
2231 | + ) |
2232 | return cmd |
2233 | else: |
2234 | cmd = "wget %s -O %s" % (self.ISO_URL, self.PATH_TO_ISO) |
2235 | @@ -276,7 +297,8 @@ |
2236 | # If the iso is on file:///, use the ISO in place |
2237 | self.PATH_TO_ISO = self.ISO_URL.partition("://")[2] |
2238 | # Get absolute path if a relative path is used |
2239 | - DIR = commands.getoutput("cd `dirname '%s'` && pwd" % self.PATH_TO_ISO) |
2240 | + DIR = commands.getoutput("cd `dirname '%s'` && pwd" % |
2241 | + self.PATH_TO_ISO) |
2242 | FILE = os.path.basename("%s" % self.PATH_TO_ISO) |
2243 | self.PATH_TO_ISO = "%s/%s" % (DIR, FILE) |
2244 | return 0 |
2245 | @@ -299,10 +321,11 @@ |
2246 | else: |
2247 | rm_disk = False |
2248 | |
2249 | - # If disk image is stock (e.g., you just ran a LiveCD, no installation), |
2250 | + # If disk image is stock (e.g. you just ran a LiveCD, no installation), |
2251 | # purge it automatically. |
2252 | if os.path.exists(self.DISK_FILE): |
2253 | - if os.path.getsize(self.DISK_FILE) == 262144 and self.md5sum(self.DISK_FILE) == "1da7553f642332ec9fb58a6094d2c8ef": |
2254 | + if os.path.getsize(self.DISK_FILE) == 262144 and self.md5sum( |
2255 | + self.DISK_FILE) == "1da7553f642332ec9fb58a6094d2c8ef": |
2256 | # Clean up kvm qcow2 image |
2257 | rm_disk = True |
2258 | if os.path.getsize(self.DISK_FILE) == 24576: |
2259 | @@ -321,18 +344,22 @@ |
2260 | |
2261 | def set_launch_path(self): |
2262 | # Move from set_defaults, due to merge of upstream rev 189 |
2263 | - ISO_NAME = "%s_%s" % (self.ISO_PATH_HEADER, os.path.basename(self.ISO_URL)) |
2264 | + ISO_NAME = "%s_%s" % (self.ISO_PATH_HEADER, |
2265 | + os.path.basename(self.ISO_URL)) |
2266 | self.PROTO = self.ISO_URL.partition(":")[0] |
2267 | self.PATH_TO_ISO = "%s/%s" % (self.CACHE_ISO, ISO_NAME) |
2268 | |
2269 | def launch_usb_creator(self): |
2270 | if os.path.exists("/usr/bin/usb-creator-gtk"): |
2271 | - os.execv("/usr/bin/usb-creator-gtk", ["usb-creator-gtk", "-i", self.PATH_TO_ISO]) |
2272 | + os.execv("/usr/bin/usb-creator-gtk", |
2273 | + ["usb-creator-gtk", "-i", self.PATH_TO_ISO]) |
2274 | else: |
2275 | - os.execv("/usr/bin/usb-creator-kde", ["usb-creator-kde", "-i", self.PATH_TO_ISO]) |
2276 | + os.execv("/usr/bin/usb-creator-kde", |
2277 | + ["usb-creator-kde", "-i", self.PATH_TO_ISO]) |
2278 | |
2279 | def is_disk_empty(self): |
2280 | - (status, output) = commands.getstatusoutput("file %s | grep -qs 'empty'" % self.DISK_FILE) |
2281 | + (status, output) = commands.getstatusoutput( |
2282 | + "file %s | grep -qs 'empty'" % self.DISK_FILE) |
2283 | if status == 0: |
2284 | return True |
2285 | return False |
2286 | @@ -346,7 +373,8 @@ |
2287 | return True |
2288 | |
2289 | def is_iso_list_cache_expired(self): |
2290 | - cache_time = time.localtime(os.path.getmtime("%s/%s.isos" % (self.CACHE, self.p))) |
2291 | + cache_time = time.localtime(os.path.getmtime( |
2292 | + "%s/%s.isos" % (self.CACHE, self.p))) |
2293 | local_time = time.localtime() |
2294 | time_difference = time.mktime(local_time) - time.mktime(cache_time) |
2295 | # Check for new release at most every 12hrs (60*60*12 = 43200) |
2296 | @@ -356,18 +384,26 @@ |
2297 | |
2298 | def obtain_ubuntu_iso_list_from_repo(self): |
2299 | if self.p == 'cdimage': |
2300 | - (status, output) = commands.getstatusoutput("wget -q -O- http://cdimage.ubuntu.com/.manifest-daily | egrep '(amd64|i386)' | egrep '(current)'") |
2301 | + (status, output) = commands.getstatusoutput( |
2302 | + "wget -q -O- http://cdimage.ubuntu.com/.manifest-daily " |
2303 | + "| egrep '(amd64|i386)' | egrep '(current)'") |
2304 | elif self.p == 'releases': |
2305 | - (status, output) = commands.getstatusoutput("wget -q -O- http://releases.ubuntu.com/.manifest | egrep '(amd64|i386)'") |
2306 | + (status, output) = commands.getstatusoutput( |
2307 | + "wget -q -O- http://releases.ubuntu.com/.manifest " |
2308 | + "| egrep '(amd64|i386)'") |
2309 | elif self.p == 'cloud-daily': |
2310 | - (status, output) = commands.getstatusoutput("wget -q -O- http://cloud-images.ubuntu.com/.manifest-daily | egrep '(amd64|i386)'") |
2311 | + (status, output) = commands.getstatusoutput( |
2312 | + "wget -q -O- http://cloud-images.ubuntu.com/.manifest-daily " |
2313 | + "| egrep '(amd64|i386)'") |
2314 | elif self.p == 'cloud-releases': |
2315 | - (status, output) = commands.getstatusoutput("wget -q -O- http://cloud-images.ubuntu.com/.manifest | egrep '(amd64|i386)'") |
2316 | + (status, output) = commands.getstatusoutput( |
2317 | + "wget -q -O- http://cloud-images.ubuntu.com/.manifest " |
2318 | + "| egrep '(amd64|i386)'") |
2319 | return output |
2320 | |
2321 | def update_ubuntu_iso_list_cache(self, str): |
2322 | try: |
2323 | - f = open("%s/%s.isos" % (self.CACHE, self.p),'w') |
2324 | + f = open("%s/%s.isos" % (self.CACHE, self.p), 'w') |
2325 | f.write(str) |
2326 | f.close |
2327 | except IOError: |
2328 | @@ -390,16 +426,19 @@ |
2329 | self.r = codename[-1] |
2330 | |
2331 | def create_disk_file(self): |
2332 | - return tempfile.mkstemp(".img", "testdrive-disk-", "%s" % self.CACHE_IMG)[1] |
2333 | + return tempfile.mkstemp(".img", "testdrive-disk-", |
2334 | + "%s" % self.CACHE_IMG)[1] |
2335 | |
2336 | def prepare_cloud_img_tarball(self): |
2337 | untar = False |
2338 | - TAR_BASENAME = os.path.basename(self.PATH_TO_ISO).split(".tar.gz")[0].split("_")[-1] |
2339 | + TAR_BASENAME = os.path.basename(self.PATH_TO_ISO).split( |
2340 | + ".tar.gz")[0].split("_")[-1] |
2341 | ORIG_DISK_NAME = "%s.img" % TAR_BASENAME |
2342 | FLOPPY_NAME = "%s-floppy" % TAR_BASENAME |
2343 | |
2344 | image_path = "%s/%s" % (self.CACHE_ISO, ORIG_DISK_NAME) |
2345 | floppy_path = "%s/%s" % (self.CACHE_ISO, FLOPPY_NAME) |
2346 | |
2347 | - cmd = 'cd %s && tar Szxvf %s %s %s' % (self.CACHE_ISO, self.PATH_TO_ISO, ORIG_DISK_NAME, FLOPPY_NAME) |
2348 | + cmd = 'cd %s && tar Szxvf %s %s %s' % ( |
2349 | + self.CACHE_ISO, self.PATH_TO_ISO, ORIG_DISK_NAME, FLOPPY_NAME) |
2350 | os.system(cmd) |
2351 | |
2352 | === modified file 'testdrive/virt/kvm.py' |
2353 | --- testdrive/virt/kvm.py 2013-05-20 17:12:31 +0000 |
2354 | +++ testdrive/virt/kvm.py 2013-10-06 20:59:44 +0000 |
2355 | @@ -19,10 +19,14 @@ |
2356 | # You should have received a copy of the GNU General Public License |
2357 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
2358 | |
2359 | -import commands, os, uuid, logging |
2360 | +import commands |
2361 | +import os |
2362 | +import uuid |
2363 | +import logging |
2364 | |
2365 | logger = logging.getLogger("testdrive.virt.kvm") |
2366 | |
2367 | + |
2368 | class KVM: |
2369 | |
2370 | def __init__(self, td): |
2371 | @@ -36,7 +40,8 @@ |
2372 | self.DISK_SIZE = td.DISK_SIZE |
2373 | |
2374 | def is_disk_empty(self): |
2375 | - (status, output) = commands.getstatusoutput("file %s | grep -qs 'empty'" % self.DISK_FILE) |
2376 | + (status, output) = commands.getstatusoutput( |
2377 | + "file %s | grep -qs 'empty'" % self.DISK_FILE) |
2378 | if status == 0: |
2379 | return True |
2380 | return False |
2381 | @@ -50,23 +55,32 @@ |
2382 | # Code to setup virtual machine |
2383 | def setup_virt(self): |
2384 | if self.p == 'cloud-daily' or self.p == 'cloud-releases': |
2385 | - #path = "%s/%s" % (self.CACHE_ISO, self.PATH_TO_ISO.split(".tar.gz")[0].split("_")[-1]) |
2386 | - path = "%s/%s" % (self.CACHE_ISO, os.path.basename(self.PATH_TO_ISO).split(".tar.gz")[0]) |
2387 | + #path = "%s/%s" % (self.CACHE_ISO, self.PATH_TO_ISO.split( |
2388 | + # ".tar.gz")[0].split("_")[-1]) |
2389 | + path = "%s/%s" % (self.CACHE_ISO, os.path.basename( |
2390 | + self.PATH_TO_ISO).split(".tar.gz")[0]) |
2391 | self.ORIG_DISK = "%s.img" % path |
2392 | self.FLOPPY_FILE = "%s-floppy" % path |
2393 | - self.run_or_die("kvm-img create -f qcow2 -b %s %s" % (self.ORIG_DISK, self.DISK_FILE)) |
2394 | + self.run_or_die("kvm-img create -f qcow2 -b %s %s" % ( |
2395 | + self.ORIG_DISK, self.DISK_FILE)) |
2396 | elif not os.path.exists(self.DISK_FILE) or self.is_disk_empty(): |
2397 | logger.info("Creating disk image [%s]..." % self.DISK_FILE) |
2398 | - self.run_or_die("kvm-img create -f qcow2 %s %s" % (self.DISK_FILE, self.DISK_SIZE)) |
2399 | + self.run_or_die("kvm-img create -f qcow2 %s %s" % ( |
2400 | + self.DISK_FILE, self.DISK_SIZE)) |
2401 | |
2402 | # Code launch virtual machine |
2403 | def launch_virt(self): |
2404 | logger.info("Running the Virtual Machine...") |
2405 | UUID = uuid.uuid4() |
2406 | if self.p == 'cloud-daily' or self.p == 'cloud-releases': |
2407 | - cmd = "qemu-system-x86_64 -uuid %s -boot a -fda %s -drive file=%s,if=virtio %s" % (UUID, self.FLOPPY_FILE, self.DISK_FILE, self.KVM_ARGS) |
2408 | + cmd = "qemu-system-x86_64 -uuid %s -boot a -fda %s -drive file=%s," |
2409 | + "if=virtio %s" % ( |
2410 | + UUID, self.FLOPPY_FILE, self.DISK_FILE, self.KVM_ARGS) |
2411 | else: |
2412 | - cmd = "qemu-system-x86_64 -uuid %s -m %s -smp %s -cdrom %s -drive file=%s,if=virtio,cache=writeback,index=0 %s" % (UUID, self.MEM, self.SMP, self.PATH_TO_ISO, self.DISK_FILE, self.KVM_ARGS) |
2413 | + cmd = "qemu-system-x86_64 -uuid %s -m %s -smp %s -cdrom %s -drive", |
2414 | + "file=%s,if=virtio,cache=writeback,index=0 %s" % ( |
2415 | + UUID, self.MEM, self.SMP, self.PATH_TO_ISO, |
2416 | + self.DISK_FILE, self.KVM_ARGS) |
2417 | return cmd |
2418 | |
2419 | def run(self, cmd): |
2420 | |
2421 | === modified file 'testdrive/virt/parallels.py' |
2422 | --- testdrive/virt/parallels.py 2012-04-21 02:05:42 +0000 |
2423 | +++ testdrive/virt/parallels.py 2013-10-06 20:59:44 +0000 |
2424 | @@ -19,7 +19,10 @@ |
2425 | # You should have received a copy of the GNU General Public License |
2426 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
2427 | |
2428 | -import commands, os, time |
2429 | +import commands |
2430 | +import os |
2431 | +#import time |
2432 | + |
2433 | |
2434 | class Parallels: |
2435 | |
2436 | @@ -34,7 +37,9 @@ |
2437 | |
2438 | # Code to validate if virtualization is installed/supported |
2439 | def validate_virt(self): |
2440 | - if commands.getstatusoutput("prlctl list %s | grep -qsv \"UUID\"" % self.VBOX_NAME)[0] == 0: |
2441 | + if commands.getstatusoutput( |
2442 | + "prlctl list %s | grep -qsv \"UUID\"" % self.VBOX_NAME |
2443 | + )[0] == 0: |
2444 | self.run_or_die("prlctl delete %s" % self.VBOX_NAME) |
2445 | |
2446 | # Code to setup virtual machine |
2447 | @@ -42,18 +47,24 @@ |
2448 | self.DISK_SIZE = self.DISK_SIZE.replace("G", "000") |
2449 | #info("Creating VM...") |
2450 | print "INFO: Creating VM..." |
2451 | - self.run_or_die("prlctl create %s --ostype linux --distribution ubuntu" % self.VBOX_NAME) |
2452 | - self.run_or_die("prlctl set %s --memsize %s" % (self.VBOX_NAME, self.MEM)) |
2453 | + self.run_or_die("prlctl create %s --ostype linux --distribution ubuntu" |
2454 | + % self.VBOX_NAME) |
2455 | + self.run_or_die("prlctl set %s --memsize %s" % ( |
2456 | + self.VBOX_NAME, self.MEM)) |
2457 | self.run_or_die("prlctl set %s --device-del hdd0" % self.VBOX_NAME) |
2458 | - self.run_or_die("prlctl set %s --device-add hdd --type expand --size %s --iface scsi --position 0:0" % (self.VBOX_NAME, self.DISK_SIZE)) |
2459 | - self.run_or_die("prlctl set %s --device-set cdrom0 --image %s" % (self.VBOX_NAME, self.PATH_TO_ISO)) |
2460 | + self.run_or_die("prlctl set %s --device-add hdd --type expand --size", |
2461 | + "%s --iface scsi --position 0:0" % ( |
2462 | + self.VBOX_NAME, self.DISK_SIZE)) |
2463 | + self.run_or_die("prlctl set %s --device-set cdrom0 --image %s" % ( |
2464 | + self.VBOX_NAME, self.PATH_TO_ISO)) |
2465 | |
2466 | # Code launch virtual machine |
2467 | def launch_virt(self): |
2468 | #self.run_or_die("prlctl start %s" % self.td.VBOX_NAME) |
2469 | return "prlctl start %s" % self.VBOX_NAME |
2470 | # Loop as long as this VM is running |
2471 | - #while commands.getstatusoutput("prlctl list %s | grep -qs stopped" % self.td.VBOX_NAME)[0] != 0: |
2472 | + #while commands.getstatusoutput( |
2473 | + #"prlctl list %s | grep -qs stopped" % self.td.VBOX_NAME)[0] != 0: |
2474 | # time.sleep(2) |
2475 | |
2476 | def run(self, cmd): |
2477 | |
2478 | === modified file 'testdrive/virt/virtualbox.py' |
2479 | --- testdrive/virt/virtualbox.py 2013-09-19 06:13:32 +0000 |
2480 | +++ testdrive/virt/virtualbox.py 2013-10-06 20:59:44 +0000 |
2481 | @@ -19,10 +19,14 @@ |
2482 | # You should have received a copy of the GNU General Public License |
2483 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
2484 | |
2485 | -import commands, os, time, logging |
2486 | +import commands |
2487 | +import os |
2488 | +#import time |
2489 | +import logging |
2490 | |
2491 | logger = logging.getLogger("testdrive.virt.vbox") |
2492 | |
2493 | + |
2494 | class VBox: |
2495 | |
2496 | def __init__(self, td): |
2497 | @@ -37,72 +41,98 @@ |
2498 | self.ISO_URL = td.ISO_URL |
2499 | |
2500 | def is_disk_empty(self): |
2501 | - (status, output) = commands.getstatusoutput("file %s | grep -qs 'empty'" % self.DISK_FILE) |
2502 | + (status, output) = commands.getstatusoutput( |
2503 | + "file %s | grep -qs 'empty'" % self.DISK_FILE) |
2504 | if status == 0: |
2505 | return True |
2506 | return False |
2507 | |
2508 | # Code to validate if virtualization is installed/supported |
2509 | def validate_virt(self): |
2510 | - # Determine which version of VirtualBox we have installed. What is returned is |
2511 | - # typically a string such as '4.1.0r55467', lets assume that the command line |
2512 | - # is consistent within 4.x.x versions extract this part of the |
2513 | - # version string for comparison later |
2514 | + # Determine which version of VirtualBox we have installed. What is |
2515 | + # returned is typically a string such as '4.1.0r55467', lets assume |
2516 | + # that the command line is consistent within 4.x.x versions extract |
2517 | + # this part of the version string for comparison later |
2518 | self.vboxversion = commands.getoutput("VBoxManage --version") |
2519 | - self.vboxversion = ( int(self.vboxversion.split(".")[0]), int(self.vboxversion.split(".")[1]) ) |
2520 | - if self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2): |
2521 | + self.vboxversion = (int(self.vboxversion.split(".")[0]), |
2522 | + int(self.vboxversion.split(".")[1])) |
2523 | + if self.vboxversion == (4, 0) or self.vboxversion == (4, 1) \ |
2524 | + or self.vboxversion == (4, 2): |
2525 | logger.info("VirtualBox %s.%s detected." % self.vboxversion) |
2526 | else: |
2527 | - logger.error("ERROR: Unsupported version (%s.%s) of VirtualBox; please install v4.0, v4.1 or v4.2." % self.vboxversion) |
2528 | + logger.error( |
2529 | + "ERROR: Unsupported version (%s.%s) of VirtualBox; please", |
2530 | + "install v4.0, v4.1 or v4.2." % self.vboxversion) |
2531 | exit(0) |
2532 | |
2533 | # Code to setup virtual machine |
2534 | def setup_virt(self): |
2535 | - self.run("sed -i \":HardDisk.*%s:d\" %s/.VirtualBox/VirtualBox.xml" % (self.DISK_FILE, self.HOME)) |
2536 | + self.run("sed -i \":HardDisk.*%s:d\" %s/.VirtualBox/VirtualBox.xml" |
2537 | + % (self.DISK_FILE, self.HOME)) |
2538 | if self.is_disk_empty(): |
2539 | os.unlink(self.DISK_FILE) |
2540 | if not os.path.exists(self.DISK_FILE): |
2541 | self.DISK_SIZE = self.DISK_SIZE.replace("G", "000") |
2542 | logger.info("Creating disk image...") |
2543 | - self.run_or_die("VBoxManage createhd --filename %s --size %s" % (self.DISK_FILE, self.DISK_SIZE)) |
2544 | - if self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2): |
2545 | - self.run("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 0 --type hdd --medium none" % self.VBOX_NAME) |
2546 | + self.run_or_die("VBoxManage createhd --filename %s --size %s" |
2547 | + % (self.DISK_FILE, self.DISK_SIZE)) |
2548 | + if self.vboxversion == (4, 0) or self.vboxversion == (4, 1) \ |
2549 | + or self.vboxversion == (4, 2): |
2550 | + self.run( |
2551 | + "VBoxManage storageattach %s --storagectl \"IDE Controller\"", |
2552 | + "--port 0 --device 0 --type hdd --medium none" |
2553 | + % self.VBOX_NAME) |
2554 | if self.PATH_TO_ISO != "/dev/null": |
2555 | - self.run("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 1 --type dvddrive --medium none" % self.VBOX_NAME) |
2556 | + self.run("VBoxManage storageattach %s --storagectl \"IDE " |
2557 | + "Controller\" --port 0 --device 1 --type dvddrive " |
2558 | + "--medium none" % self.VBOX_NAME) |
2559 | #info("Creating the Virtual Machine...") |
2560 | logger.info("Creating the Virtual Machine...") |
2561 | - if os.path.exists("%s/.VirtualBox/Machines/%s/%s.xml" % (self.HOME, self.VBOX_NAME, self.VBOX_NAME)): |
2562 | - os.unlink("%s/.VirtualBox/Machines/%s/%s.xml" % (self.HOME, self.VBOX_NAME, self.VBOX_NAME)) |
2563 | + if os.path.exists("%s/.VirtualBox/Machines/%s/%s.xml" % ( |
2564 | + self.HOME, self.VBOX_NAME, self.VBOX_NAME)): |
2565 | + os.unlink("%s/.VirtualBox/Machines/%s/%s.xml" % ( |
2566 | + self.HOME, self.VBOX_NAME, self.VBOX_NAME)) |
2567 | self.run("VBoxManage unregistervm %s --delete" % self.VBOX_NAME) |
2568 | - self.run_or_die("VBoxManage createvm --register --name %s" % self.VBOX_NAME) |
2569 | - self.run_or_die("VBoxManage modifyvm %s --memory %s" % (self.VBOX_NAME, self.MEM)) |
2570 | + self.run_or_die("VBoxManage createvm --register --name %s" |
2571 | + % self.VBOX_NAME) |
2572 | + self.run_or_die("VBoxManage modifyvm %s --memory %s" |
2573 | + % (self.VBOX_NAME, self.MEM)) |
2574 | # This should probably support more than just Ubuntu... |
2575 | if self.ISO_URL.find("amd64") >= 0: |
2576 | platform = "Ubuntu_64" |
2577 | else: |
2578 | platform = "Ubuntu" |
2579 | - self.run_or_die("VBoxManage modifyvm %s --ostype %s" % (self.VBOX_NAME, platform)) |
2580 | + self.run_or_die("VBoxManage modifyvm %s --ostype %s" |
2581 | + % (self.VBOX_NAME, platform)) |
2582 | self.run_or_die("VBoxManage modifyvm %s --vram 128" % self.VBOX_NAME) |
2583 | self.run_or_die("VBoxManage modifyvm %s --boot1 disk" % self.VBOX_NAME) |
2584 | self.run_or_die("VBoxManage modifyvm %s --boot2 dvd" % self.VBOX_NAME) |
2585 | self.run_or_die("VBoxManage modifyvm %s --nic1 nat" % self.VBOX_NAME) |
2586 | - self.run_or_die("VBoxManage modifyvm %s --pae on" % self.VBOX_NAME) |
2587 | + self.run_or_die("VBoxManage modifyvm %s --pae on" % self.VBOX_NAME) |
2588 | |
2589 | # Code launch virtual machine |
2590 | def launch_virt(self): |
2591 | logger.info("Running the Virtual Machine...") |
2592 | - if self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2): |
2593 | - self.run_or_die("VBoxManage storagectl %s --name \"IDE Controller\" --add ide" % self.VBOX_NAME) |
2594 | - self.run_or_die("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 0 --type hdd --medium %s" % (self.VBOX_NAME, self.DISK_FILE)) |
2595 | + if self.vboxversion == (4, 0) or self.vboxversion == (4, 1) \ |
2596 | + or self.vboxversion == (4, 2): |
2597 | + self.run_or_die("VBoxManage storagectl %s --name \"IDE", |
2598 | + "Controller\" --add ide" % self.VBOX_NAME) |
2599 | + self.run_or_die("VBoxManage storageattach %s --storagectl \"IDE", |
2600 | + "Controller\" --port 0 --device 0 --type hdd", |
2601 | + "--medium %s" % (self.VBOX_NAME, self.DISK_FILE)) |
2602 | if self.PATH_TO_ISO != "/dev/null": |
2603 | - self.run_or_die("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 1 --type dvddrive --medium %s" % (self.VBOX_NAME, self.PATH_TO_ISO)) |
2604 | + self.run_or_die( |
2605 | + "VBoxManage storageattach %s --storagectl \"IDE", |
2606 | + "Controller\"--port 0 --device 1 --type dvddrive", |
2607 | + "--medium %s" % (self.VBOX_NAME, self.PATH_TO_ISO)) |
2608 | #self.run_or_die("VBoxManage startvm %s" % self.td.VBOX_NAME) |
2609 | return "VBoxManage startvm %s" % self.VBOX_NAME |
2610 | |
2611 | # Give this VM a few seconds to start up |
2612 | #time.sleep(5) |
2613 | # Loop as long as this VM is running |
2614 | - #while commands.getstatusoutput("VBoxManage list runningvms | grep -qs %s" % self.td.VBOX_NAME)[0] == 0: |
2615 | + #while commands.getstatusoutput("VBoxManage list runningvms | \ |
2616 | + # grep -qs %s" % self.td.VBOX_NAME)[0] == 0: |
2617 | # time.sleep(2) |
2618 | |
2619 | def run(self, cmd): |
2620 | |
2621 | === modified file 'testdrivegtk/AboutTestdrivegtkDialog.py' |
2622 | --- testdrivegtk/AboutTestdrivegtkDialog.py 2012-05-15 20:43:24 +0000 |
2623 | +++ testdrivegtk/AboutTestdrivegtkDialog.py 2013-10-06 20:59:44 +0000 |
2624 | @@ -1,20 +1,20 @@ |
2625 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
2626 | ### BEGIN LICENSE |
2627 | # Copyright (C) 2010 Canonical Ltd. |
2628 | -# |
2629 | +# |
2630 | # Authors: |
2631 | # Andres Rodriguez <andreserl@ubuntu.com> |
2632 | -# |
2633 | -# This program is free software: you can redistribute it and/or modify it |
2634 | -# under the terms of the GNU General Public License version 3, as published |
2635 | +# |
2636 | +# This program is free software: you can redistribute it and/or modify it |
2637 | +# under the terms of the GNU General Public License version 3, as published |
2638 | # by the Free Software Foundation. |
2639 | -# |
2640 | -# This program is distributed in the hope that it will be useful, but |
2641 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
2642 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
2643 | +# |
2644 | +# This program is distributed in the hope that it will be useful, but |
2645 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
2646 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
2647 | # PURPOSE. See the GNU General Public License for more details. |
2648 | -# |
2649 | -# You should have received a copy of the GNU General Public License along |
2650 | +# |
2651 | +# You should have received a copy of the GNU General Public License along |
2652 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
2653 | ### END LICENSE |
2654 | |
2655 | @@ -23,14 +23,16 @@ |
2656 | from testdrivegtk.helpers import get_builder |
2657 | |
2658 | import gettext |
2659 | -from gettext import gettext as _ |
2660 | +_ = gettext.gettext |
2661 | gettext.textdomain('testdrive') |
2662 | |
2663 | import commands |
2664 | -version = commands.getstatusoutput("dpkg -l testdrive-gtk | tail -n1 | awk '{print $3}'") |
2665 | +version = commands.getstatusoutput( |
2666 | + "dpkg -l testdrive-gtk | tail -n1 | awk '{print $3}'") |
2667 | |
2668 | __version__ = version[1].split("-0")[0] |
2669 | -__licensenotice__ = 'This program is free software: you can redistribute it and/or modify\n\ |
2670 | +__licensenotice__ = """ |
2671 | +'This program is free software: you can redistribute it and/or modify\n\ |
2672 | it under the terms of the GNU General Public License as published by\n\ |
2673 | the Free Software Foundation, either version 3 of the License, or\n\ |
2674 | (at your option) any later version.\n\ |
2675 | @@ -41,17 +43,18 @@ |
2676 | GNU General Public License for more details.\n\ |
2677 | \n\ |
2678 | You should have received a copy of the GNU General Public License\n\ |
2679 | -along with this program. If not, see <http://www.gnu.org/licenses/>.' |
2680 | +along with this program. If not, see <http://www.gnu.org/licenses/>. """ |
2681 | __authors__ = ['Andres Rodriguez <andreserl@ubuntu.com>'] |
2682 | -__description__ = 'PyGTK Front-end for TestDrive' |
2683 | +__description__ = _('PyGTK Front-end for TestDrive') |
2684 | __website__ = "https://launchpad.net/testdrive" |
2685 | __copyright__ = "Copyright © 2010 - 2012 Canonical Ltd." |
2686 | |
2687 | + |
2688 | class AboutTestdrivegtkDialog(gtk.AboutDialog): |
2689 | __gtype_name__ = "AboutTestdrivegtkDialog" |
2690 | |
2691 | def __new__(cls): |
2692 | - """Special static method that's automatically called by Python when |
2693 | + """Special static method that's automatically called by Python when |
2694 | constructing a new instance of this class. |
2695 | |
2696 | Returns a fully instantiated AboutTestdrivegtkDialog object. |
2697 | @@ -77,7 +80,7 @@ |
2698 | |
2699 | # Code for other initialization actions should be added here. |
2700 | dialog = builder.get_object("about_testdrivegtk_dialog") |
2701 | - |
2702 | + |
2703 | dialog.set_version(__version__) |
2704 | dialog.set_authors(__authors__) |
2705 | dialog.set_comments(__description__) |
2706 | |
2707 | === modified file 'testdrivegtk/AddOtherTestdrivegtkDialog.py' |
2708 | --- testdrivegtk/AddOtherTestdrivegtkDialog.py 2012-04-21 02:05:42 +0000 |
2709 | +++ testdrivegtk/AddOtherTestdrivegtkDialog.py 2013-10-06 20:59:44 +0000 |
2710 | @@ -6,17 +6,20 @@ |
2711 | import gtk |
2712 | |
2713 | from testdrivegtk.helpers import get_builder |
2714 | -import os, string, commands |
2715 | +import os |
2716 | +import string |
2717 | +import commands |
2718 | |
2719 | import gettext |
2720 | -from gettext import gettext as _ |
2721 | +_ = gettext.gettext |
2722 | gettext.textdomain('testdrive') |
2723 | |
2724 | + |
2725 | class AddOtherTestdrivegtkDialog(gtk.Dialog): |
2726 | __gtype_name__ = "AddothertestdrivegtkDialog" |
2727 | |
2728 | def __new__(cls, cache): |
2729 | - """Special static method that's automatically called by Python when |
2730 | + """Special static method that's automatically called by Python when |
2731 | constructing a new instance of this class. |
2732 | |
2733 | Returns a fully instantiated AddothertestdrivegtkDialog object. |
2734 | @@ -57,7 +60,7 @@ |
2735 | # Saving changes in the isos file |
2736 | path = "%s/other.isos" % self.CACHE |
2737 | try: |
2738 | - f = open(path,'w') |
2739 | + f = open(path, 'w') |
2740 | for item in self.liststore: |
2741 | iso = "other\tother\t\t%s\t\t%s\n" % (item[2], item[1]) |
2742 | f.write(iso) |
2743 | @@ -83,15 +86,17 @@ |
2744 | self.PROTO = None |
2745 | |
2746 | def on_error_dlg(self, data=None): |
2747 | - errorbox = gtk.MessageDialog(self, |
2748 | - gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, |
2749 | + errorbox = gtk.MessageDialog( |
2750 | + self, |
2751 | + gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, |
2752 | gtk.BUTTONS_CLOSE, data) |
2753 | response = errorbox.run() |
2754 | errorbox.destroy() |
2755 | |
2756 | def on_info_dlg(self, data=None): |
2757 | - errorbox = gtk.MessageDialog(self, |
2758 | - gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, |
2759 | + errorbox = gtk.MessageDialog( |
2760 | + self, |
2761 | + gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, |
2762 | gtk.BUTTONS_CLOSE, data) |
2763 | errorbox.run() |
2764 | errorbox.destroy() |
2765 | @@ -116,7 +121,7 @@ |
2766 | self.cb_sync_proto.set_active(0) |
2767 | |
2768 | def on_btn_del_iso_clicked(self, widget): |
2769 | - # When Delete button is clicked, deletes it from the list store, |
2770 | + # When Delete button is clicked, deletes it from the list store, |
2771 | # but changes are not saved |
2772 | selection = self.treeview.get_selection() |
2773 | model, iter = selection.get_selected() |
2774 | @@ -129,7 +134,7 @@ |
2775 | ###### Validating that the input URL si correct and exists ####### |
2776 | ################################################################## |
2777 | file = self.txt_other_url.get_text().strip() |
2778 | - desc = self.txt_other_desc.get_text().replace(' ','-') |
2779 | + desc = self.txt_other_desc.get_text().replace(' ', '-') |
2780 | |
2781 | if len(desc) == 0: |
2782 | self.on_error_dlg(_("Please insert a Description")) |
2783 | @@ -147,9 +152,10 @@ |
2784 | if string.find(file, "%s://" % i) == 0: |
2785 | self.url = file |
2786 | #If it's a local path, test it for viability |
2787 | - if commands.getstatusoutput("file \"%s\" | grep -qs \"ISO 9660\"" % file)[0] == 0: |
2788 | + if commands.getstatusoutput("file \"%s\" | grep -qs \"ISO 9660\"" |
2789 | + % file)[0] == 0: |
2790 | #return("file://%s" % file) |
2791 | - self.url ="file://%s" % file |
2792 | + self.url = "file://%s" % file |
2793 | |
2794 | if self.url is None: |
2795 | self.on_error_dlg(_("Invalid ISO URL [%s]") % file) |
2796 | @@ -163,12 +169,14 @@ |
2797 | url = url.replace(proto, 'http') |
2798 | if proto == 'file': |
2799 | pass |
2800 | - elif os.system("wget --spider -S %s 2>&1 | grep 'HTTP/1.. 200 OK'" % url) != 0: |
2801 | + elif os.system("wget --spider -S %s 2>&1 | grep 'HTTP/1.. 200 OK'" |
2802 | + % url) != 0: |
2803 | self.on_error_dlg(_("ISO not found at [%s]") % url) |
2804 | - return False |
2805 | + return False |
2806 | |
2807 | if self.PROTO is None: |
2808 | - self.on_error_dlg(_("No sync protocol has been selected, please select one.")) |
2809 | + self.on_error_dlg(_("No sync protocol has been selected, " |
2810 | + "please select one.")) |
2811 | return False |
2812 | else: |
2813 | return True |
2814 | @@ -205,9 +213,11 @@ |
2815 | if n >= 1: |
2816 | self.treeview.columns[n].cell.set_property('editable', True) |
2817 | # add the cells to the columns |
2818 | - self.treeview.columns[n].pack_start(self.treeview.columns[n].cell, True) |
2819 | + self.treeview.columns[n].pack_start( |
2820 | + self.treeview.columns[n].cell, True) |
2821 | # set the cell attributes to the appropriate liststore column |
2822 | - self.treeview.columns[n].set_attributes(self.treeview.columns[n].cell, text=n) |
2823 | + self.treeview.columns[n].set_attributes( |
2824 | + self.treeview.columns[n].cell, text=n) |
2825 | |
2826 | self.btn_add_other = self.builder.get_object("btn_add_iso") |
2827 | self.btn_add_other.connect("clicked", self.on_btn_add_iso_clicked) |
2828 | @@ -217,7 +227,8 @@ |
2829 | |
2830 | # Expander |
2831 | self.ex_other_iso_list = self.builder.get_object("ex_other_iso_list") |
2832 | - self.ex_other_iso_list.connect('notify::expanded', self.on_iso_list_expanded) |
2833 | + self.ex_other_iso_list.connect( |
2834 | + 'notify::expanded', self.on_iso_list_expanded) |
2835 | self.scroll_iso_list = self.builder.get_object("scrolledwindow1") |
2836 | self.ex_other_iso_list.remove(self.ex_other_iso_list.child) |
2837 | |
2838 | @@ -232,7 +243,8 @@ |
2839 | self.cb_sync_proto.connect('changed', self.on_select_sync_proto) |
2840 | self.cb_sync_proto.set_active(0) |
2841 | self.cb_sync_proto.show() |
2842 | - self.layout_table.attach(self.cb_sync_proto, 1,3,2,3, gtk.FILL | gtk.EXPAND, gtk.SHRINK) |
2843 | + self.layout_table.attach( |
2844 | + self.cb_sync_proto, 1, 3, 2, 3, gtk.FILL | gtk.EXPAND, gtk.SHRINK) |
2845 | |
2846 | def get_other_isos_list_from_cache(self): |
2847 | ################################################################## |
2848 | |
2849 | === modified file 'testdrivegtk/PreferencesTestdrivegtkDialog.py' |
2850 | --- testdrivegtk/PreferencesTestdrivegtkDialog.py 2013-08-10 21:31:38 +0000 |
2851 | +++ testdrivegtk/PreferencesTestdrivegtkDialog.py 2013-10-06 20:59:44 +0000 |
2852 | @@ -1,20 +1,20 @@ |
2853 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
2854 | ### BEGIN LICENSE |
2855 | # Copyright (C) 2010 Canonical Ltd. |
2856 | -# |
2857 | +# |
2858 | # Authors: |
2859 | # Andres Rodriguez <andreserl@ubuntu.com> |
2860 | -# |
2861 | -# This program is free software: you can redistribute it and/or modify it |
2862 | -# under the terms of the GNU General Public License version 3, as published |
2863 | +# |
2864 | +# This program is free software: you can redistribute it and/or modify it |
2865 | +# under the terms of the GNU General Public License version 3, as published |
2866 | # by the Free Software Foundation. |
2867 | -# |
2868 | -# This program is distributed in the hope that it will be useful, but |
2869 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
2870 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
2871 | +# |
2872 | +# This program is distributed in the hope that it will be useful, but |
2873 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
2874 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
2875 | # PURPOSE. See the GNU General Public License for more details. |
2876 | -# |
2877 | -# You should have received a copy of the GNU General Public License along |
2878 | +# |
2879 | +# You should have received a copy of the GNU General Public License along |
2880 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
2881 | ### END LICENSE |
2882 | |
2883 | @@ -29,19 +29,20 @@ |
2884 | from testdrivegtk.helpers import get_builder |
2885 | |
2886 | import gettext |
2887 | -from gettext import gettext as _ |
2888 | +_ = gettext.gettext |
2889 | gettext.textdomain('testdrive') |
2890 | |
2891 | ISO_REPOSITORY = ['cdimage', 'releases'] |
2892 | -MEM_SIZE_TAB = ['256', '384', '512', '1024', '2048',_('Other...')] |
2893 | -DISK_SIZE_TAB = ['4', '6', '8', '10', '16',_('Other...')] |
2894 | +MEM_SIZE_TAB = ['256', '384', '512', '1024', '2048', _('Other...')] |
2895 | +DISK_SIZE_TAB = ['4', '6', '8', '10', '16', _('Other...')] |
2896 | + |
2897 | |
2898 | class PreferencesTestdrivegtkDialog(gtk.Dialog): |
2899 | __gtype_name__ = "PreferencesTestdrivegtkDialog" |
2900 | preferences = {} |
2901 | |
2902 | def __new__(cls): |
2903 | - """Special static method that's automatically called by Python when |
2904 | + """Special static method that's automatically called by Python when |
2905 | constructing a new instance of this class. |
2906 | |
2907 | Returns a fully instantiated PreferencesTestdrivegtkDialog object. |
2908 | @@ -96,7 +97,7 @@ |
2909 | self.initialize_widgets() |
2910 | self.initialize_widgets_values() |
2911 | self.logger.debug(_('finish_initialization()')) |
2912 | - |
2913 | + |
2914 | self.builder.get_object("txt_gral_cache") |
2915 | |
2916 | def initialize_variables(self): |
2917 | @@ -119,11 +120,15 @@ |
2918 | self.txt_iso_list_cache = self.builder.get_object("txt_iso_list_cache") |
2919 | # Clean Ups |
2920 | self.btn_iso_clean = self.builder.get_object("btn_iso_clean") |
2921 | - self.btn_iso_clean.connect("clicked", self.on_cache_cleanup_clicked, self.td.CACHE_ISO) |
2922 | + self.btn_iso_clean.connect( |
2923 | + "clicked", self.on_cache_cleanup_clicked, self.td.CACHE_ISO) |
2924 | self.btn_img_clean = self.builder.get_object("btn_img_clean") |
2925 | - self.btn_img_clean.connect("clicked", self.on_cache_cleanup_clicked, self.td.CACHE_IMG) |
2926 | - self.btn_update_iso_list_cache = self.builder.get_object("btn_update_iso_list_cache") |
2927 | - self.btn_update_iso_list_cache.connect("clicked", self.on_force_iso_list_update) |
2928 | + self.btn_img_clean.connect( |
2929 | + "clicked", self.on_cache_cleanup_clicked, self.td.CACHE_IMG) |
2930 | + self.btn_update_iso_list_cache = self.builder.get_object( |
2931 | + "btn_update_iso_list_cache") |
2932 | + self.btn_update_iso_list_cache.connect( |
2933 | + "clicked", self.on_force_iso_list_update) |
2934 | |
2935 | # Ubuntu Releases |
2936 | self.chk_arch_i386 = self.builder.get_object("chk_arch_i386") |
2937 | @@ -136,33 +141,37 @@ |
2938 | self.cb_ubuntu_repo = gtk.combo_box_new_text() |
2939 | self.cb_ubuntu_repo.set_size_request(260, -1) |
2940 | self.cb_ubuntu_repo.append_text(_('Select Repository:')) |
2941 | - for repo in ISO_REPOSITORY: |
2942 | + for repo in ISO_REPOSITORY: |
2943 | self.cb_ubuntu_repo.append_text(repo) |
2944 | self.cb_ubuntu_repo.connect('changed', self.on_select_iso_image_repo) |
2945 | self.cb_ubuntu_repo.set_active(0) |
2946 | self.cb_ubuntu_repo.show() |
2947 | - self.tb_general_prefs.attach(self.cb_ubuntu_repo, 1,2,7,8) |
2948 | + self.tb_general_prefs.attach(self.cb_ubuntu_repo, 1, 2, 7, 8) |
2949 | # Ubuntu Releases Combo Box |
2950 | self.cb_ubuntu_release = gtk.combo_box_new_text() |
2951 | self.cb_ubuntu_release.set_size_request(260, -1) |
2952 | - self.cb_ubuntu_release.connect('changed', self.on_select_ubuntu_release) |
2953 | + self.cb_ubuntu_release.connect( |
2954 | + 'changed', self.on_select_ubuntu_release) |
2955 | self.cb_ubuntu_release.append_text(_('Select Release:')) |
2956 | self.cb_ubuntu_release.set_active(0) |
2957 | self.cb_ubuntu_release.show() |
2958 | - self.tb_general_prefs.attach(self.cb_ubuntu_release, 1,2,8,9) |
2959 | - |
2960 | + self.tb_general_prefs.attach(self.cb_ubuntu_release, 1, 2, 8, 9) |
2961 | + |
2962 | # Initialize Virtualization Method Options |
2963 | self.opt_virt_kvm = self.builder.get_object("opt_virt_kvm") |
2964 | - self.opt_virt_kvm.connect("toggled", self.on_select_virt_method, "kvm") |
2965 | + self.opt_virt_kvm.connect( |
2966 | + "toggled", self.on_select_virt_method, "kvm") |
2967 | self.opt_virt_vbox = self.builder.get_object("opt_virt_vbox") |
2968 | - self.opt_virt_vbox.connect("toggled", self.on_select_virt_method, "virtualbox") |
2969 | + self.opt_virt_vbox.connect( |
2970 | + "toggled", self.on_select_virt_method, "virtualbox") |
2971 | self.opt_virt_parallels = self.builder.get_object("opt_virt_parallels") |
2972 | - self.opt_virt_parallels.connect("toggled", self.on_select_virt_method, "parallels") |
2973 | + self.opt_virt_parallels.connect( |
2974 | + "toggled", self.on_select_virt_method, "parallels") |
2975 | |
2976 | # Initialize Memory Options |
2977 | self.cbe_mem_size = self.builder.get_object("cbe_mem_size") |
2978 | self.cbe_mem_size.remove_text(0) |
2979 | - for mem in MEM_SIZE_TAB: |
2980 | + for mem in MEM_SIZE_TAB: |
2981 | self.cbe_mem_size.append_text(mem) |
2982 | self.cbe_mem_size.connect('changed', self.on_select_mem) |
2983 | |
2984 | @@ -183,30 +192,42 @@ |
2985 | self.lb_smp_available = self.builder.get_object("lb_smp_available") |
2986 | |
2987 | # Flavors |
2988 | - self.chk_flavor_ubuntu = self.builder.get_object("chk_flavor_ubuntu") |
2989 | + self.chk_flavor_ubuntu = self.builder.get_object( |
2990 | + "chk_flavor_ubuntu") |
2991 | self.chk_flavor_ubuntu.connect("clicked", self.on_select_flavors) |
2992 | - self.chk_flavor_kubuntu = self.builder.get_object("chk_flavor_kubuntu") |
2993 | + self.chk_flavor_kubuntu = self.builder.get_object( |
2994 | + "chk_flavor_kubuntu") |
2995 | self.chk_flavor_kubuntu.connect("clicked", self.on_select_flavors) |
2996 | - self.chk_flavor_xubuntu = self.builder.get_object("chk_flavor_xubuntu") |
2997 | + self.chk_flavor_xubuntu = self.builder.get_object( |
2998 | + "chk_flavor_xubuntu") |
2999 | self.chk_flavor_xubuntu.connect("clicked", self.on_select_flavors) |
3000 | - self.chk_flavor_edubuntu = self.builder.get_object("chk_flavor_edubuntu") |
3001 | + self.chk_flavor_edubuntu = self.builder.get_object( |
3002 | + "chk_flavor_edubuntu") |
3003 | self.chk_flavor_edubuntu.connect("clicked", self.on_select_flavors) |
3004 | - self.chk_flavor_mythbuntu = self.builder.get_object("chk_flavor_mythbuntu") |
3005 | + self.chk_flavor_mythbuntu = self.builder.get_object( |
3006 | + "chk_flavor_mythbuntu") |
3007 | self.chk_flavor_mythbuntu.connect("clicked", self.on_select_flavors) |
3008 | - self.chk_flavor_ubuntustudio = self.builder.get_object("chk_flavor_ubuntustudio") |
3009 | + self.chk_flavor_ubuntustudio = self.builder.get_object( |
3010 | + "chk_flavor_ubuntustudio") |
3011 | self.chk_flavor_ubuntustudio.connect("clicked", self.on_select_flavors) |
3012 | - self.chk_flavor_lubuntu = self.builder.get_object("chk_flavor_lubuntu") |
3013 | + self.chk_flavor_lubuntu = self.builder.get_object( |
3014 | + "chk_flavor_lubuntu") |
3015 | self.chk_flavor_lubuntu.connect("clicked", self.on_select_flavors) |
3016 | - self.chk_flavor_ubuntukylin = self.builder.get_object("chk_flavor_ubuntukylin") |
3017 | + self.chk_flavor_ubuntukylin = self.builder.get_object( |
3018 | + "chk_flavor_ubuntukylin") |
3019 | self.chk_flavor_ubuntukylin.connect("clicked", self.on_select_flavors) |
3020 | - self.chk_flavor_other = self.builder.get_object("chk_flavor_other") |
3021 | + self.chk_flavor_other = self.builder.get_object( |
3022 | + "chk_flavor_other") |
3023 | self.chk_flavor_other.connect("clicked", self.on_select_flavors) |
3024 | |
3025 | def initialize_config_files(self): |
3026 | ################################################################## |
3027 | ########### Read the configuration file for settings ############# |
3028 | ################################################################## |
3029 | - config_files = ["/etc/%s" % self.td.PKGRC, "%s/.%s" % (self.td.HOME, self.td.PKGRC), "%s/.config/%s/%s" % (self.td.HOME, self.td.PKG, self.td.PKGRC) ] |
3030 | + config_files = ["/etc/%s" % self.td.PKGRC, |
3031 | + "%s/.%s" % (self.td.HOME, self.td.PKGRC), |
3032 | + "%s/.config/%s/%s" % (self.td.HOME, self.td.PKG, |
3033 | + self.td.PKGRC)] |
3034 | for file in config_files: |
3035 | if os.path.exists(file): |
3036 | try: |
3037 | @@ -216,7 +237,8 @@ |
3038 | #self.load_config_files(file) |
3039 | self.logger.debug(_("Reading config file: [%s]") % file) |
3040 | except: |
3041 | - self.logger.debug(_("Unable to load config file [%s]") % file) |
3042 | + self.logger.debug(_( |
3043 | + "Unable to load config file [%s]") % file) |
3044 | # return False |
3045 | #return True |
3046 | |
3047 | @@ -275,11 +297,13 @@ |
3048 | |
3049 | # KVM Args |
3050 | self.txt_kvm_args.set_text(self.td.KVM_ARGS) |
3051 | - |
3052 | + |
3053 | # SMP |
3054 | if self.td.SMP: |
3055 | self.txt_smp_nbr.set_text(self.td.SMP) |
3056 | - self.lb_smp_available.set_text(_(" of %s available.") % commands.getoutput("grep -c ^processor /proc/cpuinfo")) |
3057 | + self.lb_smp_available.set_text(_( |
3058 | + " of %s available." |
3059 | + ) % commands.getoutput("grep -c ^processor /proc/cpuinfo")) |
3060 | |
3061 | # Flavors |
3062 | i = 0 |
3063 | @@ -318,29 +342,36 @@ |
3064 | if arch == 'amd64': |
3065 | self.chk_arch_amd64.set_active(True) |
3066 | |
3067 | - def update_iso_cache(self, force_update = False): |
3068 | + def update_iso_cache(self, force_update=False): |
3069 | ################################################################## |
3070 | ###### Code to update the ISO list from the repository Cache ##### |
3071 | ################################################################## |
3072 | update_cache = None |
3073 | cdimage = False |
3074 | - """ Verify if the ISO list is cached, if not, set variable to update/create it. """ |
3075 | + """ Verify if the ISO list is cached, if not, |
3076 | + set variable to update/create it. """ |
3077 | if force_update is True: |
3078 | update_cache = 1 |
3079 | pass |
3080 | elif self.td.is_iso_list_cached() is False: |
3081 | update_cache = 1 |
3082 | - # If ISO list is cached, verify if it is expired. If it is, set variable to update it. |
3083 | + # If ISO list is cached, verify if it is expired. |
3084 | + # If it is, set variable to update it. |
3085 | elif self.td.is_iso_list_cache_expired() is True: |
3086 | update_cache = 1 |
3087 | |
3088 | - """ If variable set to update, obtain the ISO list from the Ubuntu CD Image repository. """ |
3089 | + """ If variable set to update, obtain the ISO |
3090 | + list from the Ubuntu CD Image repository. """ |
3091 | if update_cache == 1: |
3092 | - self.logger.info(_("Obtaining Ubuntu ISO list from %s...") % self.td.u) |
3093 | + self.logger.info(_(""" |
3094 | + Obtaining Ubuntu ISO list from %s... |
3095 | + """) % self.td.u) |
3096 | try: |
3097 | cdimage = self.td.obtain_ubuntu_iso_list_from_repo() |
3098 | except: |
3099 | - self.logger.error(_("Could not obtain the Ubuntu ISO list from %s...") % self.td.u) |
3100 | + self.logger.error(_(""" |
3101 | + Could not obtain the Ubuntu ISO list from %s... |
3102 | + """) % self.td.u) |
3103 | |
3104 | """ If the ISO List was obtained, update the cache file""" |
3105 | if cdimage: |
3106 | @@ -348,7 +379,9 @@ |
3107 | try: |
3108 | self.td.update_ubuntu_iso_list_cache(cdimage) |
3109 | except: |
3110 | - self.logger.error(_("Unable to update the Ubuntu ISO list cache...")) |
3111 | + self.logger.error(_(""" |
3112 | + Unable to update the Ubuntu ISO list cache... |
3113 | + """)) |
3114 | |
3115 | def get_preferences(self): |
3116 | """Returns preferences for testdrivegtk.""" |
3117 | @@ -393,8 +426,9 @@ |
3118 | pass |
3119 | |
3120 | def on_error_dlg(self, data=None): |
3121 | - errorbox = gtk.MessageDialog(self, |
3122 | - gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, |
3123 | + errorbox = gtk.MessageDialog( |
3124 | + self, |
3125 | + gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, |
3126 | gtk.BUTTONS_CLOSE, data) |
3127 | response = errorbox.run() |
3128 | errorbox.destroy() |
3129 | @@ -452,9 +486,9 @@ |
3130 | |
3131 | def on_select_arch(self, widget, arch): |
3132 | # On selecting the architecture |
3133 | - if widget.get_active() == True: |
3134 | + if widget.get_active(): |
3135 | self.arch.append(arch) |
3136 | - if widget.get_active() == False: |
3137 | + if not widget.get_active(): |
3138 | self.arch.remove(arch) |
3139 | |
3140 | def on_txt_gral_cache_focus_out_event(self, widget, data=None): |
3141 | @@ -476,7 +510,7 @@ |
3142 | os.unlink(path) |
3143 | except: |
3144 | on_error_dlg(_("Unable to clean up files from [%s]") % cache_path) |
3145 | - |
3146 | + |
3147 | def on_select_iso_image_repo(self, widget): |
3148 | ################################################################## |
3149 | #### Select image repo, populate Release combobox accordingly #### |
3150 | @@ -487,9 +521,11 @@ |
3151 | old_repo = self.td.p |
3152 | self.repo = model[index][0] |
3153 | self.td.p = self.repo |
3154 | - self.txt_iso_list_cache.set_text("%s/%s.isos" % (self.td.CACHE, self.td.p)) |
3155 | + self.txt_iso_list_cache.set_text("%s/%s.isos" % |
3156 | + (self.td.CACHE, self.td.p)) |
3157 | |
3158 | - # Update cache commented given the hack to sync every repo on initialization |
3159 | + # Update cache commented given the |
3160 | + # hack to sync every repo on initialization |
3161 | #self.update_iso_cache() |
3162 | # Populate the releases combobox |
3163 | self.cb_ubuntu_release.get_model().clear() |
3164 | @@ -536,30 +572,30 @@ |
3165 | ################################################################## |
3166 | self.preferences = [] |
3167 | # CACHE Variables |
3168 | - if self.txt_gral_cache.get_text() != None: |
3169 | + if self.txt_gral_cache.get_text() is not None: |
3170 | self.td.CACHE = self.txt_gral_cache.get_text() |
3171 | self.preferences.append(['cache', self.td.CACHE]) |
3172 | - if self.txt_img_cache.get_text() != None: |
3173 | + if self.txt_img_cache.get_text() is not None: |
3174 | self.td.CACHE_IMG = self.txt_img_cache.get_text() |
3175 | self.preferences.append(['cache_img', self.td.CACHE_IMG]) |
3176 | - if self.txt_iso_cache.get_text() != None: |
3177 | + if self.txt_iso_cache.get_text() is not None: |
3178 | self.td.CACHE_ISO = self.txt_iso_cache.get_text() |
3179 | self.preferences.append(['cache_iso', self.td.CACHE_ISO]) |
3180 | |
3181 | # Repo selection |
3182 | - if self.repo != None: |
3183 | + if self.repo is not None: |
3184 | self.preferences.append(['p', self.td.p]) |
3185 | |
3186 | - if self.r != None: |
3187 | + if self.r is not None: |
3188 | self.td.r = self.r |
3189 | self.preferences.append(['r', self.td.r]) |
3190 | |
3191 | # KVM Args |
3192 | - if self.txt_kvm_args.get_text() != None: |
3193 | + if self.txt_kvm_args.get_text() is not None: |
3194 | self.td.KVM_ARGS = self.txt_kvm_args.get_text() |
3195 | self.preferences.append(['kvm_args', self.td.KVM_ARGS]) |
3196 | |
3197 | - if self.txt_smp_nbr.get_text() != None: |
3198 | + if self.txt_smp_nbr.get_text() is not None: |
3199 | self.td.SMP = self.txt_smp_nbr.get_text() |
3200 | self.preferences.append(['smp', self.td.SMP]) |
3201 | |
3202 | @@ -573,21 +609,21 @@ |
3203 | self.preferences.append(['m', self.td.m[0]]) |
3204 | |
3205 | # VIRT Methods |
3206 | - if self.virt_method != None: |
3207 | + if self.virt_method is not None: |
3208 | self.td.VIRT = self.virt_method |
3209 | self.preferences.append(['virt', self.td.VIRT]) |
3210 | |
3211 | # Memory - TODO: Add validation of text |
3212 | if self.mem == 'other': |
3213 | self.mem = self.cbe_mem_size.child.get_text() |
3214 | - if self.mem != None or self.mem not in MEM_SIZE_TAB: |
3215 | + if self.mem is not None or self.mem not in MEM_SIZE_TAB: |
3216 | self.td.MEM = self.mem |
3217 | self.preferences.append(['mem', self.td.MEM]) |
3218 | |
3219 | # Disk Size - TODO: Add validation of text |
3220 | if self.disk_size == 'other': |
3221 | self.disk_size = self.cbe_disk_size.child.get_text() |
3222 | - if self.disk_size != None or self.disk_size not in DISK_SIZE_TAB: |
3223 | + if self.disk_size is not None or self.disk_size not in DISK_SIZE_TAB: |
3224 | self.td.DISK_SIZE = "%sG" % self.disk_size |
3225 | self.preferences.append(['disk_size', self.td.DISK_SIZE]) |
3226 | |
3227 | |
3228 | === modified file 'testdrivegtk/helpers.py' |
3229 | --- testdrivegtk/helpers.py 2012-04-21 02:05:42 +0000 |
3230 | +++ testdrivegtk/helpers.py 2013-10-06 20:59:44 +0000 |
3231 | @@ -1,20 +1,20 @@ |
3232 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
3233 | ### BEGIN LICENSE |
3234 | # Copyright (C) 2010 Canonical Ltd. |
3235 | -# |
3236 | +# |
3237 | # Authors: |
3238 | # Andres Rodriguez <andreserl@ubuntu.com> |
3239 | -# |
3240 | -# This program is free software: you can redistribute it and/or modify it |
3241 | -# under the terms of the GNU General Public License version 3, as published |
3242 | +# |
3243 | +# This program is free software: you can redistribute it and/or modify it |
3244 | +# under the terms of the GNU General Public License version 3, as published |
3245 | # by the Free Software Foundation. |
3246 | -# |
3247 | -# This program is distributed in the hope that it will be useful, but |
3248 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
3249 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
3250 | +# |
3251 | +# This program is distributed in the hope that it will be useful, but |
3252 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
3253 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
3254 | # PURPOSE. See the GNU General Public License for more details. |
3255 | -# |
3256 | -# You should have received a copy of the GNU General Public License along |
3257 | +# |
3258 | +# You should have received a copy of the GNU General Public License along |
3259 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
3260 | ### END LICENSE |
3261 | |
3262 | @@ -30,11 +30,12 @@ |
3263 | from testdrivegtk.testdrivegtkconfig import get_data_file |
3264 | |
3265 | import gettext |
3266 | -from gettext import gettext as _ |
3267 | +_ = gettext.gettext |
3268 | gettext.textdomain('testdrive') |
3269 | |
3270 | + |
3271 | def get_builder(builder_file_name): |
3272 | - """Return a fully-instantiated gtk.Builder instance from specified ui |
3273 | + """Return a fully-instantiated gtk.Builder instance from specified ui |
3274 | file |
3275 | |
3276 | :param builder_file_name: The name of the builder file, without extension. |
3277 | |
3278 | === modified file 'testdrivegtk/testdrivegtkconfig.py' |
3279 | --- testdrivegtk/testdrivegtkconfig.py 2012-04-21 02:05:42 +0000 |
3280 | +++ testdrivegtk/testdrivegtkconfig.py 2013-10-06 20:59:44 +0000 |
3281 | @@ -1,20 +1,20 @@ |
3282 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
3283 | ### BEGIN LICENSE |
3284 | # Copyright (C) 2010 Canonical Ltd. |
3285 | -# |
3286 | +# |
3287 | # Authors: |
3288 | # Andres Rodriguez <andreserl@ubuntu.com> |
3289 | -# |
3290 | -# This program is free software: you can redistribute it and/or modify it |
3291 | -# under the terms of the GNU General Public License version 3, as published |
3292 | +# |
3293 | +# This program is free software: you can redistribute it and/or modify it |
3294 | +# under the terms of the GNU General Public License version 3, as published |
3295 | # by the Free Software Foundation. |
3296 | -# |
3297 | -# This program is distributed in the hope that it will be useful, but |
3298 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
3299 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
3300 | +# |
3301 | +# This program is distributed in the hope that it will be useful, but |
3302 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
3303 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
3304 | # PURPOSE. See the GNU General Public License for more details. |
3305 | -# |
3306 | -# You should have received a copy of the GNU General Public License along |
3307 | +# |
3308 | +# You should have received a copy of the GNU General Public License along |
3309 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
3310 | ### END LICENSE |
3311 | |
3312 | @@ -37,9 +37,10 @@ |
3313 | import os |
3314 | |
3315 | import gettext |
3316 | -from gettext import gettext as _ |
3317 | +_ = gettext.gettext |
3318 | gettext.textdomain('testdrive') |
3319 | |
3320 | + |
3321 | class project_path_not_found(Exception): |
3322 | """Raised when we can't find the project directory.""" |
3323 |
Hi Jackson!
I like this fixes for sure.. however, it is way too big to review.. is there anyway you can split this in smaller branches? (Say one branch per binary, so that it is easier to test and review).
thank you! this is awesome!