本文整理汇总了Python中gooey.GooeyParser.parse_args方法的典型用法代码示例。如果您正苦于以下问题:Python GooeyParser.parse_args方法的具体用法?Python GooeyParser.parse_args怎么用?Python GooeyParser.parse_args使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gooey.GooeyParser
的用法示例。
在下文中一共展示了GooeyParser.parse_args方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def main():
# get some settings from setting file
settings = SettingFileReader()
defaultOutput = settings.getSetting("defaultSettings", "output")
defaultWidth = settings.getSetting("defaultSettings", "width")
defaultFramerate = settings.getSetting("defaultSettings", "framerate")
defaultBitrateKb = settings.getSetting("defaultSettings", "bitratekb")
description = "Compose a timelapse movie from a sequence of jpg images"
#parser = argparse.ArgumentParser(description=description)
parser = GooeyParser(description=description)
parser.add_argument('-input', required=True, type=argparse.FileType('r'), help='A jpeg file from the sequence' , widget="FileChooser")
parser.add_argument('-output', required=False, default=defaultOutput, help='Output sequence file name (default : ' + defaultOutput + ')' )
parser.add_argument('-width', required=False, default=defaultWidth, type=int, help='With of the output sequence (default : ' + str(defaultWidth) + ')' )
parser.add_argument('-height', required=False, type=int, help='height of the output sequence (default : keeps proportion to width)' )
parser.add_argument('-framerate', required=False, default=defaultFramerate, type=int, help='Framerate of the output sequence (default : ' + str(defaultFramerate) + ')' )
parser.add_argument('-bitrate', required=False, default=1920, type=int, help='Bitrate of the output sequence in kb/s (default : ' + str(defaultBitrateKb) + 'kb/s)' )
args = parser.parse_args()
print args.input.name
print args.output
print args.width
print args.height
print args.framerate
print args.bitrate
示例2: parse_args_gooey
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def parse_args_gooey():
'''parse command line arguments'''
parser = GooeyParser(description='Search images for Joe')
parser.add_argument("directory", default=None, help="directory containing image files", widget='DirChooser')
parser.add_argument("--mission", default=None, type=file, help="mission file to display", widget='FileChooser')
parser.add_argument("--mavlog", default=None, type=file, help="MAVLink telemetry log file", widget='FileChooser')
parser.add_argument("--kmzlog", default=None, type=file, help="kmz file for image positions", widget='FileChooser')
parser.add_argument("--triggerlog", default=None, type=file, help="robota trigger file for image positions", widget='FileChooser')
parser.add_argument("--time-offset", type=float, default=0, help="offset between camera and mavlink log times (seconds)")
parser.add_argument("--view", action='store_true', default=False, help="show images")
parser.add_argument("--saveview", action='store_true', default=False, help="save image view")
parser.add_argument("--lens", default=28.0, type=float, help="lens focal length")
parser.add_argument("--sensorwidth", default=35.0, type=float, help="sensor width")
parser.add_argument("--service", default='MicrosoftSat',
choices=['GoogleSat', 'MicrosoftSat', 'OviSat', 'OpenStreetMap', 'MicrosoftHyb', 'OviHybrid', 'GoogleMap'], help="map service")
parser.add_argument("--camera-params", default=None, type=file, help="camera calibration json file from OpenCV", widget='FileChooser')
parser.add_argument("--debug", default=False, action='store_true', help="enable debug info")
parser.add_argument("--roll-stabilised", default=False, action='store_true', help="assume roll stabilised camera")
parser.add_argument("--rotate-180", default=False, action='store_true', help="rotate images 180 degrees")
parser.add_argument("--altitude", default=0, type=float, help="altitude (0 for auto)")
parser.add_argument("--thumbsize", default=60, type=int, help="thumbnail size")
parser.add_argument("--mosaic-thumbsize", default=35, type=int, help="mosaic thumbnail size")
parser.add_argument("--minscore", default=100, type=int, help="minimum score")
parser.add_argument("--gammalog", default=None, type=str, help="gamma.log from flight", widget='FileChooser')
parser.add_argument("--target", default=None, type=str, help="lat,lon,radius target")
parser.add_argument("--categories", default=None, type=str, help="xml file containing categories for classification", widget='FileChooser')
if 1 != len(sys.argv):
parser.add_argument("--flag", default=[], type=str, action='append', help="flag positions"),
parser.add_argument("--blue-emphasis", default=False, action='store_true', help="enable blue emphasis in scanner")
return parser.parse_args()
示例3: arbitrary_function
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def arbitrary_function():
desc = u"\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u002c \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c "
file_help_msg = u"\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430\u002c \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c"
my_cool_parser = GooeyParser(description=desc)
my_cool_parser.add_argument(
'foo',
metavar=u"\u0432\u044b\u0431\u043e\u0440\u0430\u0444\u0430\u0439\u043b\u043e\u0432",
help=file_help_msg,
widget="FileChooser")
my_cool_parser.add_argument(
'bar',
metavar=u"\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",
help=file_help_msg,
widget="MultiFileChooser")
my_cool_parser.add_argument(
'-d',
metavar=u'--\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c',
default=2,
type=int,
help=u'\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0028 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0029 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b')
my_cool_parser.add_argument(
'-s',
metavar=u'--\u043a\u0440\u043e\u043d \u002d \u0433\u0440\u0430\u0444\u0438\u043a',
help=u'\u0414\u0430\u0442\u0430',
widget='DateChooser')
args = my_cool_parser.parse_args()
main(args)
示例4: main
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
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") # positional
my_cool_parser.add_argument("DirectoryChooser", help=file_help_msg, widget="DirChooser") # positional
my_cool_parser.add_argument("FileSaver", help=file_help_msg, widget="FileSaver") # positional
my_cool_parser.add_argument("MultiFileSaver", help=file_help_msg, widget="MultiFileChooser") # positional
my_cool_parser.add_argument("MultiDirChooser", help=file_help_msg, widget="MultiDirChooser") # positional
my_cool_parser.add_argument("directory", help="Directory to store output") # positional
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()
示例5: _parser
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def _parser():
parser = GooeyParser(description='Filter the linelist by a'
' column and an upper limit')
parser.add_argument('input', help='Input linelist', widget='FileChooser')
parser.add_argument('col',
help='Column to be sorted (starting at 0)',
type=int)
parser.add_argument('limit',
help='The upper limit on the column',
type=float)
parser.add_argument('-o', '--output',
help='The output linelist',
default=None)
parser.add_argument('-s', '--sign',
help='Include values above',
default=False,
action='store_true'
)
parser.add_argument('-e', '--element',
help='If value is 26.1 then FeII lines will'
' not be removed.',
default=26.1,
type=float)
args = parser.parse_args()
return args
示例6: arbitrary_function
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def arbitrary_function():
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") # positional
# my_cool_parser.add_argument("DirectoryChooser", help=file_help_msg, widget="DirChooser") # positional
# my_cool_parser.add_argument("FileSaver", help=file_help_msg, widget="FileSaver") # positional
# my_cool_parser.add_argument("MultiFileSaver", help=file_help_msg, widget="MultiFileChooser") # positional
# my_cool_parser.add_argument("directory", help="Directory to store output") # positional
my_cool_parser.add_argument('-c', '--countdown', default=2, type=int, help='sets the time to count down from you see its quite simple!')
my_cool_parser.add_argument('-j', '--cron-schedule', type=int, help='Set the datetime when the cron should begin', widget='DateChooser')
my_cool_parser.add_argument("-s", "--showtime", action="store_true", help="display the countdown timer")
my_cool_parser.add_argument("-d", "--delay", action="store_true", help="Delay execution for a bit")
my_cool_parser.add_argument('-v', '--verbose', action='count')
my_cool_parser.add_argument("-o", "--obfuscate", action="store_true", help="obfuscate the countdown timer!")
my_cool_parser.add_argument('-r', '--recursive', choices=['yes', 'no'], help='Recurse into subfolders')
my_cool_parser.add_argument("-w", "--writelog", default="No, NOT whatevs", help="write log to some file or something")
my_cool_parser.add_argument("-e", "--expandAll", action="store_true", help="expand all processes")
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")
print my_cool_parser._actions
print 'inside of main(), my_cool_parser =', my_cool_parser
args = my_cool_parser.parse_args()
main(args)
示例7: main
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def main():
desc = "Example application to show Gooey's various widgets"
parser = GooeyParser(prog="example_progress_bar_1")
_ = parser.parse_args(sys.argv[1:])
import time
time.sleep(1)
print('Success')
示例8: main
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def main():
parser = GooeyParser(prog="example_progress_bar_1")
_ = parser.parse_args(sys.argv[1:])
for i in range(100):
print("progress: {}%".format(i + 1))
sys.stdout.flush()
sleep(0.1)
示例9: initOptParser
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def initOptParser():
parser = GooeyParser(description="Copy files to specified location")
# Option for the path of files to move (can be a full directory).
parser.add_argument('--files', metavar='file', nargs='*',
help='file(s) you wish to copy', widget="MultiFileChooser")
parser.add_argument('--directories', metavar='dir', nargs='*', help="The directorie(s) you wish to copy.", widget="MultiDirChooser")
# Option to specify which project said files go to.
parser.add_argument('-p', '--path', metavar='path',dest='path', type=str,
help='Path which will be considered as root of all projects. Default is currently : ' + utils.defaultFolderPath,
default=utils.defaultFolderPath, widget="DirChooser")
parser.add_argument('projectName', metavar='projectName', type=str,
help='The project you wish to retrieve/add files to/from.')
# Option to specify the version name of the commit.
parser.add_argument('-v', '--version', metavar='versionName', type=str,
help='The name of the directory which will be created during an update. By default, this will be : VERSION_X.')
# Option allowing overwrite of current version.
parser.add_argument('-m', '--message', metavar='logMessage', type=str, help='Use to specify a log message which will be put in a versFile at the root of the project directory.')
# Specify --get to retrieve files instead of commiting them.
parser.add_argument('-g', '--get', dest='method', action='store_const', help='Retrieve files from project (last version by default)', const=get.get, default=push.push)
# Allows 'locking'. Not really a lock. Basically a warning message to all users who try to check out if a user checked out without commiting his files.
parser.add_argument('-l', '--lock', action="store_true",
help='Locks the current project. '+
'Unlocked when next push from the locking user is made')
# User name. Just to allow 'locking'/'unlocking'
parser.add_argument('user', metavar='userName', type=str, help='Specify your name.')
parser.add_argument('-a', '--archive', metavar='archivePath', type=str, help='Use to specify a directory which will be used as an archive. Current default is : ' + utils.archivePath, widget="DirChooser")
# Will pop up a windows fileselector to choose which files will be copied.
parser.add_argument('-s', '--store', metavar="destPath", help='Use to specify where you want the files retrieved from the project to be copied.', widget="DirChooser")
# Function to call to get all arguments.
args = parser.parse_args()
#print(args.files)
#print(args.directories)
if (args.files == None and args.directories == None):
return (None)
if (args.files and args.directories):
args.files = args.files + args.directories#args.files[0].split(";") + args.directories[0].split(";")
elif (args.directories):
args.files = args.directories
print("The following files/directories will be copied (along with all sub-directories) :")
for myFile in args.files:
print("- [" + myFile + "]")
return (args)
示例10: main
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def main():
parser = GooeyParser(description='Zelda clean this mess\nReorganize date/pod -> pod/date')
parser.add_argument('pattern', nargs='?', default=r"""(.*)_(.*)_(.*)_(.*)_(.*)_(.*)-(.{8})-(.*).datx_(.*)""",
help="pattern which allow to get groups\nmoteur = mo.group(1)\nuseless = mo.group(2)\nbanc = mo.group(3)\npod = mo.group(4)\nuseless = mo.group(5)\nrun = mo.group(6)\ndate = mo.group(7)\nheure = mo.group(8)")
parser.add_argument('srcDir', nargs='?', default=os.getcwd(), widget='FileChooser',
help='Engine directory : root/???/*.*')
args = parser.parse_args()
Zelda.trier(args.srcDir, args.pattern)
示例11: generate_trials_gui
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def generate_trials_gui():
# General information
parser = GooeyParser(description='Create_general_experiment')
parser.add_argument('Number_of_blocks', default=1, action='store', type=int, help='Number')
parser.add_argument('Number_of_training_trials', default=4, action='store', type=int, help='Number')
parser.add_argument('Number_of_experiment_trials', default=4, action='store', type=int, help='Number')
parser.add_argument('File_name', default='experiment', type=str, help='Name of file with not personalized data')
parser.add_argument('--Instruction', widget='FileChooser', help='Choose instruction file')
parser.add_argument('--Instruction_show_time', default=5, action='store', type=int, help='Number')
# Information about training
parser.add_argument('--Training_task', default='letters',
choices=['letters', 'figures', 'symbols', 'numbers', 'greek_letters'],
help='Choose trial type')
parser.add_argument('--Training_number', default=1, action='store', type=int, help='Number of relations')
parser.add_argument('--Training_stim_time', default=1, action='store', type=int, help='Number')
parser.add_argument('--Training_resp_time', default=1, action='store', type=int, help='Number')
parser.add_argument('--Training_feedback', default=1, action='store', type=int, help='Number')
parser.add_argument('--Training_feedback_time', default=1, action='store', type=int, help='Number')
parser.add_argument('--Training_wait', default=1, action='store', type=int, help='Number')
parser.add_argument('--Training_bin', default='1', choices=['1', '0'], help='Choose view type')
parser.add_argument('--Training_trial_type', default='1', choices=['1', '2', '3', '4'], help='Choose view type')
# Information about experiment
parser.add_argument('--Experiment_task', default='letters',
choices=['letters', 'figures', 'symbols', 'numbers', 'greek_letters'],
help='Choose trial type')
parser.add_argument('--Experiment_number', default=1, action='store', type=int, help='Number of relations')
parser.add_argument('--Experiment_stim_time', default=1, action='store', type=int, help='Number')
parser.add_argument('--Experiment_resp_time', default=1, action='store', type=int, help='Number')
parser.add_argument('--Experiment_feedback', default=1, action='store', type=int, help='Number')
parser.add_argument('--Experiment_feedback_time', default=1, action='store', type=int, help='Number')
parser.add_argument('--Experiment_wait', default=1, action='store', type=int, help='Number')
parser.add_argument('--Experiment_bin', default='1', choices=['1', '0'], help='Choose view type')
parser.add_argument('--Experiment_trial_type', default='1', choices=['1', '2', '3', '4'], help='Choose view type')
args = parser.parse_args()
experiment = []
name = args.Instruction.split('/')[-1]
for block in range(args.Number_of_blocks):
instruction = [block + 1, 'instruction', args.Instruction_show_time, name]
experiment.append(instruction)
for idx in range(0, args.Number_of_training_trials):
trial = [block + 1, args.Training_task, args.Training_number, idx + 1, args.Training_stim_time,
args.Training_resp_time, args.Training_feedback, args.Training_feedback_time,
args.Training_wait, 0, int(args.Training_bin), int(args.Training_trial_type)]
experiment.append(trial)
for idx in range(0, args.Number_of_experiment_trials):
trial = [block + 1, args.Experiment_task, args.Experiment_number, idx + 1, args.Experiment_stim_time,
args.Experiment_resp_time, args.Experiment_feedback, args.Experiment_feedback_time,
args.Experiment_wait, 1, int(args.Experiment_bin), int(args.Experiment_trial_type)]
experiment.append(trial)
save_to_xlsx(experiment, args.File_name)
示例12: _parser
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def _parser():
"""Take care of all the CLI/GUI stuff.
"""
parser = GooeyParser(description='Plot FITS spectra effortless')
parser.add_argument('fname',
action='store',
widget='FileChooser',
help='Input fits file', metavar='Fits file')
parser.add_argument('-m', '--model',
default=False,
widget='FileChooser',
help='If not the Sun shoul be used as a model, put'
' the model here (only support BT-Settl for the'
' moment)', metavar='Model atmosphere')
path_lines = os.path.join(os.path.expanduser('~/.plotfits/'), 'linelist.moog')
parser.add_argument('--linelist',
# default=False,
default=path_lines,
widget='FileChooser',
help='Linelist with 1 line header and wavelength in 1st col', metavar='Line list')
parser.add_argument('-s', '--sun',
help='Over plot solar spectrum',
action='store_true')
parser.add_argument('-t', '--telluric',
help='Over plot telluric spectrum',
action='store_true')
parser.add_argument('-r', '--rv',
help='RV shift to observed spectra in km/s',
default=False,
type=float)
parser.add_argument('-r1', '--rv1',
help='RV shift to model/solar spectrum in km/s',
default=False,
type=float)
parser.add_argument('-r2', '--rv2',
help='RV shift to telluric spectra in km/s',
default=False,
type=float)
parser.add_argument('-l', '--lines',
help='Lines to plot on top (multiple lines is an'
' option). If multiple lines needs to be plotted, then'
' separate with a space',
default=False, type=float, nargs='+', metavar='Atomic lines')
parser.add_argument('-c', '--ccf',
default='none',
choices=['none', 'sun', 'model', 'telluric', 'both'],
help='Calculate the CCF for Sun/model or tellurics or both.')
parser.add_argument('--ftype', help='Select which type the fits file is',
choices=['1D', 'CRIRES', 'GIANO', 'UVES'], default='1D',
metavar='Instrument')
parser.add_argument('--fitsext', help='Select fits extention for CRIRES',
choices=map(str, range(1, 5)), default='1', metavar='FITS extention')
parser.add_argument('--order', help='Select which GIANO order to be investigated',
choices=map(str, range(32, 81)), default='77', metavar='GIANO order')
return parser.parse_args()
示例13: parse_args_gooey
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def parse_args_gooey():
'''parse command line arguments'''
parser = GooeyParser(description="Convert pgm image to png or jpg")
parser.add_argument("directory", default=None,
help="directory containing PGM image files", widget='DirChooser')
parser.add_argument("--output-directory", default=None,
help="directory to use for converted files", widget='DirChooser')
parser.add_argument("--format", default='png', choices=['png', 'jpg'], help="type of file to convert to (png or jpg)")
return parser.parse_args()
示例14: get_params
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def get_params():
parser = GooeyParser()
parser.add_argument('search_term', help="The search term")
parser.add_argument(
dest='mode',
widget='Dropdown',
choices=['Director', 'IMDB Code', 'Keyword']
)
args = parser.parse_args()
return args.mode, args.search_term
示例15: main
# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import parse_args [as 别名]
def main():
parser = GooeyParser(prog="example_progress_bar_2")
parser.add_argument("steps", type=int, default=15)
parser.add_argument("delay", type=int, default=1)
args = parser.parse_args(sys.argv[1:])
for i in range(args.steps):
print("progress: {}/{}".format(i+1, args.steps))
sys.stdout.flush()
sleep(args.delay)