示例#1
0
def main():
    cli = GooeyParser(
        description="Remove Host Reads from Nanopore Fastq Files")
    required_args = cli.add_argument_group("Input Output",
                                           gooey_options={'columns': 1})
    required_args.add_argument(
        '--InputFolder',
        help=
        "Folder containing basecalled Nanopore fastq files. Only files ending in .fastq will be used",
        required=True,
        widget='DirChooser')
    required_args.add_argument('--Reference',
                               help="Host Reference fasta or fasta.gz file",
                               required=True,
                               widget='FileChooser')
    required_args.add_argument('--OutputFolder',
                               help="Output Folder",
                               required=False,
                               default='~/dehost_output/test')

    parser = cli.add_argument_group("Optional Arguments",
                                    gooey_options={'columns': 2})
    parser.add_argument(
        '--threads',
        help="Number of threads. More is faster if your computer supports it",
        type=int,
        required=False,
        default=4)

    method = parser.add_mutually_exclusive_group()
    method.add_argument('--Nanopore',
                        help='Data from Nanopore Sequencing',
                        action='store_true')
    method.add_argument('--PacBio',
                        help='Data from PacBio Sequencing',
                        action='store_true')
    args = cli.parse_args()

    if (args.Nanopore):
        seq_method = "map-ont"
    elif (args.PacBio):
        seq_method = "map-pb"

    files = glob.glob(args.InputFolder + "/*.fastq")

    for i in files:
        base = os.path.splitext(os.path.basename(i))[0]
        #print(base)
        os.system(f"mkdir -p {args.OutputFolder}")
        minimap2_cmd = f"minimap2 -ax {seq_method} {args.Reference} {i} -t {args.threads} > {args.OutputFolder}/{base}.sam"
        print(minimap2_cmd)
        os.system(minimap2_cmd)
        samtools_cmd1 = f"samtools view -u -f 4 {args.OutputFolder}/{base}.sam > {args.OutputFolder}/{base}_filtered.sam"
        print(samtools_cmd1)
        os.system(samtools_cmd1)
        samtools_cmd2 = f"samtools bam2fq {args.OutputFolder}/{base}_filtered.sam > {args.OutputFolder}/{base}_filtered.fastq"
        print(samtools_cmd2)
        os.system(samtools_cmd2)
        delete_cmd = f"rm {args.OutputFolder}/*.sam"
        os.system(delete_cmd)
def make_parser():
    description = DESCRIPTION
    if update_available():
        description += '\nUpdate available! Please go to "File" -> "Download latest release" to update FFsubsync.'
    parser = GooeyParser(description=description)
    main_group = parser.add_argument_group('Basic')
    main_group.add_argument(
        'reference',
        help='Reference (video or subtitles file) to which to synchronize input subtitles.',
        widget='FileChooser'
    )
    main_group.add_argument('srtin', help='Input subtitles file', widget='FileChooser')
    main_group.add_argument('-o', '--srtout',
                            help='Output subtitles file (default=${srtin}.synced.srt).',
                            widget='FileSaver')
    advanced_group = parser.add_argument_group('Advanced')

    # TODO: these are shared between gui and cli; don't duplicate this code
    advanced_group.add_argument('--merge-with-reference', '--merge', action='store_true',
                                help='Merge reference subtitles with synced output subtitles.')
    advanced_group.add_argument('--make-test-case', '--create-test-case', action='store_true',
                                help='If specified, create a test archive a few KiB in size '
                                     'to send to the developer as a debugging aid.')
    advanced_group.add_argument(
        '--reference-stream', '--refstream', '--reference-track', '--reftrack', default=None,
        help='Which stream/track in the video file to use as reference, '
             'formatted according to ffmpeg conventions. For example, s:0 '
             'uses the first subtitle track; a:3 would use the fourth audio track.'
    )
    return parser
