diff options
author | Joshua Lock <josh@linux.intel.com> | 2011-07-28 17:28:00 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-08-02 22:31:43 +0100 |
commit | e03114b3521cbefa2c8bafa4bbf2dc4661793c31 (patch) | |
tree | f48a491a5b16da58ecd0952bb36dfc29d3305531 /bitbake/lib | |
parent | 2da73ed3882480978c6c984741612ab0e7fe18db (diff) | |
download | poky-e03114b3521cbefa2c8bafa4bbf2dc4661793c31.tar.gz |
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 <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/layereditor.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/layereditor.py b/bitbake/lib/bb/ui/crumbs/layereditor.py index 7c581d642f..f5394a5f52 100644 --- a/bitbake/lib/bb/ui/crumbs/layereditor.py +++ b/bitbake/lib/bb/ui/crumbs/layereditor.py | |||
@@ -21,6 +21,7 @@ | |||
21 | import gobject | 21 | import gobject |
22 | import gtk | 22 | import gtk |
23 | from bb.ui.crumbs.configurator import Configurator | 23 | from bb.ui.crumbs.configurator import Configurator |
24 | from bb.ui.crumbs.hig import CrumbsDialog | ||
24 | 25 | ||
25 | class LayerEditor(gtk.Dialog): | 26 | class LayerEditor(gtk.Dialog): |
26 | """ | 27 | """ |
@@ -117,6 +118,12 @@ class LayerEditor(gtk.Dialog): | |||
117 | self.find_layer(self) | 118 | self.find_layer(self) |
118 | 119 | ||
119 | def find_layer(self, parent): | 120 | def find_layer(self, parent): |
121 | def conf_error(parent, lbl): | ||
122 | dialog = CrumbsDialog(parent, lbl) | ||
123 | dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) | ||
124 | response = dialog.run() | ||
125 | dialog.destroy() | ||
126 | |||
120 | dialog = gtk.FileChooserDialog("Add new layer", parent, | 127 | dialog = gtk.FileChooserDialog("Add new layer", parent, |
121 | gtk.FILE_CHOOSER_ACTION_OPEN, | 128 | gtk.FILE_CHOOSER_ACTION_OPEN, |
122 | (gtk.STOCK_CANCEL, gtk.RESPONSE_NO, | 129 | (gtk.STOCK_CANCEL, gtk.RESPONSE_NO, |
@@ -128,10 +135,19 @@ class LayerEditor(gtk.Dialog): | |||
128 | path = dialog.get_filename() | 135 | path = dialog.get_filename() |
129 | dialog.destroy() | 136 | dialog.destroy() |
130 | 137 | ||
138 | lbl = "<b>Error</b>\nUnable to load layer <i>%s</i> because " % path | ||
131 | if response == gtk.RESPONSE_YES: | 139 | if response == gtk.RESPONSE_YES: |
132 | # FIXME: verify we've actually got a layer conf? | 140 | # FIXME: verify we've actually got a layer conf? |
133 | if path.endswith(".conf"): | 141 | if path.endswith("layer.conf"): |
134 | name, layerpath = self.configurator.addLayerConf(path) | 142 | name, layerpath = self.configurator.addLayerConf(path) |
135 | if name: | 143 | if name and layerpath: |
136 | self.newly_added[name] = layerpath | 144 | self.newly_added[name] = layerpath |
137 | self.layer_store.append([name, layerpath, True]) | 145 | self.layer_store.append([name, layerpath, True]) |
146 | return | ||
147 | elif name: | ||
148 | return | ||
149 | else: | ||
150 | lbl += "there was a problem parsing the layer.conf." | ||
151 | else: | ||
152 | lbl += "it is not a layer.conf file." | ||
153 | conf_error(parent, lbl) | ||