From patchwork Thu Aug 18 14:59:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Tunnicliffe X-Patchwork-Id: 3507 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4A80123F26 for ; Thu, 18 Aug 2011 14:59:15 +0000 (UTC) Received: from mail-ew0-f52.google.com (mail-ew0-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 34A7EA1809D for ; Thu, 18 Aug 2011 14:59:15 +0000 (UTC) Received: by ewy28 with SMTP id 28so1094616ewy.11 for ; Thu, 18 Aug 2011 07:59:15 -0700 (PDT) Received: by 10.213.29.147 with SMTP id q19mr1778704ebc.132.1313679554852; Thu, 18 Aug 2011 07:59:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.213.102.5 with SMTP id e5cs77800ebo; Thu, 18 Aug 2011 07:59:14 -0700 (PDT) Received: by 10.216.166.136 with SMTP id g8mr647414wel.24.1313679553890; Thu, 18 Aug 2011 07:59:13 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id y48si5837785wec.144.2011.08.18.07.59.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Aug 2011 07:59:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Qu43t-0003Ie-DV for ; Thu, 18 Aug 2011 14:59:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 5D284E0276 for ; Thu, 18 Aug 2011 14:59:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 411 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 411: Round 1 of updates to linaro-fetch-image-ui. Message-Id: <20110818145913.19950.77919.launchpad@ackee.canonical.com> Date: Thu, 18 Aug 2011 14:59:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13697"; Instance="initZopeless config overlay" X-Launchpad-Hash: 1cbb2b690544dce74558e91daf392bdcd58f8156 Merge authors: James Tunnicliffe (dooferlad) Related merge proposals: https://code.launchpad.net/~dooferlad/linaro-image-tools/fetch_image_ui_updates/+merge/71906 proposed by: James Tunnicliffe (dooferlad) review: Approve - James Westby (james-w) ------------------------------------------------------------ revno: 411 [merge] committer: James Tunnicliffe branch nick: linaro-image-tools timestamp: Thu 2011-08-18 15:58:29 +0100 message: Round 1 of updates to linaro-fetch-image-ui. This gives a new arrangement of the first two pages. modified: linaro-fetch-image-ui linaro_image_tools/fetch_image.py --- lp:linaro-image-tools https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk You are subscribed to branch lp:linaro-image-tools. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription === modified file 'linaro-fetch-image-ui' --- linaro-fetch-image-ui 2011-07-27 19:37:38 +0000 +++ linaro-fetch-image-ui 2011-08-18 09:40:29 +0000 @@ -32,6 +32,7 @@ import Queue import time import datetime +from linaro_image_tools.fetch_image import (QEMU, HARDWARE) def add_button(bind_to, @@ -56,21 +57,21 @@ return radio_button -class ReleaseOrSnapshotPage(wiz.PyWizardPage): +class ReleaseOrSnapshotPage(wiz.WizardPageSimple): """Ask the user if they want to use a release or a snapshot""" - def __init__(self, parent, config): - wiz.PyWizardPage.__init__(self, parent) + def __init__(self, parent, config, width): + wiz.WizardPageSimple.__init__(self, parent) self.config = config self.settings = self.config.settings self.sizer = wx.BoxSizer(wx.VERTICAL) self.next = None self.prev = None - self.sizer.Add(wx.StaticText(self, -1, -"""This Wizard will write an operating system of your choosing to -either a disk image or to an MMC card. First we need to know if -your priority is stability or the latest and greatest features.""")) + message = ("Would you like to use a Linaro release, or a more up to " + "date, but possibly unstable build?") + header = wx.StaticText(self, -1, message) + header.Wrap(width - 10) # -10 because boarder below is 5 pixels wide self.box1 = wx.BoxSizer(wx.VERTICAL) @@ -88,8 +89,8 @@ add_button(self, self.box1, self.button_text['snapshot'], None, self.event_radio_button_select, None, None) + self.sizer.Add(header) self.sizer.Add(self.box1, 0, wx.ALIGN_LEFT | wx.ALL, 5) - self.SetSizerAndFit(self.sizer) self.sizer.Fit(self) self.Move((50, 50)) @@ -102,14 +103,8 @@ else: self.settings['release_or_snapshot'] = "snapshot" - def SetNext(self, next): - self.next = next - - def GetNext(self): - return self.next - - -class AboutMyHardwarePage(wiz.WizardPageSimple): + +class AboutMyHardwarePage(wiz.PyWizardPage): """Ask the user about their hardware. This only asks about the board, not any specific hardware packs because there can be multiple names for the same hardware pack or sometimes a hardware pack is only available in the @@ -118,20 +113,21 @@ under advanced options in the Linaro Media Create options page""" - def __init__(self, parent, config, db, width): - wiz.WizardPageSimple.__init__(self, parent) + def __init__(self, parent, config, db): + wiz.PyWizardPage.__init__(self, parent) self.settings = config.settings self.db = db self.sizer = wx.BoxSizer(wx.VERTICAL) self.box1 = wx.BoxSizer(wx.VERTICAL) self.box2 = wx.BoxSizer(wx.VERTICAL) - - header = wx.StaticText(self, - label="Please select the hardware that you " - "would like to build an image for from " - "the following list") - - header.Wrap(width - 10) # -10 because boarder below is 5 pixels wide + self.next = None + + message = """\ +This Wizard will write an operating system of your choosing to either a disk +image or to an MMC card. First we need to know what hardware you have.""" + header = wx.StaticText(self, label=message) + + #--- Hardware Combo Box --- # Make sure that the displayed release is the one set in settings if @@ -154,8 +150,36 @@ self.Bind(wx.EVT_COMBOBOX, self.event_combo_box_hardware, self.cb_hardware) - self.box1.Add(self.cb_hardware, 0, - wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.TOP, 5) + #self.box1.Add(self.cb_hardware, 0, + # wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.TOP, 5) + + file_dev_grid = wx.FlexGridSizer(0, 1, 0, 0) + line_1_grid = wx.FlexGridSizer(0, 2, 0, 0) + self.box2.Add(file_dev_grid, 0, wx.EXPAND) + grid1 = wx.FlexGridSizer(0, 2, 0, 0) + + # self.settings['write_to_file_or_device'] should match the first + # button below... + self.button_text = {'hardware': "I have a", + 'sim': "I want to run on a hardware simulation."} + + self.settings['hw_or_qemu'] = HARDWARE + add_button(self, + line_1_grid, + self.button_text['hardware'], + wx.RB_GROUP, + self.event_radio_button_select, + None, None) + + line_1_grid.Add(self.cb_hardware) + file_dev_grid.Add(line_1_grid) + + add_button(self, + file_dev_grid, + self.button_text['sim'], + None, + self.event_radio_button_select, + None, None) self.sizer.Add(header) self.sizer.Add(self.box1, 0, wx.ALIGN_LEFT | wx.ALL, 5) @@ -191,8 +215,19 @@ self.settings['compatable_hwpacks'] = ( self.settings['choice']['hwpack'][self.settings['hardware']]) + def event_radio_button_select(self, event): + val = event.GetEventObject().GetLabel() + if val == self.button_text['sim']: + self.settings['hw_or_qemu'] = QEMU + elif val == self.button_text['hardware']: + self.settings['hw_or_qemu'] = HARDWARE #--- END event(s) --- + def SetNext(self, next): + self.next = next + + def GetNext(self): + return self.next class SelectStableRelease(wiz.WizardPageSimple): """Ask the user which Linaro release they would like to run.""" @@ -723,14 +758,16 @@ # self.settings['write_to_file_or_device'] should match the first # button below... self.settings['write_to_file_or_device'] = "file" - add_button(self, + self.file_button = add_button( + self, file_dev_grid, "Write to file", wx.RB_GROUP, self.event_radio_button_select, None, None) - add_button(self, + self.device_button = add_button( + self, file_dev_grid, "Write to device", None, @@ -885,6 +922,15 @@ def on_activate(self): self.update_forward_active_and_mmc_confirm_box_visible() self.set_hwpacks_for_hardware() + self.update_dev_file_buttons() + + def update_dev_file_buttons(self): + if self.settings['hw_or_qemu'] == QEMU: + self.device_button.Disable() + self.device_button.SetValue(False) + self.file_button.SetValue(True) + else: + self.device_button.Enable() def set_hwpacks_for_hardware(self): self.cb_hwpacks.Clear() @@ -1445,9 +1491,6 @@ if page == self.pages['hardware_details']: self.pages['select_os'].fill_os_list() - if page == self.pages['release_or_snapshot']: - self.pages['hardware_details'].on_page_changing() - # If about to move into the release selection, make sure the list # is populated only with releases that are valid with our current # selection @@ -1492,15 +1535,16 @@ self.wizard = wiz.Wizard(self, -1, "Linaro Media Builder") self.pages = {} + self.pages['hardware_details'] = AboutMyHardwarePage(self.wizard, + self.config, + db) + + self.wizard.FitToPage(self.pages['hardware_details']) + (width, height) = self.wizard.GetSize() + self.pages['release_or_snapshot'] = ReleaseOrSnapshotPage(self.wizard, - self.config) - self.wizard.FitToPage(self.pages['release_or_snapshot']) - (width, height) = self.wizard.GetSize() - - self.pages['hardware_details'] = AboutMyHardwarePage(self.wizard, - self.config, - db, - width) + self.config, + width) self.pages['select_release'] = SelectStableRelease(self.wizard, self.config, @@ -1527,14 +1571,14 @@ db, width) - self.pages['release_or_snapshot'].SetNext( + self.pages['hardware_details'].SetNext( + self.pages['release_or_snapshot']) + + self.pages['release_or_snapshot'].SetPrev( self.pages['hardware_details']) - self.pages['hardware_details'].SetPrev( - self.pages['release_or_snapshot']) - - self.pages['hardware_details'].SetNext(self.pages['select_os']) - self.pages['select_os'].SetPrev(self.pages['hardware_details']) + self.pages['release_or_snapshot'].SetNext(self.pages['select_os']) + self.pages['select_os'].SetPrev(self.pages['release_or_snapshot']) # Select OS goes to select build, which is customised for # releases or snapshots self.pages['lmc_settings'].SetNext(self.pages['run_lmc']) @@ -1543,7 +1587,8 @@ for (name, page) in self.pages.items(): self.wizard.GetPageAreaSizer().Add(page) - self.wizard.RunWizard(self.pages['release_or_snapshot']) + self.pages['hardware_details'].on_page_changing() + self.wizard.RunWizard(self.pages['hardware_details']) def run(): === modified file 'linaro_image_tools/fetch_image.py' --- linaro_image_tools/fetch_image.py 2011-08-17 12:46:05 +0000 +++ linaro_image_tools/fetch_image.py 2011-08-18 14:58:29 +0000 @@ -37,6 +37,8 @@ import subprocess import utils +QEMU = "qemu" +HARDWARE = "hardware" class DownloadManager(): def __init__(self, cachedir):