示例#3
0
def main():
    cli = GooeyParser(description='Utils')
    required_args = cli.add_argument_group("Required Arguments")
    required_args.add_argument('-i',
                               '--in',
                               required=True,
                               metavar='PATH',
                               dest='inpath')
    required_args.add_argument('-o',
                               '--out',
                               required=True,
                               metavar='PATH',
                               dest='outpath')

    advanced_section = cli.add_argument_group(
        "Advanced Options",
        description='Change these options at your own risk!!!',
        gooey_options={'show_border': True})

    advanced_section.add_argument(
        '--dont-destroy-computer',
        help='When enabled this will NOT cause an explosion',
        metavar="Avoid Violently Self Destructing",
        action='store_true',
        widget='BlockCheckbox',
        default=True)
    args = cli.parse_args()
    def parse_args():
        parser = GooeyParser(description='parses and scores drz files')

        required = parser.add_argument_group('Required Arguments',
                                             gooey_options={'columns': 1})
        required.add_argument('--indir',
                              widget='DirChooser',
                              required=True,
                              help='directory containing drz txt files')

        optional = parser.add_argument_group('Optional Arguments',
                                             gooey_options={'columns': 1})
        optional.add_argument('--filename_format',
                              default=DEFAULT_FILENAME_FORMAT,
                              help='regex for matching filenames in indir')
        optional.add_argument(
            '-r',
            '--reuse',
            action='store_true',
            help=
            'reuse the output file from previous run (default is to parse again)'
        )
        optional.add_argument(
            '--check',
            action='store_true',
            help=
            'check for missing/extra data and output anomalies to file (default is not to check)'
        )
        optional.add_argument(
            '--nested',
            action='store_true',
            help='if indir has log files nested in subject directories')
        return parser.parse_args()
示例#5
0
def main() -> None:
    """Main functionality. Uses Gooey for argparsing so we get a nice GUI!"""

    # Argparsing
    parser = GooeyParser(description="Convert images to a single PDF file.")
    input_group = parser.add_argument_group("Input")
    output_group = parser.add_argument_group("Output")
    input_group.add_argument(
        "image_path",
        metavar="Image folder",
        help="Folder with images that should be written to a PDF file.",
        widget="DirChooser",
        type=Path,
    )
    output_group.add_argument(
        "outfile",
        metavar="Output file",
        help="PDF file to output images to.",
        widget="FileSaver",
        type=Path,
    )
    args = parser.parse_args()
    print(args.image_path, args.outfile, flush=True)

    # Run conversion
    try:
        images2pdf(Path(args.image_path), Path(args.outfile))
    except ImageConvertError as e:
        sys.exit(e)
    else:
        print(f"Successfully wrote images to {args.outfile}! :)", flush=True)
    def parse_args():
        parser = GooeyParser(
            description='Score redcap data (from export file)')
        required = parser.add_argument_group('Required Arguments')
        required.add_argument('--study',
                              required=True,
                              choices=['nt', 'r01'],
                              help='which project to structure data for')

        input = parser.add_argument_group('Data Input Options',
                                          gooey_options={'columns': 1})
        input.add_argument('--api_db_password', widget='PasswordField')
        input.add_argument(
            '--nt_file',
            widget='FileChooser',
            help=
            'file containing data exported from NewTics redcap project (if unspecified API will be used)'
        )
        input.add_argument(
            '--r01_file',
            widget='FileChooser',
            help=
            'file containing data exported from R01 redcap project (if unspecified API will be used)'
        )

        return parser.parse_args()
示例#7
0
def parseArg():
    parser=GooeyParser(description="This program was developped in order to clusterize molecular dynamic trajectories")


    
    files = parser.add_argument_group("File")
    files.add_argument("Trajectory File",
                       help="Trajectory file (xtc/trr/dcd/nc/pdb..)",
                       widget="FileChooser")
    files.add_argument("Topology File", help="Topology file (pdb/prmtop..)", widget="FileChooser")
    files.add_argument("-l","--Log File", help="Logfile", widget="FileSaver", default="clustering.log")
    


    selection = parser.add_argument_group("Selection")
    selection.add_argument('-st','--Trajectory Selection', help="selection syntax for trajectory extraction.", default="all")
    selection.add_argument('-sa','--Alignement Selection', help="selection syntax for alignement. use 'none' to remove alignement", default="backbone")
    selection.add_argument('-sr','--Selection for RMSD Calculation', help="selection syntax for RMSD (used for clustering).",  default="backbone")

    #Clustering arguments
    clustering = parser.add_argument_group("Clustering")
    clustering.add_argument('-m','--Clustering Method', help="method for clustering", default="ward", choices=["ward",
                                                                                                              "single ",
                                                                                                              "complete",
                                                                                                              "average",
                                                                                                              "weighted",
                                                                                                              "centroid",
                                                                                                              "median"])

    
    clustering_cutoff = clustering.add_mutually_exclusive_group(required=True,
                                                                gooey_options={'initial_selection': 0}
                                                                )
    clustering_cutoff.add_argument("-aa", "--Auto Clustering",
                                   action="store_true",
                                   help="Autoclustering with the Elbow method",
                                   default=True)
    clustering_cutoff.add_argument("-gs","--Graphical Selection",
                                   action="store_true",
                                   help="Clic on the dendrogram to clusterize")
    clustering_cutoff.add_argument('-ng', "--Number of clustering Group",
                                   help="Number of group wanted",
                                   default=None)
    clustering_cutoff.add_argument('-cc',"--Dendrogramme Clustering Cutoff",
                                   help="cutoff for clusterization from hierarchical clusturing with Scipy", 
                                   default=None)

    


    args = vars(parser.parse_args())
    #args = vars(parser.parse_args())


    if args["Auto Clustering"] == True:
        args["Dendrogramme Clustering Cutoff"] = None
        args["Number of clustering Group"] = "auto"
    return(args)
