예제 #1
0
def main():
    import sys
    print(sys.argv)
    my_cool_parser = GooeyParser(description='Hai', add_help=False)

    description_area = my_cool_parser.add_argument_group(
        "Introduction",
        long_intro,
        gooey_options={
            'show_border': False,
            'show_underline': False,
        }
    )

    # We need at least on
    description_area.add_argument(
        '-nothing',
        gooey_options={
            'visible': False,
        }
    )

    categories = my_cool_parser.add_argument_group(
        'Categories',
        description='There are 13 species of crocodiles, so there are many different ' +
                    'sizes of crocodile. The smallest crocodile is the dwarf crocodile. ' +
                    'It grows to about 5.6 feet (1.7 meters) in length and weighs 13 to 15 pounds ',
        gooey_options={
            'show_border': False,
            'label_color': '#FF9900',
            'columns': 2,
            # 'margin_top': 90
        }
    )

    categories.add_argument(
        '--parent-category',
        metavar='Parent Category',
        help='This is a very, very, very long help text '
                             'to explain a very, very, very important input value. '
                             'Unfortunately, the end of this long message is cropped. ',
        choices=['a', 'b', 'c'],
        required=True)

    args = my_cool_parser.parse_args()
    print("Hiya!")
예제 #2
0
def main():

    import sys
    print("sys.argv sys.argv sys.argv sys.argv sys.argv sys.argv")
    print(sys.argv)
    print('\n\n')
    print(repr(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)

    my_cool_parser.add_argument('thing',
                                default='.',
                                widget='MultiFileChooser',
                                help="asdfsadfasdfa sdfadf ad")
    # my_cool_parser.add_argument(
    #     "region_name_list",
    #     help="Which regions do you want to run it for?",
    #     choices=['one' ,'two', 'three'],
    #     nargs="+",
    #     widget="Listbox",
    #     # widget='Counter'
    # )

    my_cool_parser.add_argument(
        "FileChooser",
        help=file_help_msg,
    )

    my_cool_parser.add_argument(
        "Outfile",
        widget='FileChooser',
        metavar='Output Target',
        help='Target output file',
        gooey_options={'wildcard': 'Some Files (*.png)|*.png'}
        # gooey_options={
        #     'validator': {
        #         'test': 'user_input == "foo"',
        #         'message': 'Must be a valid filename'
        #     }
        # }
    )
    my_cool_parser.add_argument(
        '--listboxie',
        metavar='Multiple selection',
        nargs='+',
        default=['Option three', 'Option four'],
        choices=['Option one', 'Option two', 'Option three', 'Option four'],
        help='Choose an action!',
        widget='Listbox',
        gooey_options={
            'height': 500,
            'validate': '',
            'heading_color': '',
            'text_color': '',
            'hide_heading': True,
            'hide_text': True,
        })
    #
    search_options = my_cool_parser.add_argument_group(
        'Search Options',
        'Customize the search options',
        gooey_options={
            'show_border': True,
            'columns': 2
        })

    x = search_options.add_argument('--query',
                                    help='base search string'
                                    # , gooey_options={'full_width': True}
                                    )
    search_options.add_argument('--other',
                                help='Another option in the search group'
                                # , gooey_options={'full_width': True}
                                )
    search_options.add_argument('--one-more',
                                help='And another one'
                                # , gooey_options={'full_width': True}
                                )

    search_flags = search_options.add_argument_group(
        'Flags', gooey_options={'show_border': True})
    search_flags.add_argument('--buy-it-now',
                              help="Will immediately purchase if possible",
                              action='store_true')
    search_flags.add_argument('--auction',
                              help="Place bids up to PRICE_MAX",
                              action='store_true')

    price_range = search_options.add_argument_group(
        'Price_Range', gooey_options={'show_border': True})

    price_range.add_argument('--price-min', help='min price')
    price_range.add_argument('--price-max', help='max price')

    foobar = search_options.add_mutually_exclusive_group(
        gooey_options={
            'title': 'Numeric Mutexes',
            'show_border': False,
            'label_color': '#00ff00'
        })
    foobar.add_argument('--one', help='oneie')
    foobar.add_argument('--two', help='twoie')
    foobar.add_argument('--three', help='twoie', action='store_true')

    my_cool_parser.add_argument("DirChooser",
                                help=file_help_msg,
                                widget="DirChooser")
    my_cool_parser.add_argument("FileSaver",
                                help=file_help_msg,
                                widget="FileSaver")
    my_cool_parser.add_argument("MultiFileSaver",
                                help=file_help_msg,
                                widget="MultiFileChooser")
    # my_cool_parser.add_argument("MultiDirSaver", help="Directories to open", widget='MultiDirChooser')

    my_cool_parser.add_argument('-j',
                                '--jaws',
                                help='ooop',
                                widget="MultiFileChooser",
                                default="Yo yo!",
                                gooey_options={
                                    'validator': {
                                        'test': 'len(user_input) > 5',
                                        'message': 'Must be over 5 chars!'
                                    }
                                })
    my_cool_parser.add_argument(
        '-d',
        '--duration',
        default=2,
        type=int,
        help='Duration (in seconds) of the program output')
    my_cool_parser.add_argument('-u',
                                '--textarea',
                                default="I'm on \na new line",
                                type=str,
                                help='A multiline textarea',
                                widget='Textarea',
                                gooey_options={'height': 100})
    my_cool_parser.add_argument('-s',
                                '--cron-schedule',
                                type=int,
                                help='datetime when the cron should begin',
                                widget='DateChooser')
    my_cool_parser.add_argument("-c",
                                "--showtime",
                                action="store_true",
                                help="display the countdown timer")
    my_cool_parser.add_argument("-y",
                                "--yolo",
                                action="store_true",
                                widget='BlockCheckbox',
                                help="display the countdown timer")
    my_cool_parser.add_argument("-p",
                                "--pause",
                                action="store_true",
                                help="Pause execution")
    my_cool_parser.add_argument('-v', '--verbose', action='count')
    my_cool_parser.add_argument("-o",
                                "--overwrite",
                                action="store_true",
                                default=True,
                                help="Overwrite output file (if present)")
    my_cool_parser.add_argument('-r',
                                '--recursive',
                                choices=['yes', 'no'],
                                help='Recurse into subfolders')
    # my_cool_parser.add_argument('-y', '--listboxie',
    #                             nargs='+',
    #                             choices=['hello', 'ay', 'yeah', 'boiiiii', 'wssup', 'longest', 'yeahhhboiii', 'ever'],
    #                             help='Recurse into subfolders',
    #                             widget='Listbox')
    my_cool_parser.add_argument("-w",
                                "--writelog",
                                default="writelogs",
                                help="Dump output to local file")
    my_cool_parser.add_argument("-e",
                                "--error",
                                action="store_true",
                                help="Stop process on error (default: No)")
    verbosity = my_cool_parser.add_mutually_exclusive_group(required=False)
    verbosity.add_argument('-t',
                           '--verbozze',
                           dest='verbose',
                           action='store_true',
                           help="Show more details")
    verbosity.add_argument(
        '-q',
        '--quiet',
        dest='quiet',
        help="Only output on error",
        # widget='DirChooser'
    )

    # my_cool_parser.add_argument('--sum', dest='accumulate', action='store_const',
    #                     const=sum, default=max,
    #                     help='sum the integers (default: find the max)')

    import pprint

    # stuff = [extract(x) for x in my_cool_parser._action_groups]
    # mutex_groups = [group for group in my_cool_parser._mutually_exclusive_groups]
    #
    # pprint.pprint(reapply_mutex_groups(mutex_groups, stuff))
    # my_cool_parser.print_help()
    args = my_cool_parser.parse_args()
    print(args)
    # time.sleep(5)
    print("Hiya!")
    for i in range(20):
        import time
        print('Howdy', i)
        time.sleep(.3)
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)

    description_area = my_cool_parser.add_argument_group("About",
                                                         gooey_options={
                                                             'show_border':
                                                             True,
                                                             'show_underline':
                                                             False,
                                                         })

    description_area.add_argument('thing',
                                  default=message,
                                  widget='Textarea',
                                  help="asdfsadfasdfa sdfadf ad",
                                  gooey_options={
                                      'height': 100,
                                      'show_help': False,
                                      'show_label': False,
                                      'readonly': True
                                  })

    categories = my_cool_parser.add_argument_group(
        'Categories',
        description=
        'There are 13 species of crocodiles, so there are many different ' +
        'sizes of crocodile. The smallest crocodile is the dwarf crocodile. ' +
        'It grows to about 5.6 feet (1.7 meters) in length and weighs 13 to 15 pounds ',
        gooey_options={
            'show_border': False,
            'label_color': '#FF9900',
            'columns': 2,
            # 'margin_top': 90
        })

    categories.add_argument(
        '--parent-category',
        metavar='Parent Category',
        help='This is a very, very, very long help text '
        'to explain a very, very, very important input value. '
        'Unfortunately, the end of this long message is cropped. ',
        choices=['a', 'b', 'c'],
        required=True,
        gooey_options={
            'label_color': '#FF9900',
            'label_bg_color': '#0000FF',
            # 'help_color': '#ff00ff',
            'help_bg_color': '#ff00ff'
        })

    categories.add_argument(
        '--subcategory',
        metavar='Subcategory',
        help='Select Subcategory',
        choices=['a', 'b', 'c'],
        required=True,
        gooey_options={
            'label_color': '#FF9900',
            'validator': {
                'type':
                'local',
                'test':
                'user_input',
                'message':
                'this is a super long error message wtih multiple ideas and suggestions on how to go about resolving the error '
            }
            # 'help_color': '#ff00ff',
            # 'help_bg_color': '#ff0000'
        })

    search_options = my_cool_parser.add_argument_group(
        'Search Options',
        'Customize the search options',
        gooey_options={
            'show_border': True,
            'columns': 2,
            'margin_top': 25
        })

    search_options.add_argument('--query',
                                help='base search string',
                                gooey_options={'full_width': True})
    #
    search_flags = search_options.add_argument_group(
        'Flags', gooey_options={'show_border': False})
    search_flags.add_argument('--buy-it-now',
                              metavar='Buy it Now',
                              help="Will immediately purchase if possible",
                              action='store_true',
                              widget='BlockCheckbox',
                              gooey_options={
                                  'label_color': '#4B5F83',
                                  'checkbox_label': 'Enable'
                              })
    search_flags.add_argument('--auction',
                              metavar='Auction',
                              help="Place bids up to PRICE_MAX",
                              action='store_true',
                              widget='BlockCheckbox',
                              gooey_options={
                                  'label_color': '#4B5F83',
                                  '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'
        # 'is a very, very, very long help text '
        # 'to explain a very, very, very important input value. '
    )
    price_range.add_argument('--price-max', help='max price')

    args = my_cool_parser.parse_args()
    print(args)
    print("Hiya!")
    for i in range(20):
        import time
        print('Howdy', i)
        time.sleep(.3)
예제 #4
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)
예제 #5
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)