usb-creator-hackers team mailing list archive
-
usb-creator-hackers team
-
Mailing list archive
-
Message #00045
[Merge] lp:~dmitrij.ledkov/usb-creator/install-button into lp:usb-creator
Dmitrijs Ledkovs has proposed merging lp:~dmitrij.ledkov/usb-creator/install-button into lp:usb-creator.
Requested reviews:
usb-creator hackers (usb-creator-hackers)
Related bugs:
#582531 trunk: install button does not become sensitive, when valid source image is selected
https://bugs.launchpad.net/bugs/582531
The install button has sensitivity set to false in UI xml by default, because update_target might not run (no usb device attached).
Pre-populated images from --iso switch or from downloads dir where added to the backend's pool of source images, but none of them where set current while the UI had first one selected. Fixed by calling changed_source callback after the images are populated.
The above two were causing logic breakage in the update_target when it was calculating whether install button should be sensitive of not.
Also update_target was only checking if the current_source as seen by backend is SOURCE_IMG while SOURCE_ISO is a valid choice as well. Fixed that as well.
When testing all of this I've realised that there is no feedback to the user if the image supplied by --iso is indeed valid one. So if the image supplied by a switch, it becomes first choice and preselected as current_source, and other images are shown as well. If the image cannot be used the label next to the other tells that =) test with:
$ touch bla.iso
$ usb-creator-gtk -i bla.iso
Overall this bug in usb-creator-gtk caused me loads of head-keyboard banging while trying to test & compare with my infant cli frontend.
Should we scan ~/.cache/testdrive/iso/ for pre-populated images as well? =)
--
https://code.launchpad.net/~dmitrij.ledkov/usb-creator/install-button/+merge/26558
Your team usb-creator hackers is requested to review the proposed merge of lp:~dmitrij.ledkov/usb-creator/install-button into lp:usb-creator.
=== modified file 'debian/changelog'
--- debian/changelog 2010-05-27 15:13:58 +0000
+++ debian/changelog 2010-06-02 04:44:25 +0000
@@ -42,6 +42,8 @@
* Use XDG_CACHE_DIR for usb-creator.log
* Use XDG IconTheme spec for window icons (LP: #535061)
+ * Fix install button sensetivity (LP: #582531)
+ * Improve command line supplied --iso handling in gtk frontend
[ Ignace Mouzannar ]
* Initial Debian release (Closes: #582884, #576359)
=== modified file 'gui/usbcreator-gtk.ui'
--- gui/usbcreator-gtk.ui 2010-05-18 16:00:05 +0000
+++ gui/usbcreator-gtk.ui 2010-06-02 04:44:25 +0000
@@ -389,6 +389,7 @@
<object class="GtkButton" id="button_install">
<property name="label" translatable="yes">Make Startup Disk</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
=== modified file 'usbcreator/frontends/gtk/frontend.py'
--- usbcreator/frontends/gtk/frontend.py 2010-05-21 04:09:58 +0000
+++ usbcreator/frontends/gtk/frontend.py 2010-06-02 04:44:25 +0000
@@ -151,8 +151,12 @@
# Pre-populate the source view.
if img is not None:
+ logging.debug('--iso: %s' % str(img))
self.backend.add_image(img)
- self.source_vbox.hide()
+ if not self.backend.sources:
+ logging.error('--iso: %s' % str(img))
+ msg = _('Cannot use: ')
+ self.source_status.set_text(msg + img)
download_dir = glib.get_user_special_dir(glib.USER_DIRECTORY_DOWNLOAD)
if download_dir and os.path.isdir(download_dir):
@@ -161,6 +165,9 @@
if fname.endswith('.iso') or fname.endswith('.img'):
self.backend.add_image(os.path.join(download_dir, fname))
+ # Sets first pre-populated image as current in the backend
+ self.selection_changed_source(self.source_treeview.get_selection())
+
if not persistent:
self.persist_disabled.set_active(True)
self.persist_vbox.hide()
@@ -441,15 +448,11 @@
# Update install button state.
status = target['status']
source = self.backend.get_current_source()
- if status == CAN_USE:
- self.button_install.set_sensitive(True)
- else:
- self.button_install.set_sensitive(False)
if not source:
+ self.button_install.set_sensitive(False)
return
stype = self.backend.sources[source]['type']
- if (self.button_install.get_property('sensitive')
- and stype == SOURCE_IMG):
+ if status == CAN_USE and stype in (SOURCE_IMG, SOURCE_ISO):
self.button_install.set_sensitive(True)
else:
self.button_install.set_sensitive(False)
Follow ups