示例#8
0
def parse_args():

    parser = GooeyParser()

    parser.add_argument('Fixed_Assets_File',
                        action='store',
                        widget='FileChooser',
                        help="Excel file with all fixed assets to depreciate")
    parser.add_argument('Current_Year',
                        action='store',
                        help="Current Financial Year in format YYYY")

    parser.add_argument('Country',
                        widget='Dropdown',
                        choices=[
                            'Germany',
                            'France',
                            'Poland',
                            'United Kingdom',
                            'Netherlands',
                            'Sweden',
                            'Spain',
                        ],
                        help="Choose the country")

    parser.add_argument('Method_of_Depreciation',
                        widget='Dropdown',
                        action='store',
                        choices=['Useful Life', 'Depreciation Rate'],
                        help='Choose Depreciation Method')

    tables = parser.add_argument_group('Supporting Graphs and Tables')

    tables.add_argument('Tables',
                        widget='Dropdown',
                        action='store',
                        choices=['YES', 'NO'],
                        help="Produce Depreciation Table?")

    tables.add_argument('Graphs',
                        widget='Dropdown',
                        choices=['YES', 'NO'],
                        action='store',
                        help="Produce Depreciation Graph?")
    output = parser.add_argument_group('Depreciation File Name')

    output.add_argument('Output_File_Name',
                        action='store',
                        help="Name of the output file with .xlsx",
                        gooey_options={
                            'validator': {
                                'test': 'user_input.endswith(".xlsx") == True',
                                'message': 'Must contain .xlsx at the end!'
                            }
                        })

    args = parser.parse_args()
    return args
示例#9
0
def parse_args():
    parser = GooeyParser(description='Extracts certain fields from a REDCap data export')

    required_group = parser.add_argument_group('Required Arguments', gooey_options={'columns': 1})
    required_group.add_argument('--input_file', required=True, widget='FileChooser', help='exported file to extract fields from')
    required_group.add_argument('--fields', required=True, nargs='+', help='Space-separated list of fields to extract from data export (can be exact column names or regexes)')

    optional_group = parser.add_argument_group('Optional Arguments', gooey_options={'columns': 1})
    optional_group.add_argument('-m', '--merge', widget='FileChooser', metavar='merge_with_file', help='merge extracted fields with data from specified file')
    optional_group.add_argument('-o', '--output_file', widget='FileChooser', help='file (csv) to write results to (default: <input_file>_extract.csv or <merge_with_file>_merged.csv)')

    return parser.parse_args()
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()
示例#11
0
def main():
    import os
    parser = GooeyParser(description="Unit tests helper program")
    
    group1 = parser.add_argument_group("General")
    group1.add_argument("program", type=str, help="Program to run", widget="FileChooser", gooey_options=filenameValidator)
    group1.add_argument("tests", type=str, help="Tests directory", widget="DirChooser", gooey_options=dirValidator)
    group1.add_argument("solution", type=str, help="Solution directory", widget="DirChooser", gooey_options=dirValidator)
    
    group2 = parser.add_argument_group("Options")
    group2.add_argument("--wsl", help="Run program within WSL2", action="store_false")
    
    args = parser.parse_args()
    test(args.program, args.tests, args.solution, not args.wsl)
