{"id":21125956,"url":"https://github.com/shimpe/argparseui","last_synced_at":"2025-07-08T23:31:43.319Z","repository":{"id":46778034,"uuid":"11240958","full_name":"shimpe/argparseui","owner":"shimpe","description":"automagically add a PyQt based UI to setup options to an argparse based command-line tool","archived":false,"fork":false,"pushed_at":"2021-09-26T13:10:54.000Z","size":95,"stargazers_count":24,"open_issues_count":1,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-30T20:52:46.466Z","etag":null,"topics":["argparse","pyqt","python","ui"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shimpe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-07T22:03:02.000Z","updated_at":"2023-06-27T07:00:38.000Z","dependencies_parsed_at":"2022-09-02T11:00:59.529Z","dependency_job_id":null,"html_url":"https://github.com/shimpe/argparseui","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimpe%2Fargparseui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimpe%2Fargparseui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimpe%2Fargparseui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimpe%2Fargparseui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shimpe","download_url":"https://codeload.github.com/shimpe/argparseui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225470851,"owners_count":17479366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argparse","pyqt","python","ui"],"created_at":"2024-11-20T04:38:36.120Z","updated_at":"2024-11-20T04:38:38.220Z","avatar_url":"https://github.com/shimpe.png","language":"Python","readme":"                                                                        \n      This file is part of argparseui.\n  \n      argparseui is free software: you can redistribute it and/or modify\n      it under the terms of the GNU General Public License as published by\n      the Free Software Foundation, either version 3 of the License, or\n      (at your option) any later version.\n  \n      argparseui is distributed in the hope that it will be useful,\n      but WITHOUT ANY WARRANTY; without even the implied warranty of\n      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n      GNU General Public License for more details.\n  \n      You should have received a copy of the GNU General Public License\n      along with argparseui.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n                                                                        \n\nargparseui\n==========\n\nPurpose of argparseui\n---------------------\n\nargparseui can be used to quickly auto-generate a UI\nfrom an argparse based command line tool\n\nthe UI has widgets that allow to set up the command line options\n\nargparseui depends on PyQt\n\nState of argparseui\n-------------------\n\nargparseui is a scratch-my-own-itch tool\n\nas such it doesn't support all possibilities of argparse\n\nuse at your own risk, but feel free to log a bug/request\n\nBasic Parser Usage\n------------------\n    import argparse\n    import sys\n    try:\n        from PyQt5 import QtWidgets as GtGui\n    except ImportError:\n        from PyQt4 import GtGui\n    import argparseui\n    \n    # EXPERIMENT USING BASIC PARSER     \n    parser = argparse.ArgumentParser()\n    parser.add_argument(\"-m\", \"--make-argument-true\", help=\"optional boolean argument\", action=\"store_true\")\n    parser.add_argument(\"-o\",\"--make-other-argument-true\", help=\"optional boolean argument 2\", action=\"store_true\",  default=True)\n    parser.add_argument(\"-n\",\"--number\", help=\"an optional number\", type=int)\n    parser.add_argument(\"-r\",\"--restricted-number\", help=\"one of a few possible numbers\", type=int, choices=[1,2,3],  default=2)\n    parser.add_argument(\"-c\", \"--counting-argument\", help=\"counting #occurrences\", action=\"count\")\n    parser.add_argument(\"-d\", \"--default-value-argument\", help=\"default value argument\", type=float, default=\"3.14\")\n    group = parser.add_mutually_exclusive_group()\n    group.add_argument(\"-v\", \"--verbose\", action=\"store_true\")\n    group.add_argument(\"-q\", \"--quiet\", action=\"store_true\")\n    parser.add_argument(\"posarg\", help=\"positional argument\", type=str)\n\n    app = QtGui.QApplication(sys.argv)\n    a = argparseui.ArgparseUi(parser)\n    a.show()\n    app.exec_()\n\n    if a.result() == 1: # Ok pressed\n        parsed_args = a.parse_args() # ask argparse to parse the options\n        print parsed_args            # print the parsed_options\n\n    # Do what you like with the arguments...\n\nExample using save/load button and keeping the dialog open when pressing ok\n-----------------------------------------------------------------------------------------------------\n    import argparse\n    import sys\n    try:\n        from PyQt5 import QtWidgets as GtGui\n    except ImportError:\n        from PyQt4 import GtGui\n    import argparseui\n\n    def do_something(argparseuiinstance):\n        options = argparseuiinstance.parse_args()\n        print (\"Options: \", options)\n         \n    parser = argparse.ArgumentParser()\n    parser.add_argument(\"-m\", \"--make-argument-true\", help=\"optional boolean argument\", action=\"store_true\")\n    parser.add_argument(\"-o\",\"--make-other-argument-true\", help=\"optional boolean argument 2\", action=\"store_true\",  default=True)\n\n    app = QtGui.QApplication(sys.argv)\n    a =     argparseui.ArgparseUi(parser,use_save_load_button=True,ok_button_handler=do_something)\n    a.show()\n    app.exec_()\n    if a.result() != 1:\n        # Do what you like with the arguments...\n        print (\"Cancel pressed\")\n \nExtended features\n-----------------\n\nYou can pass some extra command line arguments to ArgparseUi:\n\n  *helptext_default* = string [default: ' [default=%(default)s]']\n  this argument can be used to customize the default value annotations in the ui\n\n  *remove\\_defaults\\_from_helptext* = True/False [default: False]\n  if enabled, this option will remove the default value annotations from \n  the labels in the ui\n\n  *use\\_save\\_load_button* = True/False [default: False]\n  if set to True, three extra buttons [Load options, Save Options, Save Options As] appear\n  the options are saved to (or loaded from) a command line option file in a file format compatible with \n  argparse's built-in support for loading options from file\n\n  *use_scrollbars* = True/False [default: False]\n  if set to True, the options are embedded in a scrollable panel\n\n  *window_title* = string [default: \"Make your choice\"]\n  if set to a string, this string will be used as dialog title\n\n  *left\\_label\\_alignment* = True/False [default: None]\n  if set to True, the checkboxes are left-aligned. This may be useful on platforms \n  like KDE or MacOsx which by default use right-alignment\n  \n  *ok\\_button\\_handler* = function taking one argument [default:None]\n  if set to None, the dialog will close upon clicking the ok button and its result will be set to 1\n  if set to a function accepting an ArgparseUi instance as argument, clicking ok will call that function \n  with \"self\" as argument\n  \n  *cancel\\_button\\_handler* = function taking one argument [default:None]\n  if set to None, the dialog will close upon clicking cancel and its result will be != 1\n  if set to a function accepting an ArgparseUi instance as argument, clicking cancel will call that\n  function with \"self\" as argument\n\nContributors\n------------\n\nThe following people have contributed to argparseui\n\n  * Stefaan Himpe (github user shimpe)\n  * Thomas Hisch (github user thisch)\n  * Graham (github user 4gra)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimpe%2Fargparseui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshimpe%2Fargparseui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimpe%2Fargparseui/lists"}