From patchwork Fri Aug 19 12:17:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Tunnicliffe X-Patchwork-Id: 3549 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 33BF523F36 for ; Fri, 19 Aug 2011 12:17:16 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gy0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id A86F9A18474 for ; Fri, 19 Aug 2011 12:17:15 +0000 (UTC) Received: by gyc15 with SMTP id 15so3084438gyc.11 for ; Fri, 19 Aug 2011 05:17:15 -0700 (PDT) Received: by 10.151.21.21 with SMTP id y21mr2109083ybi.447.1313756234990; Fri, 19 Aug 2011 05:17: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.150.157.17 with SMTP id f17cs96390ybe; Fri, 19 Aug 2011 05:17:13 -0700 (PDT) Received: by 10.227.55.20 with SMTP id s20mr3094189wbg.15.1313756232215; Fri, 19 Aug 2011 05:17:12 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id ev21si8246717wbb.77.2011.08.19.05.17.11 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Aug 2011 05:17:12 -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 1QuO0d-00078t-8d for ; Fri, 19 Aug 2011 12:17:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 36935E03D1 for ; Fri, 19 Aug 2011 12:17:11 +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: 413 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 413: Pages 1 and 2 of the new IU are now complete. Message-Id: <20110819121711.14409.42800.launchpad@ackee.canonical.com> Date: Fri, 19 Aug 2011 12:17:11 -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: 577be2f9c6c1a3e1fd9b9a61efbe66ffa2312add Merge authors: James Tunnicliffe (dooferlad) Related merge proposals: https://code.launchpad.net/~dooferlad/linaro-image-tools/fetch_image_ui_updates2/+merge/72099 proposed by: James Tunnicliffe (dooferlad) review: Approve - Mattias Backman (mabac) ------------------------------------------------------------ revno: 413 [merge] committer: James Tunnicliffe branch nick: linaro-image-tools timestamp: Fri 2011-08-19 13:15:02 +0100 message: Pages 1 and 2 of the new IU are now complete. * Saying you want to run a simulation will generate a Beagle image to run on QEMU (tool does not run QEMU for you) * Advanced options on page 2 allow for selecting an OS that isn't Ubuntu Desktop * Unless you are selecting a snapshot build, page 3 is now linaro-media-create settings Part 3 of the updates will concentrate on the linaro-media-create settings page. 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-08-18 09:40:29 +0000 +++ linaro-fetch-image-ui 2011-08-18 15:02:04 +0000 @@ -57,16 +57,22 @@ return radio_button -class ReleaseOrSnapshotPage(wiz.WizardPageSimple): +class ReleaseOrSnapshotPage(wiz.PyWizardPage): """Ask the user if they want to use a release or a snapshot""" - def __init__(self, parent, config, width): - wiz.WizardPageSimple.__init__(self, parent) + def __init__(self, parent, config, db, pages, width): + wiz.PyWizardPage.__init__(self, parent) self.config = config self.settings = self.config.settings self.sizer = wx.BoxSizer(wx.VERTICAL) self.next = None self.prev = None + self.db = db + self.wizard = parent + self.pages = pages + self.width = width + self.settings['image'] = None + self.os_selected = True message = ("Would you like to use a Linaro release, or a more up to " "date, but possibly unstable build?") @@ -89,20 +95,366 @@ 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 | + wx.CP_NO_TLW_RESIZE) + self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.event_on_pane_changed, + self.cp) + self.make_pane_content(self.cp.GetPane()) + self.box2 = wx.BoxSizer(wx.VERTICAL) + self.box2.Add(self.cp) + 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.SetSizerAndFit(self.sizer) self.sizer.Fit(self) self.Move((50, 50)) + def make_pane_content(self, pane): + self.adv_box = wx.BoxSizer(wx.VERTICAL) + + message = ("You have the option of selecting from several OS images " + "and builds.") + header = wx.StaticText(pane, -1, message) + header.Wrap(self.width - 10) # -10 because boarder below is 5 px wide + self.adv_box.Add(header) + self.grid1 = wx.FlexGridSizer(0, 2, 0, 0) + self.grid2 = wx.FlexGridSizer(0, 2, 0, 0) + + # TODO: Put in table with explainations! + # TODO: Needs to be different (OS name only) if selecting snapshot! + + platforms = [] + for key, value in self.settings['choice']['platform'].items(): + platforms.append(key) + + style = wx.CB_DROPDOWN | wx.CB_READONLY + self.settings['platform'] = None + + self.cb_release = wx.ComboBox(pane, style=style) + self.Bind(wx.EVT_COMBOBOX, self.event_cb_release, self.cb_release) + + self.cb_build = wx.ComboBox(pane, style=style) + self.Bind(wx.EVT_COMBOBOX, self.event_combo_box_build, self.cb_build) + + self.cb_image = wx.ComboBox(pane, style=style) + self.Bind(wx.EVT_COMBOBOX, self.event_combo_box_os, self.cb_image) + + self.help_text = wx.StaticText(pane, -1, "") + + alignment = wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.TOP + align_text = alignment | wx.ALIGN_CENTER_VERTICAL + self.grid1.Add(self.cb_image, 0, alignment, 5) + self.grid1.Add(wx.StaticText(pane, -1, "The OS to run"), + 0, align_text, 5) + + self.grid2.Add(self.cb_release, 0, alignment, 5) + self.grid2.Add(wx.StaticText(pane, -1, "Available Linaro releases"), + 0, align_text, 5) + + self.grid2.Add(self.cb_build, 0, alignment, 5) + self.grid2.Add(wx.StaticText(pane, -1, "Available milestones"), + 0, align_text, 5) + + self.adv_box.Add(self.grid1, 0, alignment, 0) + self.adv_box.Add(self.grid2, 0, alignment, 0) + self.update_visibility() + self.adv_box.Add(self.help_text, 0, alignment, 5) + + pane.SetSizer(self.adv_box) + self.adv_box.Fit(pane) + + def update_visibility(self): + if self.settings['release_or_snapshot'] == "snapshot": + self.adv_box.Hide(self.grid2, True) + else: + self.adv_box.Show(self.grid2, True) + + self.Fit() + self.Layout() + + def update_next_active(self): + if self.build_available and self.os_selected: + self.wizard.FindWindowById(wx.ID_FORWARD).Enable() + else: + self.wizard.FindWindowById(wx.ID_FORWARD).Disable() + + def update_build_box(self): + """Depending on what hardware has been chosen, the OS list may be + restricted. Filter out anything that is unavailable.""" + self.cb_build.Clear() + + if self.settings['release_or_snapshot'] == "snapshot": + # This combo box is not used by snapshot builds + self.cb_build.SetValue("Not applicable") + self.build_available = True + return + + builds = self.db.get_builds(self.settings['platform']) + self.cb_build.SetValue("No build available") + + for build in builds: + if(self.db.hardware_is_available_for_platform_build( + self.settings['compatable_hwpacks'], + self.settings['platform'], + build) + and self.db.build_is_available_for_platform_image( + "release_binaries", + self.settings['platform'], + self.settings['image'], + build)): + + self.cb_build.Append(build) + self.cb_build.SetValue(build) + self.settings['release_build'] = build + + available_hwpacks = ( + self.db.get_available_hwpacks_for_hardware_build_plaform( + self.settings['compatable_hwpacks'], + self.settings['platform'], + self.settings['release_build'])) + + if len(available_hwpacks): + self.settings['hwpack'] = available_hwpacks[0] + self.build_available = True + else: + self.build_available = False + + self.update_next_active() + + def update_release_and_build_boxes(self): + """Depending on what hardware has been chosen, some builds may be + unavailable...""" + self.cb_release.Clear() + + if self.settings['release_or_snapshot'] == "snapshot": + # This combo box is not used by snapshot builds + self.cb_release.SetValue("Not applicable") + return + + if not self.os_selected: + self.cb_release.SetValue("-") + self.update_build_box() + self.update_next_active() + return + + default_release = None + for platform, value in self.settings['choice']['platform'].items(): + if(self.db.hardware_is_available_for_platform( + self.settings['compatable_hwpacks'], + platform) + and len(self.db.execute_return_list( + 'select * from release_binaries ' + 'where platform == ? and image == ?', + (platform, self.settings['image'])))): + + if platform in self.settings['UI']['translate']: + platform = self.settings['UI']['translate'][platform] + + self.cb_release.Append(platform, platform.upper()) + if not default_release or default_release < platform: + default_release = platform + + if default_release in self.settings['UI']['reverse-translate']: + default = self.settings['UI']['reverse-translate'][default_release] + else: + default = default_release + + if not self.settings['platform']: + # No platform has been chose, go with the default + self.settings['platform'] = default + self.cb_release.SetValue(default_release) + else: + # Don't change the value of platform if it is set. + pf = self.settings['UI']['translate'][self.settings['platform']] + self.cb_release.SetValue(pf) + + self.update_build_box() + self.update_next_active() + + def get_human_os_name(self, item): + """Given an OS name from the database, return a human name (either + translated from the YAML settings, or just prettified) and if it is a + LEB OS or not""" + + item = re.sub("linaro-", "", item) # Remove any linaro- decoration + + if item in self.settings['UI']['descriptions']: + human_name = self.settings['UI']['descriptions'][item] + else: + # Make human_name look nicer... + human_name = string.capwords(item) + + leb_search = re.search("^LEB:\s*(.*)$", human_name) + + if leb_search: + return leb_search.group(1), True + + return human_name, False + + def fill_os_list(self): + """Filter the list of OS's from the config file based on the users + preferences so all choices in the list are valid (i.e. their hardware + is supported for the build they have chosen).""" + + # select unique image from snapshot_binaries/release_binaries to + # generate list + os_list = None + if self.settings['release_or_snapshot'] == "release": + os_list = self.db.get_os_list_from('release_binaries') + else: + os_list = self.db.get_os_list_from('snapshot_binaries') + + self.cb_image.Clear() + + printed_tag = None + last_name = None + current_image_setting_valid = False + + for state in ["LEB", "other"]: + for item in os_list: + if item == "old": + # Old is a directory that sometimes hangs around, + # but isn't one we want to display + continue + + # Save the original, untouched image name for use later. + # We give it a more human name for display + original = item + item = re.sub("linaro-", "", item) + + os_hardware_combo_available = ( + self.db.image_hardware_combo_available( + self.settings['release_or_snapshot'], + original, + self.settings['compatable_hwpacks'])) + + if os_hardware_combo_available: + human_name, is_LEB = self.get_human_os_name(item) + + if item == self.settings['image']: + current_image_setting_valid = True + + if state == "LEB" and is_LEB: + + if printed_tag != state: + self.cb_image.Append( + "- Linaro Supported Releases -") + printed_tag = state + + self.cb_image.Append(human_name, original) + + if self.settings['image'] == None: + self.settings['image'] = original + self.os_selected = True + + elif state != "LEB" and not is_LEB: + if printed_tag != state: + self.cb_image.Append( + "- Community Supported Releases -") + printed_tag = state + + self.cb_image.Append(human_name, original) + + last_name = original + + if( self.settings['image'] != None + and current_image_setting_valid == False): + # If we have an image setting, but it doesn't match the OS list, we + # have switched OS list. It may be that adding/removing "linaro-" + # from the name will get a match. + + if re.search("linaro-", self.settings['image']): + test_name = re.sub("linaro-", "", self.settings['image']) + else: + test_name = "linaro-" + self.settings['image'] + + if test_name in os_list: + # Success! We have translated the name and can retain the + # "old setting" + self.settings['image'] = test_name + current_image_setting_valid = True + self.os_selected = True + + if( self.settings['image'] == None + or current_image_setting_valid == False): + # This should only get hit if there are no LEBs available + self.settings['image'] = last_name + self.os_selected = True + + assert self.settings['image'] + + # Make sure the visible selected value matches the saved setting + self.cb_image.SetValue( + self.get_human_os_name(self.settings['image'])[0]) + + def GetNext(self): + if self.settings['release_or_snapshot'] == "release": + return self.pages['lmc_settings'] + else: + return self.pages['select_snapshot'] + + def GetPrev(self): + return self.pages['hardware_details'] + + #--- Event(s) --- def event_radio_button_select(self, event): + # The radio button can be release or snapshot self.radio_selected = event.GetEventObject().GetLabel() - # The radio button can be release, snapshot or "latest snapshot" - if(self.radio_selected == self.button_text['release']): + + if self.radio_selected == self.button_text['release']: self.settings['release_or_snapshot'] = "release" else: self.settings['release_or_snapshot'] = "snapshot" + self.update_release_and_build_boxes() + self.update_visibility() + self.update_next_active() + + def event_on_pane_changed(self, event): + self.fill_os_list() + self.update_release_and_build_boxes() + self.update_visibility() + self.Layout() + self.update_next_active() + + def event_cb_release(self, evt): + str = evt.GetString().encode('ascii').lower() + if str in self.settings['UI']['reverse-translate']: + str = self.settings['UI']['reverse-translate'][str] + self.settings['platform'] = str + + self.update_build_box() + + def event_combo_box_build(self, evt): + self.settings['release_build'] = evt.GetString().encode('ascii') + + def event_combo_box_os(self, evt): + self.settings['image'] = self.cb_image.GetClientData( + evt.GetSelection()) + + if self.settings['image']: # Is None for items that aren't an OS + self.os_selected = True + image = re.sub("linaro-", "", self.settings['image']) + + if image + "::long" in self.settings['UI']['descriptions']: + self.help_text.SetLabel(self.settings['UI'] + ['descriptions'] + [image + "::long"]) + else: + self.help_text.SetLabel("") + + else: # Have selected help text + self.os_selected = False + self.help_text.SetLabel("Please select an operating system to run " + "on your chosen hardware.") + + self.help_text.Wrap(self.width - 10) + self.update_release_and_build_boxes() + self.update_next_active() + #--- END event(s) --- + class AboutMyHardwarePage(wiz.PyWizardPage): """Ask the user about their hardware. This only asks about the board, not @@ -127,8 +479,6 @@ 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 # no selection is made @@ -156,7 +506,6 @@ 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... @@ -219,6 +568,9 @@ val = event.GetEventObject().GetLabel() if val == self.button_text['sim']: self.settings['hw_or_qemu'] = QEMU + assert "beagle" in self.settings['choice']['hardware'].keys() + self.settings['hardware'] = "beagle" + elif val == self.button_text['hardware']: self.settings['hw_or_qemu'] = HARDWARE #--- END event(s) --- @@ -229,136 +581,6 @@ def GetNext(self): return self.next -class SelectStableRelease(wiz.WizardPageSimple): - """Ask the user which Linaro release they would like to run.""" - def __init__(self, parent, config, db, width): - wiz.WizardPageSimple.__init__(self, parent) - self.settings = config.settings - self.db = db - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.wizard = parent - - header = wx.StaticText(self, label="Please select the stable Linaro " - "release you would like to use") - - header.Wrap(width - 10) # -10 because boarder below is 5 pixels wide - - self.sizer.Add(header) - self.box1 = wx.BoxSizer(wx.VERTICAL) - - platforms = [] - for key, value in self.settings['choice']['platform'].items(): - platforms.append(key) - - default_release = self.settings['UI']['translate'][platforms[-1]] - self.cb_release = wx.ComboBox(self, - value=default_release, - style=wx.CB_DROPDOWN | wx.CB_READONLY) - self.Bind(wx.EVT_COMBOBOX, - self.event_combo_box_release, - self.cb_release) - - if(default_release in self.settings['UI']['translate']): - default_release = self.settings['UI']['translate'][default_release] - self.settings['platform'] = ( - self.settings['UI']['reverse-translate'][default_release]) - - for item in platforms: - if(item in self.settings['UI']['translate']): - new_item = self.settings['UI']['translate'][item] - item = new_item - - self.cb_release.Append(item, item.upper()) - - self.cb_build = wx.ComboBox(self, - style=wx.CB_DROPDOWN | wx.CB_READONLY) - self.Bind(wx.EVT_COMBOBOX, self.event_combo_box_build, self.cb_build) - - self.box1.Add(self.cb_release, 0, - wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.TOP, 5) - self.box1.Add(self.cb_build, 0, - wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.TOP, 5) - self.sizer.Add(self.box1, 0, wx.ALIGN_LEFT | wx.ALL, 5) - self.SetSizerAndFit(self.sizer) - self.sizer.Fit(self) - self.Move((50, 50)) - - def update_build_box(self): - """Depending on what hardware has been chosen, the OS list may be - restricted. Filter out anything that is unavailable.""" - self.cb_build.Clear() - - builds = self.db.get_builds(self.settings['platform']) - self.cb_build.SetValue("No build available") - - for build in builds: - if(self.db.hardware_is_available_for_platform_build( - self.settings['compatable_hwpacks'], - self.settings['platform'], - build) - and self.db.build_is_available_for_platform_image( - "release_binaries", - self.settings['platform'], - self.settings['image'], - build)): - - self.cb_build.Append(build) - self.cb_build.SetValue(build) - self.settings['release_build'] = build - - available_hwpacks = ( - self.db.get_available_hwpacks_for_hardware_build_plaform( - self.settings['compatable_hwpacks'], - self.settings['platform'], - self.settings['release_build'])) - - if len(available_hwpacks): - self.settings['hwpack'] = available_hwpacks[0] - self.wizard.FindWindowById(wx.ID_FORWARD).Enable() - else: - self.wizard.FindWindowById(wx.ID_FORWARD).Disable() - - def update_release_and_build_boxes(self): - """Depending on what hardware has been chosen, some builds may be - unavailable...""" - self.cb_release.Clear() - - default_release = None - for platform, value in self.settings['choice']['platform'].items(): - if(self.db.hardware_is_available_for_platform( - self.settings['compatable_hwpacks'], - platform) - and len(self.db.execute_return_list( - 'select * from release_binaries ' - 'where platform == ? and image == ?', - (platform, self.settings['image'])))): - - if(platform in self.settings['UI']['translate']): - platform = self.settings['UI']['translate'][platform] - - self.cb_release.Append(platform, platform.upper()) - if not default_release or default_release < platform: - default_release = platform - - self.settings['platform'] = ( - self.settings['UI']['reverse-translate'][default_release]) - self.cb_release.SetValue(default_release) - self.update_build_box() - - #--- Event(s) --- - def event_combo_box_release(self, evt): - str = evt.GetString().encode('ascii').lower() - if(str in self.settings['UI']['reverse-translate']): - str = self.settings['UI']['reverse-translate'][str] - self.settings['platform'] = str - - self.update_build_box() - - def event_combo_box_build(self, evt): - self.settings['release_build'] = evt.GetString().encode('ascii') - #--- END event(s) --- - - class SelectSnapshot(wiz.WizardPageSimple): """Present the user with a calendar widget and a list of builds available on the selected date so they can chose a snapshot. Filter out days when @@ -518,183 +740,6 @@ #--- END event(s) --- -class SelectOS(wiz.WizardPageSimple): - """Ask the user which OS they would like to run. Filter out any choices - that are unavailable due to previous choices.""" - def __init__(self, parent, config, db, width): - wiz.WizardPageSimple.__init__(self, parent) - self.settings = config.settings - self.wizard = parent - self.db = db - self.width = width - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.settings['image'] = None - - header = wx.StaticText(self, label="Please select the operating " - "system you would like to run on " - "your hardware.") - header.Wrap(width - 10) # -10 because boarder below is 5 pixels wide - - self.box1 = wx.BoxSizer(wx.VERTICAL) - self.sizer.Add(header) - - self.cb_image = wx.ComboBox(self, - style=wx.CB_DROPDOWN | wx.CB_READONLY) - self.Bind(wx.EVT_COMBOBOX, self.event_combo_box_os, self.cb_image) - - #--- Layout --- - # -- Combo boxes for hardware and image selection -- - self.box1.Add(self.cb_image, 0, wx.ALIGN_LEFT | wx.ALL, 5) - - self.sizer.Add(self.box1, 0, wx.ALIGN_LEFT | wx.ALL, 5) - - self.help_text = wx.StaticText(self) - self.sizer.Add(self.help_text, 1, wx.EXPAND, 5) - - self.SetSizer(self.sizer) - self.sizer.Fit(self) - self.Move((50, 50)) - - def get_human_os_name(self, item): - """Given an OS name from the database, return a human name (either - translated from the YAML settings, or just prettified) and if it is a - LEB OS or not""" - - item = re.sub("linaro-", "", item) # Remove any linaro- decoration - - human_name = item - - if item in self.settings['UI']['descriptions']: - human_name = self.settings['UI']['descriptions'][item] - else: - # Make human_name look nicer... - human_name = string.capwords(item) - - leb_search = re.search("^LEB:\s*(.*)$", human_name) - - if leb_search: - return leb_search.group(1), True - - return human_name, False - - def fill_os_list(self): - """Filter the list of OS's from the config file based on the users - preferences so all choices in the list are valid (i.e. their hardware - is supported for the build they have chosen).""" - - # select unique image from snapshot_binaries/release_binaries to - # generate list - os_list = None - if self.settings['release_or_snapshot'] == "release": - os_list = self.db.get_os_list_from('release_binaries') - else: - os_list = self.db.get_os_list_from('snapshot_binaries') - - self.cb_image.Clear() - - printed_tag = None - last_name = None - current_image_setting_valid = False - - for state in ["LEB", "other"]: - for item in os_list: - if item == "old": - # Old is a directory that sometimes hangs around, - # but isn't one we want to display - continue - - # Save the original, untouched image name for use later. - # We give it a more human name for display - original = item - item = re.sub("linaro-", "", item) - - os_hardware_combo_available = ( - self.db.image_hardware_combo_available( - self.settings['release_or_snapshot'], - original, - self.settings['compatable_hwpacks'])) - - if os_hardware_combo_available: - human_name, is_LEB = self.get_human_os_name(item) - - if item == self.settings['image']: - current_image_setting_valid = True - - if state == "LEB" and is_LEB: - - if printed_tag != state: - self.cb_image.Append( - "- Linaro Supported Releases -") - printed_tag = state - - self.cb_image.Append(human_name, original) - - if self.settings['image'] == None: - self.settings['image'] = original - - elif state != "LEB" and not is_LEB: - if printed_tag != state: - self.cb_image.Append( - "- Community Supported Releases -") - printed_tag = state - - self.cb_image.Append(human_name, original) - - last_name = original - - if( self.settings['image'] != None - and current_image_setting_valid == False): - # If we have an image setting, but it doesn't match the OS list, we - # have switched OS list. It may be that adding/removing "linaro-" - # from the name will get a match. - - if re.search("linaro-", self.settings['image']): - test_name = re.sub("linaro-", "", self.settings['image']) - else: - test_name = "linaro-" + self.settings['image'] - - if test_name in os_list: - # Success! We have translated the name and can retain the - # "old setting" - self.settings['image'] = test_name - current_image_setting_valid = True - - if( self.settings['image'] == None - or current_image_setting_valid == False): - # This should only get hit if there are no LEBs available - self.settings['image'] = last_name - - assert self.settings['image'] - - # Make sure the visible selected value matches the saved setting - self.cb_image.SetValue( - self.get_human_os_name(self.settings['image'])[0]) - - #--- Event(s) --- - def event_combo_box_os(self, evt): - self.settings['image'] = self.cb_image.GetClientData( - evt.GetSelection()) - - if self.settings['image']: # Is None for items that aren't an OS - self.wizard.FindWindowById(wx.ID_FORWARD).Enable() - image = re.sub("linaro-", "", self.settings['image']) - - if image + "::long" in self.settings['UI']['descriptions']: - self.help_text.SetLabel(self.settings['UI'] - ['descriptions'] - [image + "::long"]) - else: - self.help_text.SetLabel("") - - else: # Have selected help text - self.wizard.FindWindowById(wx.ID_FORWARD).Disable() - self.help_text.SetLabel("Please select an operating system to run " - "on your chosen hardware.") - - self.help_text.Wrap(self.width - 10) - #--- END event(s) --- - - class LMC_settings(wiz.WizardPageSimple): """Present the user with, intially, the choice of writing the file system they are going to have created to a file, or directly to a device. Ask @@ -1450,16 +1495,19 @@ self.done_startup = False def on_page_changing(self, evt): - 'Executed before the page changes.' - - if self.done_startup == False: - self.pages['lmc_settings'].box2.Hide( - self.pages['lmc_settings'].optional_settings_box, - True) - - self.pages['lmc_settings'].box3.Hide( - self.pages['lmc_settings'].confirm_mmc_usage_box, - True) + """Executed before the page changes.""" + + hw_details_pg = self.pages['hardware_details'] + rel_or_snap_pg = self.pages['release_or_snapshot'] + select_snap_pg = self.pages['select_snapshot'] + lmc_settings_pg = self.pages['lmc_settings'] + + if not self.done_startup: + lmc_settings_pg.box2.Hide(lmc_settings_pg.optional_settings_box, + True) + + lmc_settings_pg.box3.Hide(lmc_settings_pg.confirm_mmc_usage_box, + True) self.done_startup = True @@ -1471,42 +1519,32 @@ # If going from a select snapshot or select release page, record # which we were on so the back button of the next page works - if(self.config.settings['release_or_snapshot'] == "release"): - self.pages['select_os'].SetNext(self.pages['select_release']) - self.pages['select_release'].SetPrev(self.pages['select_os']) - - self.pages['select_release'].SetNext(self.pages['lmc_settings']) - self.pages['lmc_settings'].SetPrev(self.pages['select_release']) + if self.config.settings['release_or_snapshot'] == "release": + lmc_settings_pg.SetPrev(rel_or_snap_pg) else: - self.pages['select_os'].SetNext(self.pages['select_snapshot']) - self.pages['select_snapshot'].SetPrev(self.pages['select_os']) - - if(page == self.pages['select_os']): - self.pages['select_snapshot'].fill_build_combo_box_for_date( + select_snap_pg.SetNext(lmc_settings_pg) + + lmc_settings_pg.SetPrev(select_snap_pg) + select_snap_pg.SetPrev(rel_or_snap_pg) + + if page == rel_or_snap_pg: + select_snap_pg.fill_build_combo_box_for_date( self.config.settings['build_date']) - self.pages['select_snapshot'].SetNext(self.pages['lmc_settings']) - self.pages['lmc_settings'].SetPrev(self.pages['select_snapshot']) - - if page == self.pages['hardware_details']: - self.pages['select_os'].fill_os_list() - - # If about to move into the release selection, make sure the list - # is populated only with releases that are valid with our current - # selection - if( page == self.pages['select_os'] - and self.config.settings['release_or_snapshot'] == "release"): - self.pages['select_release'].update_release_and_build_boxes() - - if page == self.pages['select_snapshot']: + if page == hw_details_pg: + rel_or_snap_pg.fill_os_list() + rel_or_snap_pg.update_release_and_build_boxes() + + if page == select_snap_pg: # Execute when exiting page - self.pages['select_snapshot'].update_platform() - - if( page == self.pages['select_snapshot'] - or page == self.pages['select_release']): - self.pages['lmc_settings'].on_activate() - - if page == self.pages['lmc_settings']: + select_snap_pg.update_platform() + + if( page == select_snap_pg + or (page == rel_or_snap_pg and + self.config.settings['release_or_snapshot'] == "release")): + lmc_settings_pg.on_activate() + + if page == lmc_settings_pg: # Forward stays disabled until LMC has finished running self.wizard.FindWindowById(wx.ID_FORWARD).Disable() self.pages['run_lmc'].on_activate() @@ -1544,23 +1582,15 @@ self.pages['release_or_snapshot'] = ReleaseOrSnapshotPage(self.wizard, self.config, + db, + self.pages, width) - self.pages['select_release'] = SelectStableRelease(self.wizard, - self.config, - db, - width) - self.pages['select_snapshot'] = SelectSnapshot(self.wizard, self.config, db, width) - self.pages['select_os'] = SelectOS(self.wizard, - self.config, - db, - width) - self.pages['lmc_settings'] = LMC_settings(self.wizard, self.config, db, @@ -1574,13 +1604,6 @@ self.pages['hardware_details'].SetNext( self.pages['release_or_snapshot']) - self.pages['release_or_snapshot'].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']) self.pages['run_lmc'].SetPrev(self.pages['lmc_settings']) === modified file 'linaro_image_tools/fetch_image.py' --- linaro_image_tools/fetch_image.py 2011-08-18 16:00:26 +0000 +++ linaro_image_tools/fetch_image.py 2011-08-19 12:15:02 +0000 @@ -832,6 +832,14 @@ value = re.sub('LEB:\s*', '', value) self.settings['UI']['reverse-descriptions'][value] = key + # If an item doesn't have a translation, just add in a null one + if not self.settings['UI']['translate']: + self.settings['UI']['translate'] = {} + + for key, value in self.settings['choice']['platform'].items(): + if not key in self.settings['UI']['translate']: + self.settings['UI']['translate'][key] = key + self.settings['UI']['reverse-translate'] = {} for (key, value) in self.settings['UI']['translate'].items(): self.settings['UI']['reverse-translate'][value] = key