示例#12
0
def parse_args():
	parser = GooeyParser(description='Generate REDCap import for CBCL scores from PDF reports')

	required_group = parser.add_argument_group('Required Arguments', gooey_options={'columns': 1})
	required_group.add_argument('--folder', widget='DirChooser', required=True, help='Folder containing score reports to be processed')
	required_group.add_argument('--outfile', widget='FileChooser', required=True, help='File to output results to')
	required_group.add_argument('--study_id_var', help='REDCap variable for study id (i.e. demo_study_id, newt_id)')
	required_group.add_argument('--subject_prefix', required=True, help='prefix for subject identifier string (i.e. NT, NEWT, WOLF)')

	optional_group = parser.add_argument_group('Optional Arguments', gooey_options={'columns': 1})
	optional_group.add_argument('-s', '--subjects', nargs='+', help='Space-separated list of subject ids to run for (if blank, runs all in folder)')
	optional_group.add_argument('--from_date', type=lambda d: datetime.strptime(d, '%Y-%m-%d'), widget='DateChooser', help='Process only files that were modified on/after specified date')
	optional_group.add_argument('--flatten_sessions', action='store_true', help='flatten session names (only needed if REDCap is set up non-longitudinally)')

	return parser.parse_args()
示例#13
0
def make_parser():
    description = DESCRIPTION
    if update_available():
        description += '\nUpdate available! Please go to "File" -> "Download latest release" to update FFsubsync.'
    parser = GooeyParser(description=description)
    main_group = parser.add_argument_group("Basic")
    main_group.add_argument(
        "reference",
        help=
        "Reference (video or subtitles file) to which to synchronize input subtitles.",
        widget="FileChooser",
    )
    main_group.add_argument("srtin",
                            help="Input subtitles file",
                            widget="FileChooser")
    main_group.add_argument(
        "-o",
        "--srtout",
        help="Output subtitles file (default=${srtin}.synced.srt).",
        widget="FileSaver",
    )
    advanced_group = parser.add_argument_group("Advanced")

    # TODO: these are shared between gui and cli; don't duplicate this code
    advanced_group.add_argument(
        "--merge-with-reference",
        "--merge",
        action="store_true",
        help="Merge reference subtitles with synced output subtitles.",
    )
    advanced_group.add_argument(
        "--make-test-case",
        "--create-test-case",
        action="store_true",
        help="If specified, create a test archive a few KiB in size "
        "to send to the developer as a debugging aid.",
    )
    advanced_group.add_argument(
        "--reference-stream",
        "--refstream",
        "--reference-track",
        "--reftrack",
        default=None,
        help="Which stream/track in the video file to use as reference, "
        "formatted according to ffmpeg conventions. For example, s:0 "
        "uses the first subtitle track; a:3 would use the fourth audio track.",
    )
    return parser
def proj_shp_file():
    '''
    将输入的带有空间坐标系的文件转换到另外一个空间坐标系下


    Parameters:
    ------------------
    in_shp_path: str
        输入的带有空间坐标系的文件(原始空间坐标系由输入文件中获取)
    out_shp_path: str
        输出路径
    out_epsg: int
        目标空间坐标系的epsg标记


    '''
    parser = GooeyParser(description='将带有空间坐标系的文件(shp)投影到任意其它坐标系')
    group = parser.add_argument_group('必须参数',gooey_options={'show_border': False})
    group.add_argument('in_shp_path', help='输入的带有空间坐标系的文件', widget='FileChooser')
    group.add_argument('out_shp_path', help='输出路径', widget='DirChooser')
    group.add_argument('out_epsg', help='目标空间坐标系的epsg标记')
    args = parser.parse_args()
    # print(args.out_epsg)



    # begin_tick = time.time()

    tmp = gpd.GeoDataFrame.from_file(args.in_shp_path)
    # print(tmp.crs)
    tmp_proj = tmp.to_crs({'init': 'epsg:4326'})
    tmp_proj.to_file(args.out_shp_path, encoding='utf-8')
示例#15
0
def create_arg_parser():
    arg_parser = GooeyParser()
    group = arg_parser.add_argument_group('Input/Output',
                                          gooey_options={'columns': 1})
    group.add_argument(
        dest='divisions_file',
        widget='FileChooser',
        help=
        ('The CSV with division information; see the Division Columns tab for details.'
         ))
    group.add_argument(
        dest='professors_file',
        widget='FileChooser',
        help=
        'The CSV with professor information; see Professor Columns tab for details.',
    )
    group.add_argument(
        dest='students_file',
        widget='FileChooser',
        help=
        'The CSV with student information; see the Student Columns tab for details.'
    )
    group.add_argument(
        dest='output_dir',
        default='~/Desktop/',
        widget='DirChooser',
        help='The folder to put the output.csv.',
    )
    return arg_parser
