Esempio n. 1
0
def main():
  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)

  my_cool_parser.add_argument("FileChooser", help=file_help_msg, widget="FileChooser")
  my_cool_parser.add_argument("DirectoryChooser", 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("directory", help="Directory to store output")

  my_cool_parser.add_argument('-d', '--duration', default=2, type=int, help='Duration (in seconds) of the program output')
  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("-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", 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("-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()
  verbosity.add_argument('-t', '--verbozze', dest='verbose', action="store_true", help="Show more details")
  verbosity.add_argument('-q', '--quiet', dest='quiet', action="store_true", help="Only output on error")

  args = my_cool_parser.parse_args()
  display_message()
def main():
    settings_msg = 'Example program to show how to place multiple argument groups as tabs'
    parser = GooeyParser(description=settings_msg)

    group1 = parser.add_argument_group('General')
    group1.add_argument('--opt1', action='store_true', help='Option one')

    group2 = parser.add_argument_group('Options')
    group2.add_argument('--opt2', action='store_true', help='Option two')

    args = parser.parse_args()

    display_message()
Esempio n. 3
0
def game_loop():

    crashed = False
    x = display_width * 0.45
    y = display_height * 0.8

    x_change = 0
    vel = 7

    while not crashed:
        
        # pygame grabs events for us
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                crashed = True
            # if event.type == pygame.KEYDOWN:
            #     if event.key == pygame.K_LEFT:
            #         x_change = -5
            #     elif event.key == pygame.K_RIGHT:
            #         x_change = 5
            # if event.type == pygame.KEYUP:
            #     if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT:
            #         x_change = 0
        
        keys_pressed = pygame.key.get_pressed()
        if(keys_pressed[pygame.K_LEFT] and x>0):
            x -= vel
        if(keys_pressed[pygame.K_RIGHT] and x<(display_width-carImg_width)):
            x += vel
        if(keys_pressed[pygame.K_UP] and y>0):
            y-=vel    
        if(keys_pressed[pygame.K_DOWN] and y<(display_height-carImg_height)):
            y += vel
        
        #x += x_change

        gameDisplay.fill(white)
        display_message('Hello world',gameDisplay,display_width,display_height)
        car(x,y)
        pygame.display.update()
        clock.tick(60)
Esempio n. 4
0
def main():
    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)

    my_cool_parser.add_argument(
        "FileChooser", help=file_help_msg, widget="FileChooser")
    my_cool_parser.add_argument(
        "DirectoryChooser", 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("directory", help="Directory to store output")

    my_cool_parser.add_argument('-d', '--duration', default=2,
                                type=int, help='Duration (in seconds) of the program output')
    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(
        "-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", 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(
        "-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()
    verbosity.add_argument('-t', '--verbozze', dest='verbose',
                           action="store_true", help="Show more details")
    verbosity.add_argument('-q', '--quiet', dest='quiet',
                           action="store_true", help="Only output on error")

    args = my_cool_parser.parse_args()
    display_message()
Esempio n. 5
0
def main():
    settings_msg = 'Subparser example demonstating bundled configurations ' \
                   'for Siege, Curl, and FFMPEG'
    parser = GooeyParser(description=settings_msg)
    parser.add_argument('--verbose',
                        help='be verbose',
                        dest='verbose',
                        action='store_true',
                        default=False)
    subs = parser.add_subparsers(help='commands', dest='command')

    curl_parser = subs.add_parser(
        'curl', help='curl is a tool to transfer data from or to a server')
    curl_parser.add_argument('Path',
                             help='URL to the remote server',
                             type=str,
                             widget='FileChooser')
    curl_parser.add_argument(
        '--connect-timeout',
        help='Maximum time in seconds that you allow curl\'s connection to take'
    )
    curl_parser.add_argument('--user-agent',
                             help='Specify the User-Agent string ')
    curl_parser.add_argument(
        '--cookie', help='Pass the data to the HTTP server as a cookie')
    curl_parser.add_argument(
        '--dump-header',
        type=argparse.FileType,
        help='Write the protocol headers to the specified file')
    curl_parser.add_argument(
        '--progress-bar',
        action="store_true",
        help='Make curl display progress as a simple progress bar')
    curl_parser.add_argument(
        '--http2',
        action="store_true",
        help='Tells curl to issue its requests using HTTP 2')
    curl_parser.add_argument('--ipv4',
                             action="store_true",
                             help=' resolve names to IPv4 addresses only')

    # ########################################################
    siege_parser = subs.add_parser(
        'siege',
        help=
        'Siege is an http/https regression testing and benchmarking utility')
    siege_parser.add_argument(
        '--get',
        help='Pull down headers from the server and display HTTP transaction',
        type=str)
    siege_parser.add_argument(
        '--concurrent',
        help='Stress the web server with NUM number of simulated users',
        type=int)
    siege_parser.add_argument(
        '--time',
        help='allows you to run the test for a selected period of time',
        type=int)
    siege_parser.add_argument(
        '--delay',
        help=
        'simulated user is delayed for a random number of seconds between one and NUM',
        type=int)
    siege_parser.add_argument('--message',
                              help='mark the log file with a separator',
                              type=int)

    # ########################################################
    ffmpeg_parser = subs.add_parser(
        'ffmpeg',
        help=
        'A complete, cross-platform solution to record, convert and stream audio and video'
    )
    ffmpeg_parser.add_argument(
        'Output',
        help='Pull down headers from the server and display HTTP transaction',
        widget='FileSaver',
        type=argparse.FileType)
    ffmpeg_parser.add_argument(
        '--bitrate',
        help='set the video bitrate in kbit/s (default = 200 kb/s)',
        type=str)
    ffmpeg_parser.add_argument('--fps',
                               help='set frame rate (default = 25)',
                               type=str)
    ffmpeg_parser.add_argument(
        '--size',
        help='set frame size. The format is WxH (default 160x128)',
        type=str)
    ffmpeg_parser.add_argument(
        '--aspect',
        help='set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)',
        type=str)
    ffmpeg_parser.add_argument('--tolerance',
                               help='set video bitrate tolerance (in kbit/s)',
                               type=str)
    ffmpeg_parser.add_argument(
        '--maxrate',
        help='set min video bitrate tolerance (in kbit/s)',
        type=str)
    ffmpeg_parser.add_argument('--bufsize',
                               help='set ratecontrol buffere size (in kbit)',
                               type=str)

    parser.parse_args()

    display_message()
Esempio n. 6
0
def main():
    settings_msg = 'Subparser example demonstating bundled configurations ' \
                   'for Siege, Curl, and FFMPEG'
    parser = GooeyParser(description=settings_msg)
    parser.add_argument('--verbose', help='be verbose', dest='verbose',
                        action='store_true', default=False)
    subs = parser.add_subparsers(help='commands', dest='command')

    curl_parser = subs.add_parser(
        'curl', help='curl is a tool to transfer data from or to a server')
    curl_parser.add_argument('Path',
                             help='URL to the remote server',
                             type=str, widget='FileChooser')
    curl_parser.add_argument('--connect-timeout',
                             help='Maximum time in seconds that you allow curl\'s connection to take')
    curl_parser.add_argument('--user-agent',
                             help='Specify the User-Agent string ')
    curl_parser.add_argument('--cookie',
                             help='Pass the data to the HTTP server as a cookie')
    curl_parser.add_argument('--dump-header', type=argparse.FileType,
                             help='Write the protocol headers to the specified file')
    curl_parser.add_argument('--progress-bar', action="store_true",
                             help='Make curl display progress as a simple progress bar')
    curl_parser.add_argument('--http2', action="store_true",
                             help='Tells curl to issue its requests using HTTP 2')
    curl_parser.add_argument('--ipv4', action="store_true",
                             help=' resolve names to IPv4 addresses only')

    # ########################################################
    siege_parser = subs.add_parser(
        'siege', help='Siege is an http/https regression testing and benchmarking utility')
    siege_parser.add_argument('--get',
                              help='Pull down headers from the server and display HTTP transaction',
                              type=str)
    siege_parser.add_argument('--concurrent',
                              help='Stress the web server with NUM number of simulated users',
                              type=int)
    siege_parser.add_argument('--time',
                              help='allows you to run the test for a selected period of time',
                              type=int)
    siege_parser.add_argument('--delay',
                              help='simulated user is delayed for a random number of seconds between one and NUM',
                              type=int)
    siege_parser.add_argument('--message',
                              help='mark the log file with a separator',
                              type=int)

    # ########################################################
    ffmpeg_parser = subs.add_parser(
        'ffmpeg', help='A complete, cross-platform solution to record, convert and stream audio and video')
    ffmpeg_parser.add_argument('Output',
                               help='Pull down headers from the server and display HTTP transaction',
                               widget='FileSaver', type=argparse.FileType)
    ffmpeg_parser.add_argument('--bitrate',
                               help='set the video bitrate in kbit/s (default = 200 kb/s)',
                               type=str)
    ffmpeg_parser.add_argument('--fps',
                               help='set frame rate (default = 25)',
                               type=str)
    ffmpeg_parser.add_argument('--size',
                               help='set frame size. The format is WxH (default 160x128)',
                               type=str)
    ffmpeg_parser.add_argument('--aspect',
                               help='set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)',
                               type=str)
    ffmpeg_parser.add_argument('--tolerance',
                               help='set video bitrate tolerance (in kbit/s)',
                               type=str)
    ffmpeg_parser.add_argument('--maxrate',
                               help='set min video bitrate tolerance (in kbit/s)',
                               type=str)
    ffmpeg_parser.add_argument('--bufsize',
                               help='set ratecontrol buffere size (in kbit)',
                               type=str)

    parser.parse_args()

    display_message()
Esempio n. 7
0
def main(args=None):
    setup_logging()
    parser = GooeyParser(description='Planet and EE Pipeline')
    subparsers = parser.add_subparsers()
    ##Planet Assets Tools
    parser_planet_key = subparsers.add_parser('planet_key', help='Enter your planet API Key')
    parser_planet_key.set_defaults(func=planet_key_from_parser)
    
    parser_aoijson=subparsers.add_parser('aoijson',help='Convert KML/SHP/WKT/GeoJSON file to aoi.json file with structured query for use with Planet API 1.0')
    parser_aoijson.add_argument('--start', default='Start date in YYYY-MM-DD',help='Start date in YYYY-MM-DD?',widget='DateChooser')
    parser_aoijson.add_argument('--end', default='End date in YYYY-MM-DD',help='End date in YYYY-MM-DD?',widget='DateChooser')
    parser_aoijson.add_argument('--cloud', default='Maximum Cloud Cover(0-1)',help='Maximum Cloud Cover(0-1) representing 0-100')
    parser_aoijson.add_argument('--inputfile',default='Choose a KML/SHP/geojson/WKT file or Landsat WRS',choices=['KML', 'SHP','GJSON','WKT','WRS'],help='Choose a KML/SHP/geojson/WKT file or Landsat WRS')
    parser_aoijson.add_argument('--geo', default='map.geojson/aoi.kml/aoi.shp/aoi.wkt file or 6 digit WRS PathRow',help='map.geojson/aoi.kml/aoi.shp/aoi.wkt file',widget="MultiFileChooser")
    parser_aoijson.add_argument('--loc', help='Location where aoi.json file is to be stored',widget="MultiDirChooser")
    parser_aoijson.set_defaults(func=aoijson_from_parser)

    parser_activatepl=subparsers.add_parser('activatepl',description='Tool to query and/or activate Planet Assets')
    parser_activatepl.add_argument('--aoi',default='Choose JSON file to be used with Planet API/Created Earlier',help='Choose JSON file created earlier',widget="MultiFileChooser")
    parser_activatepl.add_argument('--action',choices=['check', 'activate'],help='Check/activate')
    parser_activatepl.add_argument('--asst',choices=['PSOrthoTile analytic','PSOrthoTile analytic_dn','PSOrthoTile visual','PSScene4Band analytic','PSScene4Band analytic_dn','PSScene3Band analytic','PSScene3Band analytic_dn','PSScene3Band visual','REOrthoTile analytic','REOrthoTile visual'],help='PSOrthoTile analytic,PSOrthoTile analytic_dn,PSOrthoTile visual,PSScene4Band analytic,PSScene4Band analytic_dn,PSScene3Band analytic,PSScene3Band analytic_dn,PSScene3Band visual,REOrthoTile analytic,REOrthoTile visual')
    parser_activatepl.set_defaults(func=activatepl_from_parser)

    parser_downloadpl=subparsers.add_parser('downloadpl',help='Tool to download Planet Assets')
    parser_downloadpl.add_argument('--aoi', default='Choose JSON file to be used with Planet API/Created Earlier',help='Choose JSON file created earlier',widget="MultiFileChooser")
    parser_downloadpl.add_argument('--action', default='download',help='choose download')
    parser_downloadpl.add_argument('--asst',choices=['PSOrthoTile analytic','PSOrthoTile analytic_dn','PSOrthoTile visual','PSScene4Band analytic','PSScene4Band analytic_dn','PSScene3Band analytic','PSScene3Band analytic_dn','PSScene3Band visual','REOrthoTile analytic','REOrthoTile visual','PSOrthoTile analytic_xml','PSOrthoTile analytic_dn_xml','PSOrthoTile visual_xml','PSScene4Band analytic_xml','PSScene4Band analytic_dn_xml','PSScene3Band analytic_xml','PSScene3Band analytic_dn_xml','PSScene3Band visual_xml','REOrthoTile analytic_xml','REOrthoTile visual_xml'],help='PSOrthoTile analytic,PSOrthoTile analytic_dn,PSOrthoTile visual,PSScene4Band analytic,PSScene4Band analytic_dn,PSScene3Band analytic,PSScene3Band analytic_dn,PSScene3Band visual,REOrthoTile analytic,REOrthoTile visual')
    parser_downloadpl.add_argument('--pathway',default='Folder where you want to save assets',help='Folder Path where PlanetAssets are saved example ./PlanetScope ./RapidEye',widget="MultiDirChooser")
    parser_downloadpl.set_defaults(func=downloadpl_from_parser)

    parser_metadata=subparsers.add_parser('metadata',help='Tool to tabulate and convert all metadata files from Planet or Digital Globe Assets')
    parser_metadata.add_argument('--asset', default='PS',choices=['PSO','PSO_DN','PSO_V','PS4B','PS4B_DN','PS3B','PS3B_DN','PS3B_V','REO','REO_V','DGMS','DGP'],help='RapidEye/PlantScope/DigitalGlobe MS/DigitalGlobe Pan(RE/PS/DGMS/DGP)?')
    parser_metadata.add_argument('--mf', default='Metadata folder',help='Metadata folder',widget="MultiDirChooser")
    parser_metadata.add_argument('--mfile',default='Metadata filename browse and create file and click open',help='Metadata filename to be exported with Path.csv',widget="MultiFileChooser")
    parser_metadata.add_argument('--errorlog',default='Error log browse and create file and click open',help='Errorlog to be exported along with Path.csv',widget="MultiFileChooser")
    parser_metadata.set_defaults(func=metadata_from_parser)

    ##Earth Engine Tools
    parser_ee_user = subparsers.add_parser('ee_user', help='Get Earth Engine API Key & Paste it back to Command line/shell to change user')
    parser_ee_user.set_defaults(func=ee_user_from_parser)

    parser_create = subparsers.add_parser('create',help='Allows the user to create an asset collection or folder in Google Earth Engine')
    parser_create.add_argument('--typ', help='Specify type: collection or folder', required=True)
    parser_create.add_argument('--path', help='This is the path for the earth engine asset to be created full path is needsed eg: users/johndoe/collection', required=True)
    parser_create.set_defaults(func=create_from_parser)
    
    parser_upload = subparsers.add_parser('upload', help='Batch Asset Uploader to Earth Engine.')
    required_named = parser_upload.add_argument_group('Required named arguments.')
    required_named.add_argument('-u', '--user', help='Google account name (gmail address).', required=True)
    required_named.add_argument('--source', help='Path to the directory with images for upload.', required=True)
    required_named.add_argument('--dest', help='Destination. Full path for upload to Google Earth Engine, e.g. users/pinkiepie/myponycollection', required=True)
    optional_named = parser_upload.add_argument_group('Optional named arguments')
    optional_named.add_argument('-m', '--metadata', help='Path to CSV with metadata.')
    optional_named.add_argument('--nodata', type=int, help='The value to burn into the raster as NoData (missing data)')
    parser_upload.set_defaults(func=upload_from_parser)

    parser_lst = subparsers.add_parser('lst',help='List assets in a folder/collection or write as text file')
    parser_lst.add_argument('--location', help='This it the location of your folder/collection', required=True)
    parser_lst.add_argument('--type', help='Whether you want the list to be printed or output as text', required=True)
    parser_lst.add_argument('--items', help="Number of items to list")
    parser_lst.add_argument('--folder',help="Folder location for report to be exported")
    parser_lst.set_defaults(func=lst_from_parser)

    parser_tasks=subparsers.add_parser('tasks',help='Queries currently running, enqued,failed')
    parser_tasks.set_defaults(func=tasks_from_parser)
    
    parser_taskquery=subparsers.add_parser('taskquery',help='Queries currently running, enqued,failed ingestions and uploaded assets')
    parser_taskquery.add_argument('--destination',default='users/folder/collection',help='Full path to asset where you are uploading files')
    parser_taskquery.set_defaults(func=taskquery_from_parser)

    parser_genreport=subparsers.add_parser('report',help='Create a report of all tasks and exports to a CSV file')
    parser_genreport.add_argument('--r',default='Folder Path where the reports will be saved',help='Folder Path where the reports will be saved',widget="MultiDirChooser")
    parser_genreport.set_defaults(func=genreport_from_parser)

    parser_cancel = subparsers.add_parser('cancel', help='Cancel all running tasks')
    parser_cancel.set_defaults(func=cancel_all_running_tasks_from_parser)
    
    parser_mover=subparsers.add_parser('mover',help='Moves all assets from one collection to another')
    parser_mover.add_argument('--assetpath',default='users/folder/collection1',help='Existing path of assets')
    parser_mover.add_argument('--finalpath',default='users/folder/collection2',help='New path for assets')
    parser_mover.set_defaults(func=mover_from_parser)

    parser_copy=subparsers.add_parser('copy',help='Copies all assets from one collection to another: Including copying from other users if you have read permission to their assets')
    parser_copy.add_argument('--initial',default='users/folder/collection1',help='Existing path of assets')
    parser_copy.add_argument('--final',default='users/folder/collection2',help='New path for assets')
    parser_copy.set_defaults(func=copy_from_parser)

    parser_collprop=subparsers.add_parser('collprop',help='Sets Overall Properties for Image Collection')
    parser_collprop.add_argument('--coll',default='users/folder/collection',help='Path of Image Collection')
    parser_collprop.add_argument('--p',default='system:description=Description',help='system:description=Description|system:title=title')
    parser_collprop.set_defaults(func=collprop_from_parser)
    
    parser_ft = subparsers.add_parser('access',help='Sets Permissions for Images, Collection or all assets in EE Folder Example: python ee_permissions.py --mode "folder" --asset "users/john/doe" --user "[email protected]:R"')
    parser_ft.add_argument('--mode', default='folder|collection|image',choices=['folder','collection','image'],help='This lets you select if you want to change permission or folder/collection/image', required=True)
    parser_ft.add_argument('--asset', default='users/folder/collection',help='This is the path to the earth engine asset whose permission you are changing folder/collection/image', required=True)
    parser_ft.add_argument('--user', default='[email protected]:R',help="""This is the email address to whom you want to give read or write permission Usage: "[email protected]:R" or "[email protected]:W" R/W refers to read or write permission""", required=True)
    parser_ft.set_defaults(func=access_from_parser)

    parser_delete = subparsers.add_parser('delete', help='Deletes collection and all items inside. Supports Unix-like wildcards.')
    parser_delete.add_argument('id', default='users/folder/collection',help='Full path to asset for deletion. Recursively removes all folders, collections and images.')
    parser_delete.set_defaults(func=delete_collection_from_parser)
    
    parser_ft = subparsers.add_parser('convert2ft',help='Uploads a given feature collection to Google Fusion Table.')
    parser_ft.add_argument('--i', help='input feature source (KML, SHP, SpatiLite, etc.)', required=True,widget="MultiFileChooser",default='input feature source (KML, SHP, SpatiLite, etc.)')
    parser_ft.add_argument('--o', help='output Fusion Table name', required=True)
    parser_ft.add_argument('--add_missing', help='add missing features from the last inserted feature index', action='store_true', required=False, default=False)
    parser_ft.set_defaults(func=ft_from_parser)

    parser_cleanout=subparsers.add_parser('cleanout',help='Clear folders with datasets from earlier downloaded')
    parser_cleanout.add_argument('--dirpath',help='Folder you want to delete after all processes have been completed',widget="MultiDirChooser")
    parser_cleanout.set_defaults(func=cleanout_from_parser)

    args = parser.parse_args()

    ee.Initialize()
    args.func(args)
    display_message()
Esempio n. 8
0
from message import display_message

display_message()