Branch 'develop' - 5 commits - data/liveusb-creator.ui get_releases.py liveusb/gui.py liveusb/linux_dialog.py liveusb/releases.py

Luke Macken lmacken at fedoraproject.org
Tue Jan 15 17:28:28 UTC 2013


 data/liveusb-creator.ui |  180 ++++++++++++++++++++++++++----------------------
 get_releases.py         |    8 +-
 liveusb/gui.py          |   31 ++++++--
 liveusb/linux_dialog.py |  129 ++++++++++++++++++++--------------
 liveusb/releases.py     |  114 +++++++++++++++++++++++-------
 5 files changed, 296 insertions(+), 166 deletions(-)

New commits:
commit 71c9e1d47c36581fee1f4f42c27febee772737a4
Author: Luke Macken <lmacken at redhat.com>
Date:   Tue Jan 15 12:27:10 2013 -0500

    Enable the close button (issue #3)

diff --git a/liveusb/gui.py b/liveusb/gui.py
index 95a6ff4..eb6af73 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -262,6 +262,7 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
         self.in_process = False
         QtGui.QDialog.__init__(self)
         LiveUSBInterface.__init__(self)
+        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint)
         self.opts = opts
         self.args = args
         self.setupUi(self)
@@ -334,6 +335,7 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
         self.live.log.info(_('Releases updated!'))
 
     def connect_slots(self):