示例#16
0
def main():
    parser = GooeyParser()
    g = parser.add_argument_group('Параметры', 'Задайте Параметры Поиска')
    g.add_argument('dict',
                   help='выберите словарь',
                   widget='Dropdown',
                   choices=list(os.listdir('dicts')))

    g.add_argument('regex', help='введите маску')

    g.add_argument('number', help='введите кол-во слов')

    args = parser.parse_args()
    tree = ET.parse(f'dicts/{args.dict}/dict.xdxf')
    root = tree.getroot()

    count = 0
    n = int(args.number)
    with open('WORDS.txt', 'w', encoding='UTF-8') as fout:
        for article in root.iterfind('ar'):
            for key in article.iterfind('k'):
                if re.search(args.regex, key.text):
                    print(
                        key.text.strip(), file=fout, flush=True
                    )  # очищение буфера, для немедленного сохранения в файл
                    print("progress: {}/{}".format(count + 1, n))
                    sleep(0.001)
                    count += 1
                    if count >= n:
                        break
            if count >= n:
                break
示例#17
0
def param_parser():
    parser = GooeyParser(description="Add attributes to a Tile Layout")
    parser.add_argument("inputfile",
                        metavar="Input Tilelayout File",
                        widget="FileChooser",
                        help="Select Tilelayout json file")
    parser.add_argument("output_dir",
                        metavar="Output Directory",
                        widget="DirChooser",
                        help="Output directory",
                        default="")
    attr_group = parser.add_argument_group("Attribute",
                                           gooey_options={
                                               'show_border': True,
                                               'columns': 3
                                           })
    attr_group.add_argument("attrname",
                            metavar="Attribute Name",
                            help="Attribute Name\n\n")
    attr_group.add_argument(
        "attrval",
        metavar="Attribute Value",
        help=
        "if Naming convention for files used, \nreplace x,y with %X% and %Y%.\nex: dem_%X%m_%Y%m.asc"
    )
    attr_group.add_argument(
        "--division",
        metavar="Shorten X, Y",
        help=
        "Reduce the X and Y values to the nearest 100,1000. \nleave blank for None\n",
        type=int)

    args = parser.parse_args()
    return args
示例#18
0
def parse_args():
    parser = GooeyParser(
        description=
        'Format redcap export for ADM import\n(Assumes REDCap form is in order of actual CBCL questionnaire)'
    )

    required_group = parser.add_argument_group('Required Arguments',
                                               gooey_options={'columns': 1})
    required_group.add_argument('--export_file',
                                required=True,
                                widget='FileChooser',
                                help='Demographics + CBCL export from REDCap')
    required_group.add_argument('--data_dict',
                                required=True,
                                widget='FileChooser',
                                help='REDCap data dictionary export for CBCL')
    required_group.add_argument('--output_folder',
                                required=True,
                                widget='DirChooser',
                                help='Folder to store output CBC files')
    required_group.add_argument(
        '--age_var',
        required=True,
        help=
        'REDCap variable containing subject age (i.e. childs_age, age_decimal)'
    )
    return parser
示例#19
0
def ArgParse(defaults):
    """
    Asks user for all variables integrated into a GUI.
    """
    # Asks user for all variables
    # Graphical user interface

    parser = GooeyParser()

    # Analysis
    exp_group = parser.add_argument_group('Setup')
    exp_group.add_argument("xname",
                           metavar='Experiment name',
                           type=str,
                           default=defaults['xname'])
    exp_group.add_argument("outdir",
                           metavar='Output directory',
                           type=str,
                           widget="DirChooser")
    exp_group.add_argument('rawdata',
                           metavar='Raw data file',
                           type=str,
                           widget='FileChooser',
                           help='.csv exported from the RT-PCR Software')
    exp_group.add_argument('layout',
                           metavar='Assignment sheet',
                           type=str,
                           widget='FileChooser',
                           help='.xlsx file with sample and assay names')

    args = parser.parse_args(sys.argv[1:])
    return args
