Merge lp:~mbp/usb-creator/477529-cruzer into lp:usb-creator

Proposed by Martin Pool on 2010-01-30
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mbp/usb-creator/477529-cruzer
Merge into: lp:usb-creator
Diff against target: 112 lines (+27/-24)
3 files modified
TODO (+0/-2)
usbcreator/frontends/gtk/frontend.py (+14/-17)
usbcreator/install.py (+13/-5)
To merge this branch: bzr merge lp:~mbp/usb-creator/477529-cruzer
Reviewer Review Type Date Requested Status
Evan 2010-01-30 Approve on 2010-02-15
Review via email: mp+18311@code.launchpad.net
To post a comment you must log in.
Martin Pool (mbp) wrote :

This fixes two things related to bug 477529:

* if the source image is not an Ubuntu image (does not contain syslinux) you get a better clue
* when you add a new source to the source list, it is selected in the list

Martin Pool (mbp) wrote :

This doesn't fix it in the case where you use --iso

Martin Pool (mbp) wrote :

this new revision at least leaves the sources visible so you can see the wrong one is selected

lp:~mbp/usb-creator/477529-cruzer updated on 2010-01-30
263. By Martin Pool on 2010-01-30

Still show source vbox if --iso is given

Evan (ev) wrote :

Merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'TODO'
2--- TODO 2009-09-18 14:54:43 +0000
3+++ TODO 2010-01-30 18:31:13 +0000
4@@ -3,8 +3,6 @@
5 * Find out why resume from cancel install hangs the creator
6 * Implement icons in treeview similar to gtk frontend (warning, etc)
7 - need gio and get_gnome_drive equivalent functions from commit 205
8- * When adding a new source via "Other" make it selected/default
9- - does not currently do this and is annoying and confusing
10
11 TODO for usb-creator-win:
12 -------------------------
13
14=== modified file 'usbcreator/frontends/gtk/frontend.py'
15--- usbcreator/frontends/gtk/frontend.py 2010-01-21 22:28:23 +0000
16+++ usbcreator/frontends/gtk/frontend.py 2010-01-30 18:31:13 +0000
17@@ -129,8 +129,11 @@
18
19 # Pre-populate the source view.
20 if img is not None:
21+ # XXX: this doesn't make it selected by default, and it should.
22+ # It's a bit hard because other sources are asynchronously added
23+ # later by the backend? --
24+ # mbp 2010-01-30.
25 self.backend.add_image(img)
26- self.source_vbox.hide()
27
28 if not persistent:
29 self.persist_disabled.set_active(True)
30@@ -176,8 +179,8 @@
31
32 def add_source(self, source):
33 logging.debug('add_source: %s' % str(source))
34- model = self.source_treeview.get_model()
35- model.append([source])
36+ _append_to_list_and_select(self.source_treeview, [source],
37+ force_selection=True)
38
39 # XXX evand 2009-09-17: Find a label and icon for the device, if we
40 # don't already have one. This will go away when the code for the
41@@ -193,16 +196,10 @@
42 if not l and name:
43 self.names[source] = name
44
45- # Select the device in the treeview.
46- sel = self.source_treeview.get_selection()
47- m, i = sel.get_selected()
48- if not i:
49- sel.select_path(0)
50-
51 def add_target(self, target):
52 logging.debug('add_target: %s' % str(target))
53- model = self.dest_treeview.get_model()
54- model.append([target])
55+ _append_to_list_and_select(self.dest_treeview, [target],
56+ force_selection=False)
57
58 # XXX evand 2009-09-17: Find a label and icon for the device.
59 d = self.backend.targets[target]['device']
60@@ -213,12 +210,6 @@
61 if not l and name:
62 self.names[target] = name
63
64- # Select the device in the treeview.
65- sel = self.dest_treeview.get_selection()
66- m, i = sel.get_selected()
67- if not i:
68- sel.select_path(0)
69-
70 def remove_source(self, source):
71 model = self.source_treeview.get_model()
72 iterator = model.get_iter_first()
73@@ -681,4 +672,10 @@
74 if dir:
75 subprocess.Popen(['gnome-open', dir])
76
77+def _append_to_list_and_select(treeview, new_row, force_selection):
78+ model = treeview.get_model()
79+ new_iter = model.append(new_row)
80+ if force_selection or (treeview.get_selection().get_selected()[1] is None):
81+ treeview.set_cursor(model.get_path(new_iter))
82+
83 # vim: set ai et sts=4 tabstop=4 sw=4:
84
85=== modified file 'usbcreator/install.py'
86--- usbcreator/install.py 2009-10-26 17:05:17 +0000
87+++ usbcreator/install.py 2010-01-30 18:31:13 +0000
88@@ -216,11 +216,19 @@
89 def mangle_syslinux(self):
90 logging.debug('mangle_syslinux')
91 self.progress_message(_('Modifying configuration...'))
92- # Syslinux expects syslinux/syslinux.cfg.
93- os.renames(os.path.join(self.target, 'isolinux'),
94- os.path.join(self.target, 'syslinux'))
95- os.renames(os.path.join(self.target, 'syslinux', 'isolinux.cfg'),
96- os.path.join(self.target, 'syslinux', 'syslinux.cfg'))
97+ try:
98+ # Syslinux expects syslinux/syslinux.cfg.
99+ os.renames(os.path.join(self.target, 'isolinux'),
100+ os.path.join(self.target, 'syslinux'))
101+ os.renames(os.path.join(self.target, 'syslinux', 'isolinux.cfg'),
102+ os.path.join(self.target, 'syslinux', 'syslinux.cfg'))
103+ except (OSError, IOError), e:
104+ # Failure here probably means the source was not really an Ubuntu
105+ # image and did not have the files we wanted to move, see
106+ # <https://bugs.launchpad.net/launchpad-code/+bug/513432>
107+ self._failure(_('Could not move syslinux files in "%s": %s. '
108+ 'Maybe "%s" is not an Ubuntu image?') %
109+ (self.target, e, self.source))
110 self.check()
111
112 # Mangle the configuration files based on the options we've selected.

Subscribers

People subscribed via source and target branches