summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/builder.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/builder.py')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py56
1 files changed, 36 insertions, 20 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index cd66c3fc9d..bd45016045 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -464,11 +464,15 @@ class Builder(gtk.Window):
464 return None 464 return None
465 465
466 self.template = TemplateMgr() 466 self.template = TemplateMgr()
467 self.template.load(path) 467 try:
468 self.configuration.load(self.template) 468 self.template.load(path)
469 469 self.configuration.load(self.template)
470 self.template.destroy() 470 except Exception as e:
471 self.template = None 471 self.show_error_dialog("Hob Exception - %s" % (str(e)))
472 self.reset()
473 finally:
474 self.template.destroy()
475 self.template = None
472 476
473 for layer in self.configuration.layers: 477 for layer in self.configuration.layers:
474 if not os.path.exists(layer+'/conf/layer.conf'): 478 if not os.path.exists(layer+'/conf/layer.conf'):
@@ -487,12 +491,17 @@ class Builder(gtk.Window):
487 path = path[0:path.rfind("/")] 491 path = path[0:path.rfind("/")]
488 492
489 self.template = TemplateMgr() 493 self.template = TemplateMgr()
490 self.template.open(filename, path) 494 try:
491 self.configuration.save(self.template, defaults) 495 self.template.open(filename, path)
496 self.configuration.save(self.template, defaults)
492 497
493 self.template.save() 498 self.template.save()
494 self.template.destroy() 499 except Exception as e:
495 self.template = None 500 self.show_error_dialog("Hob Exception - %s" % (str(e)))
501 self.reset()
502 finally:
503 self.template.destroy()
504 self.template = None
496 505
497 def save_defaults(self): 506 def save_defaults(self):
498 if not os.path.exists(".hob/"): 507 if not os.path.exists(".hob/"):
@@ -587,6 +596,12 @@ class Builder(gtk.Window):
587 self.configuration.update(params) 596 self.configuration.update(params)
588 self.parameters.update(params) 597 self.parameters.update(params)
589 598
599 def reset(self):
600 self.configuration.curr_mach = ""
601 self.configuration.clear_selection()
602 self.image_configuration_page.switch_machine_combo()
603 self.switch_page(self.MACHINE_SELECTION)
604
590 # Callback Functions 605 # Callback Functions
591 def handler_config_updated_cb(self, handler, which, values): 606 def handler_config_updated_cb(self, handler, which, values):
592 if which == "distro": 607 if which == "distro":
@@ -619,19 +634,20 @@ class Builder(gtk.Window):
619 if self.current_step == self.FAST_IMAGE_GENERATING: 634 if self.current_step == self.FAST_IMAGE_GENERATING:
620 self.generate_image_async() 635 self.generate_image_async()
621 636
637 def show_error_dialog(self, msg):
638 lbl = "<b>Error</b>\n"
639 lbl = lbl + "%s\n\n" % msg
640 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
641 button = dialog.add_button("Close", gtk.RESPONSE_OK)
642 HobButton.style_button(button)
643 response = dialog.run()
644 dialog.destroy()
645
622 def handler_command_failed_cb(self, handler, msg): 646 def handler_command_failed_cb(self, handler, msg):
623 if msg: 647 if msg:
624 msg = msg.replace("your local.conf", "Settings") 648 msg = msg.replace("your local.conf", "Settings")
625 lbl = "<b>Error</b>\n" 649 self.show_error_dialog(msg)
626 lbl = lbl + "%s\n\n" % msg 650 self.reset()
627 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
628 button = dialog.add_button("Close", gtk.RESPONSE_OK)
629 HobButton.style_button(button)
630 response = dialog.run()
631 dialog.destroy()
632 self.configuration.curr_mach = ""
633 self.image_configuration_page.switch_machine_combo()
634 self.switch_page(self.MACHINE_SELECTION)
635 651
636 def window_sensitive(self, sensitive): 652 def window_sensitive(self, sensitive):
637 self.image_configuration_page.machine_combo.set_sensitive(sensitive) 653 self.image_configuration_page.machine_combo.set_sensitive(sensitive)