示例#20
0
def main():
    parser = GooeyParser(description="Extracting frames from a movie using FFMPEG")
    ffmpeg = parser.add_argument_group('Frame Extraction Util')
    ffmpeg.add_argument('-i',
                        metavar='Input Movie',
                        help='The movie for which you want to extract frames',
                        required=True,  # Look at me!
                        widget='FileChooser')
    ffmpeg.add_argument('output',
                        metavar='Output Image',
                        help='Where to save the extracted frame',
                        widget='FileSaver',
                        )
    ffmpeg.add_argument('-ss',
                        metavar='Timestamp',
                        required=True,  # Look at me!
                        help='Timestamp of snapshot (in seconds)',
                        gooey_options={
                            'validator': {
                                'test': 'user_input.isdigit()',
                                'message': 'Please enter a number'
                            }
                        })
    ffmpeg.add_argument('-frames:v',
                        metavar='Timestamp',
                        default=1,
                        required=True,  # Look at me!
                        gooey_options={
                            'visible': False,
                        })

    parser.parse_args()
    print('Done.')
def main():
    parser = GooeyParser(description="raw2aif converter")

    group = parser.add_argument_group()
    group.add_argument('filename', widget='FileChooser')
    
    group.add_argument('material_id')

    input_type = group.add_mutually_exclusive_group(required=True, 
        gooey_options={
            'initial_selection': 0,
            'title': "filetype"
        })
    input_type.add_argument('-quantachrome', metavar='Quantachrome (.txt)', action="store_true")
    input_type.add_argument('-belsorp-max', metavar='BELSORP-max (.dat)', action="store_true")
    input_type.add_argument('-belsorp-csv', metavar='BEL-csv (.csv)', action="store_true")
    input_type.add_argument('-belsorp-csv-JIS', metavar='BEL-csv JIS encoding (.csv)', action="store_true")
    input_type.add_argument('-micromeritics', metavar='Micromeritics (.xls)', action="store_true")

    args = parser.parse_args()

    filetype = None

    if args.quantachrome:
        filetype = "quantachrome"
    elif args.belsorp_max:
        filetype = "BELSORP-max"
    elif args.belsorp_csv:
        filetype = "BEL-csv"
    elif args.belsorp_csv_JIS:
        filetype = "BEL-csv_JIS"
    elif args.micromeritics:
        filetype = "micromeritics"

    convert(args.filename, args.material_id, filetype)
示例#22
0
def get_parser() -> GooeyParser:
    parser = GooeyParser(description='Creates bookmarks for PDFs')
    parser.add_argument('-i',
                        '--input',
                        metavar='Input path',
                        help='Path for the input file',
                        required=True,
                        widget='FileChooser')
    parser.add_argument('-o',
                        '--output',
                        metavar='Save path',
                        widget='FileSaver',
                        help='Path for the output file')
    parser.add_argument('-b',
                        '--bookmark',
                        metavar='Bookmarks path',
                        help='Path for the bookmark list',
                        required=True,
                        widget='FileChooser')
    option_group = parser.add_argument_group('Options')
    option_group.add_argument(
        '--skip',
        metavar='Skip pages',
        help='How many pages should be skipped until page #s start?',
        type=int,
        default=0,
        gooey_options={'columns': 2})
    option_group.add_argument('--separator',
                              metavar='Separator',
                              help='Separator between titles and page #s',
                              type=str,
                              default='\t',
                              gooey_options={'columns': 2})
    return parser
示例#23
0
def main():
    parser = GooeyParser(
        description='An example of polling for updates at runtime')
    g = parser.add_argument_group()
    stuff = g.add_mutually_exclusive_group(
        required=True, gooey_options={'initial_selection': 0})
    stuff.add_argument('--save',
                       metavar='Save Progress',
                       action='store_true',
                       help='Take a snap shot of your current progress!')
    stuff.add_argument('--load',
                       metavar='Load Previous Save',
                       help='Load a Previous save file',
                       dest='filename',
                       widget='Listbox',
                       nargs='+',
                       choices=list_savefiles(),
                       gooey_options={
                           'validator': {
                               'test': 'user_input != "Select Option"',
                               'message': 'Choose a save file from the list'
                           }
                       })

    args = parser.parse_args()

    if args.save:
        save_file()
    else:
        for f in args.filename:
            read_file(os.path.join('saves', f))
            print('Finished reading file %s!' % f)
