From patchwork Mon Aug 22 08:04:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Tunnicliffe X-Patchwork-Id: 3596 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 163BE23FA3 for ; Mon, 22 Aug 2011 08:04:18 +0000 (UTC) Received: from mail-gx0-f180.google.com (mail-gx0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id AAFBAA185F4 for ; Mon, 22 Aug 2011 08:04:17 +0000 (UTC) Received: by gxk10 with SMTP id 10so4945735gxk.11 for ; Mon, 22 Aug 2011 01:04:17 -0700 (PDT) Received: by 10.150.47.2 with SMTP id u2mr1966292ybu.162.1314000257099; Mon, 22 Aug 2011 01:04:17 -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.150.157.17 with SMTP id f17cs187023ybe; Mon, 22 Aug 2011 01:04:16 -0700 (PDT) Received: by 10.227.39.154 with SMTP id g26mr1739024wbe.37.1314000255502; Mon, 22 Aug 2011 01:04:15 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id fn13si5395740wbb.117.2011.08.22.01.04.15 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Aug 2011 01:04:15 -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 1QvPUU-0007fG-OW for ; Mon, 22 Aug 2011 08:04:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id AE82DE01C4 for ; Mon, 22 Aug 2011 08:04:14 +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: 418 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 418: * All hardware that is available is shown on page 1 Message-Id: <20110822080414.2035.97435.launchpad@ackee.canonical.com> Date: Mon, 22 Aug 2011 08:04:14 -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: 8cf6809e738b41b267319e5584fcd74be3ccfc8a Merge authors: James Tunnicliffe (dooferlad) Related merge proposals: https://code.launchpad.net/~dooferlad/linaro-image-tools/ui_hw_availability_fix/+merge/72294 proposed by: James Tunnicliffe (dooferlad) review: Approve - James Westby (james-w) ------------------------------------------------------------ revno: 418 [merge] committer: James Tunnicliffe branch nick: linaro-image-tools timestamp: Mon 2011-08-22 09:02:31 +0100 message: * All hardware that is available is shown on page 1 * If you chose hardware that doesn't have a build type available (release or snapshot) that build type is greyed out on page 2 with some help text saying why. modified: linaro-fetch-image-ui --- 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-08-19 15:11:02 +0000 +++ linaro-fetch-image-ui 2011-08-20 12:44:34 +0000 @@ -77,6 +77,7 @@ self.width = width self.settings['image'] = None self.os_selected = True + self.width = width message = ("Would you like to use a Linaro release, or a more up to " "date, but possibly unstable build?") @@ -90,14 +91,16 @@ 'snapshot': "I would like to run untested, but " "more up-to-date software."} - add_button(self, self.box1, self.button_text['release'], - wx.RB_GROUP, self.event_radio_button_select, None, None) + self.rel_btn = add_button(self, self.box1, self.button_text['release'], + wx.RB_GROUP, self.event_radio_button_select, + None, None) # Save the setting for the default selected value self.settings['release_or_snapshot'] = "release" - add_button(self, self.box1, self.button_text['snapshot'], None, - self.event_radio_button_select, None, None) + self.snap_btn = add_button(self, self.box1, + self.button_text['snapshot'], None, + self.event_radio_button_select, None, None) self.cp = wx.CollapsiblePane(self, label="Advanced Options", style=wx.CP_DEFAULT_STYLE | @@ -107,10 +110,13 @@ self.make_pane_content(self.cp.GetPane()) self.box2 = wx.BoxSizer(wx.VERTICAL) self.box2.Add(self.cp) - + + self.help_text_main = wx.StaticText(self, -1, "") + self.sizer.Add(header) self.sizer.Add(self.box1, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.sizer.Add(self.box2, 0, wx.ALIGN_LEFT | wx.ALL, 5) + self.sizer.Add(self.help_text_main, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.SetSizerAndFit(self.sizer) self.sizer.Fit(self) self.Move((50, 50)) @@ -390,6 +396,50 @@ self.cb_image.SetValue( self.get_human_os_name(self.settings['image'])[0]) + def force_rel_snap_if_hw_requires(self): + """ + If a hardware pack is only available on a release or snapshot build + then force self.settings['release_or_snapshot'] and grey out the + other radio button. Also display a helpful message. + """ + + snapshot_ok = False + release_ok = False + + for hwpack in self.settings['compatable_hwpacks']: + if self.db.hardware_is_available_in_table("snapshot_hwpacks", + hwpack): + snapshot_ok = True + if self.db.hardware_is_available_in_table("release_hwpacks", + hwpack): + release_ok = True + + assert release_ok or snapshot_ok, ("release or snapshot should have" + "a hardware pack available") + + self.rel_btn.Enable() + self.snap_btn.Enable() + message = "" + + if not release_ok: + self.settings['release_or_snapshot'] = "snapshot" + self.rel_btn.Disable() + self.rel_btn.SetValue(False) + self.snap_btn.SetValue(True) + message = ("The hardware you have chosen is only available for " + "snapshot builds, so release builds have been disabled") + + if not snapshot_ok: + self.settings['release_or_snapshot'] = "release" + self.snap_btn.Disable() + self.snap_btn.SetValue(False) + self.rel_btn.SetValue(True) + message = ("The hardware you have chosen is only available for " + "release builds, so snapshot builds have been disabled") + + self.help_text_main.SetLabel(message) + self.help_text_main.Wrap(self.width - 10) + def GetNext(self): if self.settings['release_or_snapshot'] == "release": return self.pages['lmc_settings'] @@ -546,11 +596,12 @@ .iteritems(), key=operator.itemgetter(1)) - table = self.settings['release_or_snapshot'] + "_hwpacks" - for device_name, human_readable_name in sorted_hardware_names: for hwpack in self.settings['choice']['hwpack'][device_name]: - if self.db.hardware_is_available_in_table(table, hwpack): + if(self.db.hardware_is_available_in_table("snapshot_hwpacks", + hwpack) + or self.db.hardware_is_available_in_table("release_hwpacks", + hwpack)): self.cb_hardware.Append(human_readable_name, device_name) break @@ -1570,6 +1621,7 @@ self.config.settings['build_date']) if page == hw_details_pg: + rel_or_snap_pg.force_rel_snap_if_hw_requires() rel_or_snap_pg.fill_os_list() rel_or_snap_pg.update_release_and_build_boxes()