From e03114b3521cbefa2c8bafa4bbf2dc4661793c31 Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Thu, 28 Jul 2011 17:28:00 -0700 Subject: ui/crumbs/layereditor: if layer adding fails show an explanatory dialog When adding a layer fails try to explain why to the user. (Bitbake rev: 2f7eadfdd710f84a299d6fc7be67ddb089f03ecc) Signed-off-by: Joshua Lock Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/crumbs/layereditor.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'bitbake/lib/bb/ui') diff --git a/bitbake/lib/bb/ui/crumbs/layereditor.py b/bitbake/lib/bb/ui/crumbs/layereditor.py index 7c581d6..f5394a5 100644 --- a/bitbake/lib/bb/ui/crumbs/layereditor.py +++ b/bitbake/lib/bb/ui/crumbs/layereditor.py @@ -21,6 +21,7 @@ import gobject import gtk from bb.ui.crumbs.configurator import Configurator +from bb.ui.crumbs.hig import CrumbsDialog class LayerEditor(gtk.Dialog): """ @@ -117,6 +118,12 @@ class LayerEditor(gtk.Dialog): self.find_layer(self) def find_layer(self, parent): + def conf_error(parent, lbl): + dialog = CrumbsDialog(parent, lbl) + dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) + response = dialog.run() + dialog.destroy() + dialog = gtk.FileChooserDialog("Add new layer", parent, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_NO, @@ -128,10 +135,19 @@ class LayerEditor(gtk.Dialog): path = dialog.get_filename() dialog.destroy() + lbl = "Error\nUnable to load layer %s because " % path if response == gtk.RESPONSE_YES: # FIXME: verify we've actually got a layer conf? - if path.endswith(".conf"): + if path.endswith("layer.conf"): name, layerpath = self.configurator.addLayerConf(path) - if name: + if name and layerpath: self.newly_added[name] = layerpath self.layer_store.append([name, layerpath, True]) + return + elif name: + return + else: + lbl += "there was a problem parsing the layer.conf." + else: + lbl += "it is not a layer.conf file." + conf_error(parent, lbl) -- cgit v1.1