示例#24
0
def main():
    parser = GooeyParser(description='Getting Over it without the "Hurt"')
    g = parser.add_argument_group()
    stuff = g.add_mutually_exclusive_group(
        required=True, gooey_options={'initial_selection': 0})
    stuff.add_argument('--save',
                       metavar='Save Progress',
                       action='store_true',
                       help='Take a snap shot of your current progress!')
    stuff.add_argument('--load',
                       metavar='Load Previous Save',
                       help='Load a Previous save file',
                       dest='filename',
                       widget='Dropdown',
                       choices=list_savefiles(),
                       gooey_options={
                           'validator': {
                               'test': 'user_input != "Select Option"',
                               'message': 'Choose a save file from the list'
                           }
                       })

    args = parser.parse_args()

    if args.save:
        save_registry(collect_regvals(load_regkey()))
    else:
        replace_reg_values(load_regkey(),
                           load_registry(os.path.join('saves', args.filename)))
        print('Successfully Loaded snapshot!')
        print('Make sure to fix your mouse sensitivity! ^_^\n')
示例#25
0
def main():
    desc = "Example application for launching closed-loop experiment!"

    file_help_msg = "Name of the file you want to process"

    parser = GooeyParser(description=desc)

    # add argument elements that get added to the gui
    acq_group = parser.add_argument_group(
       "Acquisition", 
        "Settings for experimental acquisition."
    )
    acq_group.add_argument("DirectoryChooser", help=file_help_msg, widget="DirChooser")
    acq_group.add_argument("directory", help="Directory to store output")
    acq_group.add_argument('-d', '--duration', default=2,type=int, help='Duration (in seconds) of the program output')
    acq_group.add_argument('-s', '--cron-schedule', type=int, help='datetime when the cron should begin', widget='DateChooser')
    acq_group.add_argument("-c", "--showtime", action="store_true", help="display the countdown timer")
    acq_group.add_argument("-p", "--pause", action="store_true", help="Pause execution")
    acq_group.add_argument('-v', '--verbose', action='count')
    acq_group.add_argument("-o", "--overwrite", action="store_true", help="Overwrite output file (if present)")
    acq_group.add_argument('-r', '--recursive', choices=['yes', 'no'], help='Recurse into subfolders')
    acq_group.add_argument("-w", "--writelog", default="writelogs", help="Dump output to local file")

    search_group = parser.add_argument_group(
    "Search Options", 
    "Customize the search options"
    )
    search_group.add_argument("-e", "--error", action="store_true", help="Stop process on error (default: No)")


    # example of mutually exclusive arguments
    closed_loop_group = parser.add_argument_group(
       "Acquisition", 
        "Settings for experimental acquisition."
    )
    verbosity = closed_loop_group.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")

    # get "command line" arguments from GUI
    args = parser.parse_args()

    # display all arguments
    ops = vars(args)
    print('Incoming arguments: {}'.format(ops))
    time.sleep(2)
    print('Exiting...')
示例#26
0
def interview_arguments():
    parser = GooeyParser(
        description=
        "Replace all keys from translation file find in given json-path.")

    pg = parser.add_argument_group()
    add_arguments(pg)
    return parser.parse_args()
示例#27
0
def main():
    options = GooeyParser()

    options.add_argument("source_dir", help="Path to the directory containing your book's source text.", widget="DirChooser")
    options.add_argument("code_dir", help="Path to the git repo containing source code.", widget="DirChooser")

    
    options.add_argument("-l", "--lang", dest="language", help="Indicate that the source code is in this language when syntax highlighting", default="swift")
    options.add_argument("-n", "--dry-run", action="store_true", help="Don't actually modify any files")
    options.add_argument("--clean", action="store_true", help="Remove snippets from files, instead of adding their contents to files")
    options.add_argument("--length", default=75, help="The maximum length permitted for snippet lines. Lines longer than this will be warned about.")

    advanced_options = options.add_argument_group("Advanced Options")

    
    advanced_options.add_argument("--suffix", default="", help="Append this to the file name of written files (default=none)")
    advanced_options.add_argument("-x", "--extract-snippets", dest="extract_dir", default=None, help="Render each snippet to a file, and store it in this directory.", widget="DirChooser")
    advanced_options.add_argument("-v", "--verbose", action="store_true", help="Verbose logging.")
    advanced_options.add_argument("-q", "--show_query", action="store_true", help="Include the query in rendered snippets.")
    advanced_options.add_argument("--as_inline_list_items", action="store_true", help="Add a + after the snippet tag, to make the snippets format properly when being used as inline blocks in list items")
    #options.add_argument("-i", "--expand-images", action="store_true", help="Expand img: shortcuts (CURRENTLY BROKEN!)")

    
    
    opts = options.parse_args()
    
    logging.getLogger().setLevel(logging.INFO)

    if opts.verbose:
        logging.getLogger().setLevel(logging.DEBUG)

    processor = Processor(
        opts.source_dir, 
        opts.code_dir,
        source_extensions=["txt","asciidoc"],
        tagged_extensions=SOURCE_FILE_EXTENSIONS, 
        language=opts.language, 
        clean=opts.clean, 
        show_query=opts.show_query,
        as_inline_list_items=opts.as_inline_list_items)

    logging.debug("Found %i source files:", len(processor.source_documents))
    for doc in processor.source_documents:
        logging.debug(" - %s", doc.path)
    
    logging.debug("Found %i code files:", len(processor.tagged_documents))
    for doc in processor.tagged_documents:
        logging.debug(" - %s", doc.path)

    processor.find_multiply_defined_tags()

    processor.find_overlong_lines(opts.length)
    
    processor.process(dry_run=opts.dry_run, suffix=opts.suffix)

    if opts.extract_dir:
        processor.extract_snippets(opts.extract_dir)