+        self.connect(self, QtCore.SIGNAL('triggered()'), self.terminate)
         self.connect(self.isoBttn, QtCore.SIGNAL("clicked()"), self.selectfile)
         self.connect(self.startButton, QtCore.SIGNAL("clicked()"), self.begin)
         self.connect(self.overlaySlider, QtCore.SIGNAL("valueChanged(int)"),


commit e2ad6b4489756271f47d2b72948c57240e8d3dd9
Author: Luke Macken <lmacken at redhat.com>
Date:   Tue Jan 15 12:27:05 2013 -0500

    Update the copyright

diff --git a/liveusb/gui.py b/liveusb/gui.py
index e568fea..95a6ff4 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright © 2008-2010  Red Hat, Inc. All rights reserved.
-# Copyright © 2008-2010  Luke Macken <lmacken at redhat.com>
+# Copyright © 2008-2013  Red Hat, Inc. All rights reserved.
+# Copyright © 2008-2013  Luke Macken <lmacken at redhat.com>
 # Copyright © 2008  Kushal Das <kushal at fedoraproject.org>
 #
 # This copyrighted material is made available to anyone wishing to use, modify,


commit c45d28249c5b3a89d5624a76b37c1d9bd300f0ed
Author: Luke Macken <lmacken at redhat.com>
Date:   Tue Jan 15 12:14:17 2013 -0500

    Add f18 to our hardcoded release list

diff --git a/liveusb/releases.py b/liveusb/releases.py
index 080ff21..b483d7b 100644
--- a/liveusb/releases.py
+++ b/liveusb/releases.py
@@ -7,6 +7,18 @@ ARCHES = ('i386', 'i686', 'x86_64')
 
 # A backup list of releases, just in case we can't fetch them.
 fedora_releases = [
+    {'name': 'Fedora 18 i686 Desktop',
+     'sha256': '7c7f453c15a5d13df95bf8caab6277e5aab1c6353eb242b1cf00344b61869d26',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Live/i386/Fedora-18-i686-Live-Desktop.iso'},
+    {'name': 'Fedora 18 i686 KDE',
+     'sha256': 'f172192566d0e12c29a741a568a917c5d8643aa781fdf06598b12a217a58cb74',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Live/i386/Fedora-18-i686-Live-KDE.iso'},
+    {'name': 'Fedora 18 x86_64 Desktop',
+     'sha256': 'a276e06d244e04b765f0a35532d9036ad84f340b0bdcc32e0233a8fbc31d5bed',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Live/x86_64/Fedora-18-x86_64-Live-Desktop.iso'},
+    {'name': 'Fedora 18 x86_64 KDE',
+     'sha256': '41d51d86ff5c272263285d00a0c3da7acbbce404b9930b0ff8bd7226e7248805',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Live/x86_64/Fedora-18-x86_64-Live-KDE.iso'},
     {'name': 'Fedora 17 i686 Desktop',
      'sha256': '26027f4d4686f1df186b31ce773dbb903db18f4b1aa37a1e37f0fa6ff4111f42',
      'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Live/i686/Fedora-17-i686-Live-Desktop.iso'},


commit fe8266b0757b4ebdc662aa2ec93b06a02bbba425
Author: Luke Macken <lmacken at redhat.com>
Date:   Tue Jan 15 12:12:29 2013 -0500

    Add a button for refreshing the list of releases

diff --git a/data/liveusb-creator.ui b/data/liveusb-creator.ui
index f2c2c48..2623ff8 100755
--- a/data/liveusb-creator.ui
+++ b/data/liveusb-creator.ui
@@ -1,7 +1,8 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>Dialog</class>
- <widget class="QDialog" name="Dialog" >
-  <property name="geometry" >
+ <widget class="QDialog" name="Dialog">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
@@ -9,20 +10,20 @@
     <height>388</height>
    </rect>
   </property>
-  <property name="sizePolicy" >
-   <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
     <horstretch>0</horstretch>
     <verstretch>0</verstretch>
    </sizepolicy>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Fedora LiveUSB Creator</string>
   </property>
-  <widget class="QPushButton" name="startButton" >
-   <property name="enabled" >
+  <widget class="QPushButton" name="startButton">
+   <property name="enabled">
     <bool>true</bool>
    </property>
-   <property name="geometry" >
+   <property name="geometry">
     <rect>
      <x>130</x>
      <y>350</y>
@@ -30,15 +31,15 @@
      <height>34</height>
     </rect>
    </property>
-   <property name="whatsThis" >
+   <property name="whatsThis">
     <string>This button will begin the LiveUSB creation process.  This entails optionally downloading a release (if an existing one wasn't selected),  extracting the ISO to the USB device, creating the persistent overlay, and installing the bootloader.</string>
    </property>
-   <property name="text" >
+   <property name="text">
     <string>Create Live USB</string>
    </property>
   </widget>
-  <widget class="QTextEdit" name="textEdit" >
-   <property name="geometry" >
+  <widget class="QTextEdit" name="textEdit">
+   <property name="geometry">
     <rect>
      <x>10</x>
      <y>200</y>
@@ -46,20 +47,20 @@
      <height>111</height>
     </rect>
    </property>
-   <property name="font" >
+   <property name="font">
     <font>
      <pointsize>8</pointsize>
     </font>
    </property>
-   <property name="whatsThis" >
+   <property name="whatsThis">
     <string>This is the status console, where all messages get written to.</string>
    </property>
-   <property name="readOnly" >
+   <property name="readOnly">
     <bool>true</bool>
    </property>
   </widget>
-  <widget class="QProgressBar" name="progressBar" >
-   <property name="geometry" >
+  <widget class="QProgressBar" name="progressBar">
+   <property name="geometry">
     <rect>
      <x>10</x>
      <y>320</y>
@@ -67,15 +68,15 @@
      <height>23</height>
     </rect>
    </property>
-   <property name="whatsThis" >
+   <property name="whatsThis">
     <string>This is the progress bar that will indicate how far along in the LiveUSB creation process you are</string>
    </property>
-   <property name="value" >
+   <property name="value">
     <number>0</number>
    </property>
   </widget>
-  <widget class="QGroupBox" name="downloadGroup" >
-   <property name="geometry" >
+  <widget class="QGroupBox" name="downloadGroup">
+   <property name="geometry">
     <rect>
      <x>210</x>
      <y>80</y>
@@ -83,30 +84,50 @@
      <height>51</height>
     </rect>
    </property>
-   <property name="font" >
+   <property name="font">
     <font>
      <pointsize>8</pointsize>
     </font>
    </property>
-   <property name="whatsThis" >
+   <property name="whatsThis">
     <string>If you do not select an existing Live CD, the selected release will be downloaded for you.</string>
    </property>
-   <property name="title" >
+   <property name="title">
     <string>Download Fedora</string>
    </property>
-   <widget class="QComboBox" name="downloadCombo" >
-    <property name="geometry" >
+   <widget class="QComboBox" name="downloadCombo">
+    <property name="geometry">
      <rect>
       <x>10</x>
       <y>20</y>
-      <width>181</width>
+      <width>161</width>
       <height>22</height>
      </rect>
     </property>
    </widget>
+   <widget class="QPushButton" name="refreshReleasesButton">
+    <property name="geometry">
+     <rect>
+      <x>170</x>
+      <y>20</y>
+      <width>30</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+    <property name="icon">
+     <iconset resource="resources.qrc">
+      <normaloff>:/refresh.png</normaloff>:/refresh.png</iconset>
+    </property>
+    <property name="flat">
+     <bool>true</bool>
+    </property>
+   </widget>
   </widget>
-  <widget class="QLabel" name="label_2" >
-   <property name="geometry" >
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
     <rect>
      <x>180</x>
      <y>100</y>
@@ -114,7 +135,7 @@
      <height>24</height>
     </rect>
    </property>
-   <property name="font" >
+   <property name="font">
     <font>
      <family>Verdana</family>
      <pointsize>10</pointsize>
@@ -122,12 +143,12 @@
      <bold>true</bold>
     </font>
    </property>
-   <property name="text" >
+   <property name="text">
     <string>or</string>
    </property>
   </widget>
-  <widget class="QGroupBox" name="groupBox" >
-   <property name="geometry" >
+  <widget class="QGroupBox" name="groupBox">
+   <property name="geometry">
     <rect>
      <x>10</x>
      <y>80</y>
@@ -135,19 +156,19 @@
      <height>51</height>
     </rect>
    </property>
-   <property name="font" >
+   <property name="font">
     <font>
      <pointsize>8</pointsize>
     </font>
    </property>
-   <property name="whatsThis" >
+   <property name="whatsThis">
     <string>This button allows you to browse for an existing Live CD ISO that you have previously downloaded.  If you do not select one, a release will be downloaded for you automatically.</string>
    </property>
-   <property name="title" >
+   <property name="title">
     <string>Use existing Live CD</string>
    </property>
-   <widget class="QPushButton" name="isoBttn" >
-    <property name="geometry" >
+   <widget class="QPushButton" name="isoBttn">
+    <property name="geometry">
      <rect>
       <x>11</x>
       <y>18</y>
@@ -155,16 +176,16 @@
       <height>25</height>
      </rect>
     </property>
-    <property name="text" >
+    <property name="text">
      <string>Browse</string>
     </property>
-    <property name="shortcut" >
+    <property name="shortcut">
      <string>Alt+B</string>
     </property>
    </widget>
   </widget>
-  <widget class="QGroupBox" name="groupBox_2" >
-   <property name="geometry" >
+  <widget class="QGroupBox" name="groupBox_2">
+   <property name="geometry">
     <rect>
      <x>10</x>
      <y>140</y>
@@ -172,58 +193,59 @@
      <height>51</height>
     </rect>
    </property>
-   <property name="font" >
+   <property name="font">
     <font>
      <pointsize>8</pointsize>
     </font>
    </property>
-   <property name="whatsThis" >
+   <property name="whatsThis">
     <string>This is the USB stick that you want to install your Live CD on.  This device must be formatted with the FAT filesystem.</string>
    </property>
-   <property name="title" >
+   <property name="title">
     <string>Target Device</string>
    </property>
-   <widget class="QComboBox" name="driveBox" >
-    <property name="geometry" >
+   <widget class="QComboBox" name="driveBox">
+    <property name="geometry">
      <rect>
       <x>10</x>
       <y>20</y>
-      <width>145</width>
-      <height>20</height>
+      <width>151</width>
+      <height>21</height>
      </rect>
     </property>
-    <property name="editable" >
+    <property name="editable">
      <bool>false</bool>
     </property>
-    <property name="insertPolicy" >
+    <property name="insertPolicy">
      <enum>QComboBox::InsertAtTop</enum>
     </property>
-    <property name="duplicatesEnabled" >
+    <property name="duplicatesEnabled">
      <bool>false</bool>
     </property>
    </widget>
-   <widget class="QPushButton" name="refreshDevicesButton" >
-    <property name="geometry" >
+   <widget class="QPushButton" name="refreshDevicesButton">
+    <property name="geometry">
      <rect>
-      <x>156</x>
-      <y>16</y>
+      <x>160</x>
+      <y>20</y>
       <width>30</width>
-      <height>26</height>
+      <height>20</height>
      </rect>
     </property>
-    <property name="text" >
+    <property name="text">
      <string/>
     </property>
-    <property name="icon" >
-     <iconset resource="resources.qrc" >:/refresh.png</iconset>
+    <property name="icon">
+     <iconset resource="resources.qrc">
+      <normaloff>:/refresh.png</normaloff>:/refresh.png</iconset>
     </property>
-    <property name="flat" >
+    <property name="flat">
      <bool>true</bool>
     </property>
    </widget>
   </widget>
-  <widget class="QGroupBox" name="overlayTitle" >
-   <property name="geometry" >
+  <widget class="QGroupBox" name="overlayTitle">
+   <property name="geometry">
     <rect>
      <x>210</x>
      <y>140</y>
@@ -231,19 +253,19 @@
      <height>51</height>
     </rect>
    </property>
-   <property name="font" >
+   <property name="font">
     <font>
      <pointsize>8</pointsize>
     </font>
    </property>
-   <property name="whatsThis" >
-    <string comment="comment!" >By allocating extra space on your USB stick for a persistent overlay, you will be able to store data and make permanent modifications to your live operating system.  Without it, you will not be able to save data that will persist after a reboot.</string>
+   <property name="whatsThis">
+    <string comment="comment!">By allocating extra space on your USB stick for a persistent overlay, you will be able to store data and make permanent modifications to your live operating system.  Without it, you will not be able to save data that will persist after a reboot.</string>
    </property>
-   <property name="title" >
+   <property name="title">
     <string>Persistent Storage (0 MB)</string>
    </property>
-   <widget class="QSlider" name="overlaySlider" >
-    <property name="geometry" >
+   <widget class="QSlider" name="overlaySlider">
+    <property name="geometry">
      <rect>
       <x>10</x>
       <y>20</y>
@@ -251,19 +273,19 @@
       <height>21</height>
      </rect>
     </property>
-    <property name="maximum" >
+    <property name="maximum">
      <number>2047</number>
     </property>
-    <property name="orientation" >
+    <property name="orientation">
      <enum>Qt::Horizontal</enum>
     </property>
-    <property name="tickPosition" >
+    <property name="tickPosition">
      <enum>QSlider::NoTicks</enum>
     </property>
    </widget>
   </widget>
-  <widget class="QLabel" name="label" >
-   <property name="geometry" >
+  <widget class="QLabel" name="label">
+   <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
@@ -271,16 +293,16 @@
      <height>72</height>
     </rect>
    </property>
-   <property name="text" >
+   <property name="text">
     <string/>
    </property>
-   <property name="pixmap" >
-    <pixmap resource="resources.qrc" >:/liveusb-header.png</pixmap>
+   <property name="pixmap">
+    <pixmap resource="resources.qrc">:/liveusb-header.png</pixmap>
    </property>
   </widget>
  </widget>
  <resources>
-  <include location="resources.qrc" />
+  <include location="resources.qrc"/>
  </resources>
  <connections/>
 </ui>
diff --git a/liveusb/gui.py b/liveusb/gui.py
index 9d1850b..e568fea 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -34,7 +34,7 @@ from datetime import datetime
 from PyQt4 import QtCore, QtGui
 
 from liveusb import LiveUSBCreator, LiveUSBError, LiveUSBInterface, _
-from liveusb.releases import releases
+from liveusb.releases import releases, get_fedora_releases
 if sys.platform == 'win32':
     from liveusb.urlgrabber.grabber import URLGrabber, URLGrabError
     from liveusb.urlgrabber.progress import BaseMeter
@@ -52,7 +52,7 @@ except:
 class LiveUSBApp(QtGui.QApplication):
     """ Main application class """
     def __init__(self, opts, args):
-        QtGui.QApplication.__init__(self, args) 
+        QtGui.QApplication.__init__(self, args)
         self.mywindow = LiveUSBDialog(opts, args)
         self.mywindow.show()
         try:
@@ -118,7 +118,7 @@ class DownloadProgress(QtCore.QObject, BaseMeter):
 class ProgressThread(QtCore.QThread):
     """ A thread that monitors the progress of Live USB creation.
 
-    This thread periodically checks the amount of free space left on the 
+    This thread periodically checks the amount of free space left on the
     given drive and sends a signal to our main dialog window to update the
     progress bar.
     """
@@ -182,7 +182,7 @@ class LiveUSBThread(QtCore.QThread):
 
             self.live.verify_filesystem()
             if not self.live.drive['uuid'] and not self.live.label:
-                self.status(_("Error: Cannot set the label or obtain " 
+                self.status(_("Error: Cannot set the label or obtain "
                               "the UUID of your device.  Unable to continue."))
                 self.live.log.removeHandler(handler)
                 return
@@ -325,6 +325,14 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
         for release in [release['name'] for release in releases]:
             self.downloadCombo.addItem(release)
 
+    def refresh_releases(self):
+        self.live.log.info(_('Refreshing releases...'))
+        fedora_releases = get_fedora_releases()
+        self.downloadCombo.clear()
+        for release in [release['name'] for release in fedora_releases]:
+            self.downloadCombo.addItem(release)
+        self.live.log.info(_('Releases updated!'))
+
     def connect_slots(self):
         self.connect(self.isoBttn, QtCore.SIGNAL("clicked()"), self.selectfile)
         self.connect(self.startButton, QtCore.SIGNAL("clicked()"), self.begin)
@@ -351,6 +359,9 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
         if hasattr(self, 'refreshDevicesButton'):
             self.connect(self.refreshDevicesButton, QtCore.SIGNAL("clicked()"),
                          self.populate_devices)
+        if hasattr(self, 'refreshReleasesButton'):
+            self.connect(self.refreshReleasesButton, QtCore.SIGNAL("clicked()"),
+                         self.refresh_releases)
 
         # If we have access to HAL & DBus, intercept some useful signals
         if hasattr(self.live, 'udisks'):
@@ -438,6 +449,8 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
         self.downloadCombo.setEnabled(enabled)
         if hasattr(self, 'refreshDevicesButton'):
             self.refreshDevicesButton.setEnabled(enabled)
+        if hasattr(self, 'refreshReleasesButton'):
+            self.refreshReleasesButton.setEnabled(enabled)
         self.in_process = not enabled
 
     def overlay_value(self, value):
@@ -506,7 +519,7 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
                 return
             else:
                 # The user has confirmed that they wish to overwrite their
-                # existing Live OS.  Here we delete it first, in order to 
+                # existing Live OS.  Here we delete it first, in order to
                 # accurately calculate progress.
                 self.confirmed = False
                 try:
@@ -566,7 +579,7 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface):
                               "You may have better luck if you move your ISO "
                               "to the root of your drive (ie: C:\)"))
 
-            self.live.log.info('%s ' % os.path.basename(self.live.iso) + 
+            self.live.log.info('%s ' % os.path.basename(self.live.iso) +
                                _("selected"))
             self._refresh_overlay_slider()
 
diff --git a/liveusb/linux_dialog.py b/liveusb/linux_dialog.py
index 38e039e..754af54 100644
--- a/liveusb/linux_dialog.py
+++ b/liveusb/linux_dialog.py
@@ -1,19 +1,32 @@
 # -*- coding: utf-8 -*-
 
-# Form implementation generated from reading ui file 'data/liveusb-creator-linux.ui'
+# Form implementation generated from reading ui file 'data/liveusb-creator.ui'
 #
-# Created: Mon Dec 29 19:22:24 2008
-#      by: PyQt4 UI code generator 4.4.3
+# Created: Tue Jan 15 12:09:54 2013
+#      by: PyQt4 UI code generator 4.9.6
 #
 # WARNING! All changes made in this file will be lost!
 
 from PyQt4 import QtCore, QtGui
-from liveusb import _
+
+try:
+    _fromUtf8 = QtCore.QString.fromUtf8
+except AttributeError:
+    def _fromUtf8(s):
+        return s
+
+try:
+    _encoding = QtGui.QApplication.UnicodeUTF8
+    def _translate(context, text, disambig):
+        return QtGui.QApplication.translate(context, text, disambig, _encoding)
+except AttributeError:
+    def _translate(context, text, disambig):
+        return QtGui.QApplication.translate(context, text, disambig)
 
 class Ui_Dialog(object):
     def setupUi(self, Dialog):
-        Dialog.setObjectName("Dialog")
-        Dialog.resize(430, 388)
+        Dialog.setObjectName(_fromUtf8("Dialog"))
+        Dialog.resize(422, 388)
         sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
         sizePolicy.setHorizontalStretch(0)
         sizePolicy.setVerticalStretch(0)
@@ -21,95 +34,109 @@ class Ui_Dialog(object):
         Dialog.setSizePolicy(sizePolicy)
         self.startButton = QtGui.QPushButton(Dialog)
         self.startButton.setEnabled(True)
-        self.startButton.setGeometry(QtCore.QRect(112, 348, 209, 34))
-        self.startButton.setObjectName("startButton")
+        self.startButton.setGeometry(QtCore.QRect(130, 350, 158, 34))
+        self.startButton.setObjectName(_fromUtf8("startButton"))
         self.textEdit = QtGui.QTextEdit(Dialog)
-        self.textEdit.setGeometry(QtCore.QRect(8, 200, 409, 111))
+        self.textEdit.setGeometry(QtCore.QRect(10, 200, 401, 111))
         font = QtGui.QFont()
         font.setPointSize(8)
         self.textEdit.setFont(font)
         self.textEdit.setReadOnly(True)
-        self.textEdit.setObjectName("textEdit")
+        self.textEdit.setObjectName(_fromUtf8("textEdit"))
         self.progressBar = QtGui.QProgressBar(Dialog)
-        self.progressBar.setGeometry(QtCore.QRect(10, 320, 405, 23))
-        self.progressBar.setProperty("value", QtCore.QVariant(0))
-        self.progressBar.setTextVisible(True)
-        self.progressBar.setObjectName("progressBar")
+        self.progressBar.setGeometry(QtCore.QRect(10, 320, 401, 23))
+        self.progressBar.setProperty("value", 0)
+        self.progressBar.setObjectName(_fromUtf8("progressBar"))
         self.downloadGroup = QtGui.QGroupBox(Dialog)
-        self.downloadGroup.setGeometry(QtCore.QRect(216, 80, 205, 51))
+        self.downloadGroup.setGeometry(QtCore.QRect(210, 80, 201, 51))
         font = QtGui.QFont()
         font.setPointSize(8)
         self.downloadGroup.setFont(font)
-        self.downloadGroup.setObjectName("downloadGroup")
+        self.downloadGroup.setObjectName(_fromUtf8("downloadGroup"))
         self.downloadCombo = QtGui.QComboBox(self.downloadGroup)
-        self.downloadCombo.setGeometry(QtCore.QRect(8, 20, 189, 25))
-        self.downloadCombo.setObjectName("downloadCombo")
+        self.downloadCombo.setGeometry(QtCore.QRect(10, 20, 161, 22))
+        self.downloadCombo.setObjectName(_fromUtf8("downloadCombo"))
+        self.refreshReleasesButton = QtGui.QPushButton(self.downloadGroup)
+        self.refreshReleasesButton.setGeometry(QtCore.QRect(170, 20, 30, 20))
+        self.refreshReleasesButton.setText(_fromUtf8(""))
+        icon = QtGui.QIcon()
+        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/refresh.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
+        self.refreshReleasesButton.setIcon(icon)
+        self.refreshReleasesButton.setFlat(True)
+        self.refreshReleasesButton.setObjectName(_fromUtf8("refreshReleasesButton"))
         self.label_2 = QtGui.QLabel(Dialog)
-        self.label_2.setGeometry(QtCore.QRect(184, 100, 23, 24))
+        self.label_2.setGeometry(QtCore.QRect(180, 100, 23, 24))
         font = QtGui.QFont()
-        font.setFamily("Verdana")
+        font.setFamily(_fromUtf8("Verdana"))
         font.setPointSize(10)
-        font.setWeight(75)
         font.setBold(True)
+        font.setWeight(75)
         self.label_2.setFont(font)
-        self.label_2.setObjectName("label_2")
+        self.label_2.setObjectName(_fromUtf8("label_2"))
         self.groupBox = QtGui.QGroupBox(Dialog)
-        self.groupBox.setGeometry(QtCore.QRect(12, 80, 161, 51))
+        self.groupBox.setGeometry(QtCore.QRect(10, 80, 161, 51))
         font = QtGui.QFont()
         font.setPointSize(8)
         self.groupBox.setFont(font)
-        self.groupBox.setObjectName("groupBox")
+        self.groupBox.setObjectName(_fromUtf8("groupBox"))
         self.isoBttn = QtGui.QPushButton(self.groupBox)
         self.isoBttn.setGeometry(QtCore.QRect(11, 18, 141, 25))
-        self.isoBttn.setObjectName("isoBttn")
+        self.isoBttn.setObjectName(_fromUtf8("isoBttn"))
         self.groupBox_2 = QtGui.QGroupBox(Dialog)
-        self.groupBox_2.setGeometry(QtCore.QRect(10, 140, 201, 51))
+        self.groupBox_2.setGeometry(QtCore.QRect(10, 140, 191, 51))
         font = QtGui.QFont()
         font.setPointSize(8)
         self.groupBox_2.setFont(font)
-        self.groupBox_2.setObjectName("groupBox_2")
+        self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
         self.driveBox = QtGui.QComboBox(self.groupBox_2)
-        self.driveBox.setGeometry(QtCore.QRect(10, 20, 181, 25))
+        self.driveBox.setGeometry(QtCore.QRect(10, 20, 151, 21))
         self.driveBox.setEditable(False)
         self.driveBox.setInsertPolicy(QtGui.QComboBox.InsertAtTop)
         self.driveBox.setDuplicatesEnabled(False)
-        self.driveBox.setObjectName("driveBox")
+        self.driveBox.setObjectName(_fromUtf8("driveBox"))
+        self.refreshDevicesButton = QtGui.QPushButton(self.groupBox_2)
+        self.refreshDevicesButton.setGeometry(QtCore.QRect(160, 20, 30, 20))
+        self.refreshDevicesButton.setText(_fromUtf8(""))
+        self.refreshDevicesButton.setIcon(icon)
+        self.refreshDevicesButton.setFlat(True)
+        self.refreshDevicesButton.setObjectName(_fromUtf8("refreshDevicesButton"))
         self.overlayTitle = QtGui.QGroupBox(Dialog)
-        self.overlayTitle.setGeometry(QtCore.QRect(216, 140, 211, 51))
+        self.overlayTitle.setGeometry(QtCore.QRect(210, 140, 201, 51))
         font = QtGui.QFont()
         font.setPointSize(8)
         self.overlayTitle.setFont(font)
-        self.overlayTitle.setObjectName("overlayTitle")
+        self.overlayTitle.setObjectName(_fromUtf8("overlayTitle"))
         self.overlaySlider = QtGui.QSlider(self.overlayTitle)
         self.overlaySlider.setGeometry(QtCore.QRect(10, 20, 181, 21))
         self.overlaySlider.setMaximum(2047)
         self.overlaySlider.setOrientation(QtCore.Qt.Horizontal)
         self.overlaySlider.setTickPosition(QtGui.QSlider.NoTicks)
-        self.overlaySlider.setObjectName("overlaySlider")
+        self.overlaySlider.setObjectName(_fromUtf8("overlaySlider"))
         self.label = QtGui.QLabel(Dialog)
-        self.label.setGeometry(QtCore.QRect(0, 0, 431, 72))
-        self.label.setPixmap(QtGui.QPixmap(":/liveusb-header.png"))
-        self.label.setObjectName("label")
+        self.label.setGeometry(QtCore.QRect(0, 0, 430, 72))
+        self.label.setText(_fromUtf8(""))
+        self.label.setPixmap(QtGui.QPixmap(_fromUtf8(":/liveusb-header.png")))
+        self.label.setObjectName(_fromUtf8("label"))
 
         self.retranslateUi(Dialog)
         QtCore.QMetaObject.connectSlotsByName(Dialog)
 
     def retranslateUi(self, Dialog):
-        Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", _("Fedora LiveUSB Creator"), None, QtGui.QApplication.UnicodeUTF8))
-        self.startButton.setWhatsThis(QtGui.QApplication.translate("Dialog", _("This button will begin the LiveUSB creation process.  This entails optionally downloading a release (if an existing one wasn\'t selected),  extracting the ISO to the USB device, creating the persistent overlay, and installing the bootloader."), None, QtGui.QApplication.UnicodeUTF8))
-        self.startButton.setText(QtGui.QApplication.translate("Dialog", _("Create Live USB"), None, QtGui.QApplication.UnicodeUTF8))
-        self.textEdit.setWhatsThis(QtGui.QApplication.translate("Dialog", _("This is the status console, where all messages get written to."), None, QtGui.QApplication.UnicodeUTF8))
-        self.progressBar.setWhatsThis(QtGui.QApplication.translate("Dialog", _("This is the progress bar that will indicate how far along in the LiveUSB creation process you are"), None, QtGui.QApplication.UnicodeUTF8))
-        self.downloadGroup.setWhatsThis(QtGui.QApplication.translate("Dialog", _("If you do not select an existing Live CD, the selected release will be downloaded for you."), None, QtGui.QApplication.UnicodeUTF8))
-        self.downloadGroup.setTitle(QtGui.QApplication.translate("Dialog", _("Download Fedora"), None, QtGui.QApplication.UnicodeUTF8))
-        self.label_2.setText(QtGui.QApplication.translate("Dialog", _("or"), None, QtGui.QApplication.UnicodeUTF8))
-        self.groupBox.setWhatsThis(QtGui.QApplication.translate("Dialog", _("This button allows you to browse for an existing Live CD ISO that you have previously downloaded.  If you do not select one, a release will be downloaded for you automatically."), None, QtGui.QApplication.UnicodeUTF8))
-        self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", _("Use existing Live CD"), None, QtGui.QApplication.UnicodeUTF8))
-        self.isoBttn.setText(QtGui.QApplication.translate("Dialog", _("Browse"), None, QtGui.QApplication.UnicodeUTF8))
-        self.isoBttn.setShortcut(QtGui.QApplication.translate("Dialog", "Alt+B", None, QtGui.QApplication.UnicodeUTF8))
-        self.groupBox_2.setWhatsThis(QtGui.QApplication.translate("Dialog", _("This is the USB stick that you want to install your Live CD on.  This device must be formatted with the FAT filesystem."), None, QtGui.QApplication.UnicodeUTF8))
-        self.groupBox_2.setTitle(QtGui.QApplication.translate("Dialog", _("Target Device"), None, QtGui.QApplication.UnicodeUTF8))
-        self.overlayTitle.setWhatsThis(QtGui.QApplication.translate("Dialog", _("By allocating extra space on your USB stick for a persistent overlay, you will be able to store data and make permanent modifications to your live operating system.  Without it, you will not be able to save data that will persist after a reboot."), None, QtGui.QApplication.UnicodeUTF8))
-        self.overlayTitle.setTitle(QtGui.QApplication.translate("Dialog", _("Persistent Storage") + " (0 MB)", None, QtGui.QApplication.UnicodeUTF8))
+        Dialog.setWindowTitle(_translate("Dialog", "Fedora LiveUSB Creator", None))
+        self.startButton.setWhatsThis(_translate("Dialog", "This button will begin the LiveUSB creation process.  This entails optionally downloading a release (if an existing one wasn\'t selected),  extracting the ISO to the USB device, creating the persistent overlay, and installing the bootloader.", None))
+        self.startButton.setText(_translate("Dialog", "Create Live USB", None))
+        self.textEdit.setWhatsThis(_translate("Dialog", "This is the status console, where all messages get written to.", None))
+        self.progressBar.setWhatsThis(_translate("Dialog", "This is the progress bar that will indicate how far along in the LiveUSB creation process you are", None))
+        self.downloadGroup.setWhatsThis(_translate("Dialog", "If you do not select an existing Live CD, the selected release will be downloaded for you.", None))
+        self.downloadGroup.setTitle(_translate("Dialog", "Download Fedora", None))
+        self.label_2.setText(_translate("Dialog", "or", None))
+        self.groupBox.setWhatsThis(_translate("Dialog", "This button allows you to browse for an existing Live CD ISO that you have previously downloaded.  If you do not select one, a release will be downloaded for you automatically.", None))
+        self.groupBox.setTitle(_translate("Dialog", "Use existing Live CD", None))
+        self.isoBttn.setText(_translate("Dialog", "Browse", None))
+        self.isoBttn.setShortcut(_translate("Dialog", "Alt+B", None))
+        self.groupBox_2.setWhatsThis(_translate("Dialog", "This is the USB stick that you want to install your Live CD on.  This device must be formatted with the FAT filesystem.", None))
+        self.groupBox_2.setTitle(_translate("Dialog", "Target Device", None))
+        self.overlayTitle.setWhatsThis(_translate("Dialog", "By allocating extra space on your USB stick for a persistent overlay, you will be able to store data and make permanent modifications to your live operating system.  Without it, you will not be able to save data that will persist after a reboot.", "comment!"))
+        self.overlayTitle.setTitle(_translate("Dialog", "Persistent Storage (0 MB)", None))
 
 import resources_rc
diff --git a/liveusb/releases.py b/liveusb/releases.py
index 6611090..080ff21 100644
--- a/liveusb/releases.py
+++ b/liveusb/releases.py
@@ -1,29 +1,39 @@
-releases = (
- {'name': 'Fedora 17 i686 Desktop',
-  'sha256': '26027f4d4686f1df186b31ce773dbb903db18f4b1aa37a1e37f0fa6ff4111f42',
-  'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Live/i686/Fedora-17-i686-Live-Desktop.iso'},
- {'name': 'Fedora 17 i686 KDE',
-  'sha256': 'f10142bb0a4d91a0d8320a925fa33ab3a87d9764b03137bb30506830c1068583',
-  'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Live/i686/Fedora-17-i686-Live-KDE.iso'},
- {'name': 'Fedora 17 x86_64 Desktop',
-  'sha256': 'dfd19d677790fea6144bcf537cd031dfb0a50e6c56652c94bfc71ea7bb949f2c',
-  'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Live/x86_64/Fedora-17-x86_64-Live-Desktop.iso'},
- {'name': 'Fedora 17 x86_64 KDE',
-  'sha256': '58b9abf5ef6a07b75b6a934468c783ab18e5a1236e6e5ab75dc2b39ca7680462',
-  'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Live/x86_64/Fedora-17-x86_64-Live-KDE.iso'},
- {'name': 'Fedora 16 i686 Desktop',
-  'sha256': '561d2c15fa79c319959cfc821650c829860651d1e5b125b2a425ac9cbd3fe1bb',
-  'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Live/i686/Fedora-16-i686-Live-Desktop.iso'},
- {'name': 'Fedora 16 i686 KDE',
-  'sha256': '822567e4b05f7be6b89c14e6165f4c9e0f388379c3f90e0bf439dd8397e87a3f',
-  'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Live/i686/Fedora-16-i686-Live-KDE.iso'},
- {'name': 'Fedora 16 x86_64 Desktop',
-  'sha256': '632b2de39033ed1d4a61959c4002e07248793eff828ac5d60edbb7b5dcd7be5c',
-  'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Live/x86_64/Fedora-16-x86_64-Live-Desktop.iso'},
- {'name': 'Fedora 16 x86_64 KDE',
-  'sha256': 'b10ff86610e46244b11f0a411915e80ca4fdf1e8ec20ee5b61f700feb0716ba8',
-  'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Live/x86_64/Fedora-16-x86_64-Live-KDE.iso'},
+import re
+from urlgrabber import urlread
+from urlgrabber.grabber import URLGrabError
 
+FEDORA_RELEASES = 'http://dl.fedoraproject.org/pub/fedora/linux/releases/'
+ARCHES = ('i386', 'i686', 'x86_64')
+
+# A backup list of releases, just in case we can't fetch them.
+fedora_releases = [
+    {'name': 'Fedora 17 i686 Desktop',
+     'sha256': '26027f4d4686f1df186b31ce773dbb903db18f4b1aa37a1e37f0fa6ff4111f42',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Live/i686/Fedora-17-i686-Live-Desktop.iso'},
+    {'name': 'Fedora 17 i686 KDE',
+     'sha256': 'f10142bb0a4d91a0d8320a925fa33ab3a87d9764b03137bb30506830c1068583',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Live/i686/Fedora-17-i686-Live-KDE.iso'},
+    {'name': 'Fedora 17 x86_64 Desktop',
+     'sha256': 'dfd19d677790fea6144bcf537cd031dfb0a50e6c56652c94bfc71ea7bb949f2c',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Live/x86_64/Fedora-17-x86_64-Live-Desktop.iso'},
+    {'name': 'Fedora 17 x86_64 KDE',
+     'sha256': '58b9abf5ef6a07b75b6a934468c783ab18e5a1236e6e5ab75dc2b39ca7680462',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Live/x86_64/Fedora-17-x86_64-Live-KDE.iso'},
+    {'name': 'Fedora 16 i686 Desktop',
+     'sha256': '561d2c15fa79c319959cfc821650c829860651d1e5b125b2a425ac9cbd3fe1bb',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Live/i686/Fedora-16-i686-Live-Desktop.iso'},
+    {'name': 'Fedora 16 i686 KDE',
+     'sha256': '822567e4b05f7be6b89c14e6165f4c9e0f388379c3f90e0bf439dd8397e87a3f',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Live/i686/Fedora-16-i686-Live-KDE.iso'},
+    {'name': 'Fedora 16 x86_64 Desktop',
+     'sha256': '632b2de39033ed1d4a61959c4002e07248793eff828ac5d60edbb7b5dcd7be5c',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Live/x86_64/Fedora-16-x86_64-Live-Desktop.iso'},
+    {'name': 'Fedora 16 x86_64 KDE',
+     'sha256': 'b10ff86610e46244b11f0a411915e80ca4fdf1e8ec20ee5b61f700feb0716ba8',
+     'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Live/x86_64/Fedora-16-x86_64-Live-KDE.iso'},
+]
+
+other_releases = [
     ##
     ## Custom spins
     ##
@@ -32,4 +42,44 @@ releases = (
         'url': 'https://alt.fedoraproject.org/pub/alt/spins/linux/releases/16/Spins/i686/Fedora-16-i686-Live-SoaS.iso',
         'sha256': '5aa938737cc4ebeb1d269c4d8b2bf56e41bacd1967c3997b8969b42b88b63bfa',
     },
-)
+]
+
+releases = fedora_releases + other_releases
+
+
+def get_fedora_releases():
+    global releases
+    fedora_releases = []
+    try:
+        html = urlread(FEDORA_RELEASES)
+        for release in re.findall(r'<a href="(\d+)/">', html)[-2:][::-1]:
+            for arch in ARCHES:
+                arch_url = FEDORA_RELEASES + '%s/Live/%s/' % (release, arch)
+                try:
+                    files = urlread(arch_url)
+                except URLGrabError:
+                    continue
+                for link in re.findall(r'<a href="(.*)">', files):
+                    if link.endswith('-CHECKSUM'):
+                        checksum = urlread(arch_url + link)
+                        for line in checksum.split('\n'):
+                            try:
+                                sha256, filename = line.split()
+                                if filename[0] != '*':
+                                    continue
+                                filename = filename[1:]
+                                chunks = filename[:-4].split('-')
+                                chunks.remove('Live')
+                                name = ' '.join(chunks)
+                                fedora_releases.append(dict(
+                                    name=name,
+                                    url=arch_url + filename,
+                                    sha256=sha256,
+                                ))
+                            except ValueError:
+                                pass
+        releases = fedora_releases + other_releases
+    except:
+        # Can't fetch releases from the internet.
+        releases += other_releases
+    return releases


commit 008dc0ee86fbac6fc90e4f32d2baa59ef68c13ec
Author: Luke Macken <lmacken at redhat.com>
Date:   Tue Jan 15 09:28:48 2013 -0500

    F18 live images are under i386 now

diff --git a/get_releases.py b/get_releases.py
index 6fb5054..c8e067d 100644
--- a/get_releases.py
+++ b/get_releases.py
@@ -1,8 +1,9 @@
 import re
 from urlgrabber import urlread
+from urlgrabber.grabber import URLGrabError
 
 FEDORA_RELEASES = 'http://dl.fedoraproject.org/pub/fedora/linux/releases/'
-ARCHES = ('i686', 'x86_64')
+ARCHES = ('i386', 'i686', 'x86_64')
 
 def get_fedora_releases():
     releases = []
@@ -10,7 +11,10 @@ def get_fedora_releases():
     for release in re.findall(r'<a href="(\d+)/">', html)[-2:][::-1]:
         for arch in ARCHES:
             arch_url = FEDORA_RELEASES + '%s/Live/%s/' % (release, arch)
-            files = urlread(arch_url)
+            try:
+                files = urlread(arch_url)
+            except URLGrabError:
+                continue
             for link in re.findall(r'<a href="(.*)">', files):
                 if link.endswith('-CHECKSUM'):
                     checksum = urlread(arch_url + link)




More information about the liveusb-creator mailing list