Skip to content

Commit

Permalink
Add --reset-config arg
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Nov 1, 2018
1 parent cf227b0 commit ece7120
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions labelme/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@

def main():
parser = argparse.ArgumentParser()
parser.add_argument('--version', '-V', action='store_true',
help='show version')
parser.add_argument(
'--version', '-V', action='store_true', help='show version'
)
parser.add_argument(
'--reset-config', action='store_true', help='reset qt config'
)
parser.add_argument('filename', nargs='?', help='image or label filename')
parser.add_argument('--output', '-O', '-o', help='output label name')
default_config_file = os.path.join(os.path.expanduser('~'), '.labelmerc')
Expand Down Expand Up @@ -99,6 +103,7 @@ def main():

config_from_args = args.__dict__
config_from_args.pop('version')
reset_config = config_from_args.pop('reset_config')
filename = config_from_args.pop('filename')
output = config_from_args.pop('output')
config_file = config_from_args.pop('config_file')
Expand All @@ -114,6 +119,12 @@ def main():
app.setApplicationName(__appname__)
app.setWindowIcon(newIcon('icon'))
win = MainWindow(config=config, filename=filename, output=output)

if reset_config:
print('Resetting Qt config: %s' % win.settings.fileName())
win.settings.clear()
sys.exit(0)

win.show()
win.raise_()
sys.exit(app.exec_())
Expand Down

0 comments on commit ece7120

Please sign in to comment.