示例#28
0
def add_args_calib_cam(parser: GooeyParser = GooeyParser()):
    cam_parser = parser.add_argument_group("Camera option",
                                           gooey_options={
                                               'show_border': True,
                                               'columns': 2
                                           })
    cam_option(cam_parser)

    cap_parser = parser.add_argument_group("Capture option",
                                           gooey_options={
                                               'show_border': True,
                                               'columns': 1
                                           })
    cap_parser.add_argument("n_cap",
                            type=int,
                            metavar='Number of capture image',
                            default=10,
                            gooey_options={
                                'validator': {
                                    'test': 'int(user_input) > 0',
                                    'message': 'Must be positive integer.'
                                }
                            })
    cap_parser.add_argument(
        '--capture_img_path',
        metavar='Path to save "capture image" (Optional)',
        help="If you want to save 'captured images', set save directory.",
        widget='DirChooser',
        type=str)

    chess_parser = parser.add_argument_group("Chessboard option",
                                             gooey_options={
                                                 'show_border': True,
                                                 'columns': 2
                                             })
    chess_option(chess_parser)

    result_parser = parser.add_argument_group("Result option",
                                              gooey_options={
                                                  'show_border': True,
                                                  'columns': 1
                                              })
    result_path_option(result_parser)
def parse_args():
    parser = GooeyParser(
        description='Format NIH toolbox cognitive data for redcap import')
    required_group = parser.add_argument_group('Required Arguments',
                                               gooey_options={'columns': 1})
    required_group.add_argument(
        '--exports_folder',
        widget='DirChooser',
        required=True,
        help='Folder containing export files to be processed')
    optional_group = parser.add_argument_group('Optional Arguments',
                                               gooey_options={'columns': 1})
    optional_group.add_argument(
        '-s',
        '--subjects',
        nargs='+',
        help=
        'Space separated list of subject ids to run for (if blank, runs all in folder)'
    )
    return parser.parse_args()
示例#30
0
def main():
    parser = GooeyParser(description="""Хотите ли вы купить хотдог?""")
    sg = parser.add_argument_group("", gooey_options={'columns': 1})
    sg.add_argument('--Checkbox',
                    action='store_true',
                    widget="CheckBox",
                    help="Очень важный параметр")

    args = parser.parse_args()

    print("Русский текст, который не кодируется")
示例#31
0
def main():
    mk_savedir()  # Make directory to store user's save files

    parser = GooeyParser(
        description='An example of polling for updates at runtime')
    g = parser.add_argument_group()
    stuff = g.add_mutually_exclusive_group(
        required=True,
        gooey_options={
            'initial_selection': 0
        }
    )
    stuff.add_argument(
        '--save',
        metavar='Save Progress',
        action='store_true',
        help='Take a snap shot of your current progress!'
    )
    stuff.add_argument(
        '--load',
        metavar='Load Previous Save',
        help='Load a Previous save file',
        dest='filename',
        widget='Dropdown',
        choices=list_savefiles(),
        gooey_options={
            'validator': {
                'test': 'user_input != "Select Option"',
                'message': 'Choose a save file from the list'
            }
        }
    )

    args = parser.parse_args()

    if args.save:
        save_file()
    else:
        read_file(os.path.join('saves', args.filename))
        print('Finished reading file!')