Revision 6ca82c22

b/image_creator/dialog_menu.py
488 488
    return True
489 489

  
490 490

  
491
def show_properties_help(session):
492
    """Show help for image properties"""
493
    d = session['dialog']
494

  
495
    help_file = get_help_file("image_properties")
496
    assert os.path.exists(help_file)
497
    d.textbox(help_file, title="Image Properties", width=70, height=40)
498

  
499

  
491 500
def modify_properties(session):
492 501
    """Modify an existing image property"""
493 502
    d = session['dialog']
......
497 506
        for (key, val) in session['metadata'].items():
498 507
            choices.append((str(key), str(val)))
499 508

  
509
        if len(choices) == 0:
510
            code = d.yesno(
511
                "No image properties are available. "
512
                "Would you like to add a new one?", width=WIDTH, help_button=1)
513
            if code == d.DIALOG_OK:
514
                if not add_property(session):
515
                    return True
516
            elif code == d.DIALOG_CANCEL:
517
                return True
518
            elif code == d.DIALOG_HELP:
519
                show_properties_help(session)
520
            continue
521

  
500 522
        (code, choice) = d.menu(
501 523
            "In this menu you can edit existing image properties or add new "
502 524
            "ones. Be careful! Most properties have special meaning and "
......
526 548
        elif code == d.DIALOG_EXTRA:
527 549
            add_property(session)
528 550
        elif code == 'help':
529
            help_file = get_help_file("image_properties")
530
            assert os.path.exists(help_file)
531
            d.textbox(help_file, title="Image Properties", width=70, height=40)
551
            show_properties_help(session)
532 552

  
533 553

  
534 554
def delete_properties(session):
......
539 559
    for (key, val) in session['metadata'].items():
540 560
        choices.append((key, "%s" % val, 0))
541 561

  
562
    if len(choices) == 0:
563
        d.msgbox("No available images properties to delete!",
564
                 width=SMALL_WIDTH)
565
        return True
566

  
542 567
    (code, to_delete) = d.checklist("Choose which properties to delete:",
543 568
                                    choices=choices, width=WIDTH)
544 569
    to_delete = map(lambda x: x.strip('"'), to_delete)  # needed for OpenSUSE

Also available in: Unified diff