Exemplo n.º 1
0
def main():
    message = (
        'Hi there!\n\n'
        'Welcome to Gooey! \nThis is a demo of the flexible layouts and overall'
        'customization you can achieve by using argument groups and '
        'the new gooey_options feature.')

    import sys
    print(sys.argv)
    desc = "Gooey transforms your CLI applications into beautiful GUIs!"
    file_help_msg = "Name of the file you want to process"
    my_cool_parser = GooeyParser(description=desc, add_help=False)

    # categories = my_cool_parser.add_argument_group(
    #     'Input Stage',
    #     gooey_options={
    #         'show_border': True,
    #         # 'label_color': '#FF9900',
    #         'columns': 2,
    #         # 'margin_top': 30
    #     }
    # )
    #
    # categories.add_argument(
    #     '--subcategory',
    #     metavar='File',
    #     help='Path the audio file to encode.',
    #     widget='FileChooser',
    #     required=True,
    #     gooey_options={
    #     })
    #
    # categories.add_argument(
    #     '--subcategory21',
    #     metavar='File',
    #     help='Path the audio file to encode.',
    #     widget='FileChooser',
    #     required=True,
    #     gooey_options={
    #     })

    # categories.add_argument(
    #     '--parent-category',
    #     metavar='Bitrate',
    #     help='The constant or variable bitrate (depending on codec choice)',
    #     choices=['a', 'b', 'c'],
    #     required=True,
    #     gooey_options={
    #         'label_color': '#FF9900',
    #         'label_bg_color': '#0000FF',
    #         # 'help_color': '#ff00ff',
    #         'help_bg_color': '#ff00ff'
    #     })

    search_options = my_cool_parser.add_argument_group(
        'Output Stage',
        'Specify the desired output behavior for the encoded file.',
        gooey_options={
            'show_border': True,
            'columns': 2,
            'margin_top': 25
        })

    search_options.add_argument(
        '--query',
        metavar="Output File",
        help='The output destination for the encoded file',
        widget='FileChooser',
        gooey_options={'full_width': True})
    #
    search_flags = search_options.add_argument_group(
        'Resampling', gooey_options={'show_border': True})
    search_flags.add_argument(
        '--buy-it-now',
        metavar='Lowpass',
        help="Frequency(kHz), lowpass filter cutoff above freq.",
        action='store_true',
        widget='BlockCheckbox',
        gooey_options={'checkbox_label': 'Enable'})
    search_flags.add_argument('--auction',
                              metavar='Resample',
                              help="Sampling frequency of output file(kHz)",
                              action='store_true',
                              widget='BlockCheckbox',
                              gooey_options={'checkbox_label': 'Enable'})

    # price_range = search_options.add_argument_group('Price_Range',
    #                                                 gooey_options={'show_border': True}
    #                                                 )
    #
    # price_range.add_argument('--price-min',
    #                          help='This'
    #                          )
    # price_range.add_argument(
    #     '--price-max',
    #     metavar='Priority',
    #     help='sets the process priority (Windows and OS/2-specific)',
    #     choices=[0,1,2,3,4],
    #     default=2
    # )

    my_cool_parser.print_help()
    args = my_cool_parser.parse_args()
    print(args)
    print("Hiya!")
    for i in range(20):
        import time
        print('Howdy', i)
        time.sleep(.3)
Exemplo n.º 2
0
def main():
    message = (
        'Hi there!\n\n'
        'Welcome to Gooey! \nThis is a demo of the flexible layouts and overall'
        'customization you can achieve by using argument groups and '
        'the new gooey_options feature.')

    import sys
    print(sys.argv)
    desc = "Example application to show Gooey's various widgets"
    file_help_msg = "Name of the file you want to process"
    my_cool_parser = GooeyParser(description=desc, add_help=False)

    categories = my_cool_parser.add_argument_group(
        'Example 1',
        description='This is the default group style',
        gooey_options={
            'show_underline': True,
            'show_border': False,
            # 'label_color': '#FF9900',
            'columns': 1,
            # 'margin_top': 90
        })

    categories.add_argument(
        '--subcategoryasdf2asdf',
        metavar='Parent Category',
        help='Select Subcategory',
        choices=['a', 'b', 'c'],
        required=True,
    )

    categories.add_argument(
        '--subcategory',
        metavar='Subcategory',
        help='Select Subcategory',
        choices=['a', 'b', 'c'],
        required=True,
    )

    categories1 = my_cool_parser.add_argument_group(
        'Example 2',
        description='This is an argument group with no horizontal line break',
        gooey_options={
            'show_underline': False,
            'show_border': False,
        })

    categories1.add_argument(
        '--subcategoryasdf2asdfasdf',
        metavar='Parent Category',
        help='Select Subcategory',
        choices=['a', 'b', 'c'],
        required=True,
    )

    categories1.add_argument(
        '--subcategory1',
        metavar='Subcategory',
        help='Select Subcategory',
        choices=['a', 'b', 'c'],
        required=True,
    )

    categories2 = my_cool_parser.add_argument_group(
        'Example 3',
        description='This is an argument group with show_border = True',
        gooey_options={
            'show_underline': False,
            'show_border': True,
            # 'label_color': '#FF9900',
            # 'columns': 2,
            # 'margin_top': 90
        })

    categories2.add_argument(
        '--subcategoryasdf2',
        metavar='Parent Category',
        help='Select Subcategory',
        choices=['a', 'b', 'c'],
        required=True,
    )

    categories2.add_argument(
        '--subcategory2',
        metavar='Subcategory',
        help='Select Subcategory',
        choices=['a', 'b', 'c'],
        required=True,
    )

    my_cool_parser.print_help()
    args = my_cool_parser.parse_args()
    print(args)
    print("Hiya!")
    for i in range(20):
        import time
        print('Howdy', i)
        time.sleep(.3)