Package: clickqt
Welcome to clickqtThis is currently under active development between myself and a group of studentsWhat isclickqt?clickqtis a python package which turnsclick's CLIs intoQt-GUIs.
Effectively, it turnsUsage: example_cli greet [OPTIONS]

Options:
  --userinfo <TEXT INTEGER DATETIME>...
  --help                          Show this message and exit.intoInstallationThe Python packageclickqtcan be installed from PyPI:python -m pip install clickqtDevelopment installationIf you want to contribute to the development ofclickqt, we recommend
the following editable installation from this repository:git clone git@github.com:dokempf/clickqt.git
cd clickqt
python -m pip install --editable .[tests]Having done so, the test suite can be run usingpytest:python -m pytestUsageclickqtis designed to allow two ways of usage:ExternalTo useclickqtexternally, you can run the entry point created by installingclickqt, calledclickqtfy.
There are two ways to use this entry point:clickqtfy ENTRYPOINTThis way works if you have an installed entry point.clickqtfy ENTRYPOINT FUNCNAMEIn cases where there is no installed entry point, you can use this method instead, providing a path/filename for ENTRYPOINT and a function name within that file for FUNCNAME.Wrapper with Entry PointYou can create entry points forclickqtin two steps:Create the control for the GUI as a variable (in a file namedsomefile.pyin the top-level directory of packagesomepackage):fromclickqtimportqt_gui_from_clickimportclick@click.command(...)deffoo(...):passui_handle=qt_gui_from_click(foo)Then referenceui_handlein thegui_scriptssection of yourpyproject.tomlfile like this:[project.gui-scripts]gui="somepackage.somefile:ui_handle"After installing, you can run this entry point by typingguiin your console, create a desktop shortcut linked to it, etc..Usage with gui informationIf you decide to design your own click.type then it would be normally mapped to a simple Textfield, if you do not provide additional information in the form of a dictionary.
It is important to note that the behaviour you want to invoke must also be provided by you, since the Qt-Widgets have different kind of getter and setter functions. This means that aside from you desired Qt-Widget you have to pass the getter function and the setter function for the customized type in a tuple, while your customized type is the key of the dictionary.fromclickqtimportqt_gui_from_clickimportclick@click.command(...)deffoo(...):passdefcustom_getter(widget:"CustomWidget"):assertisinstance(widget.widget,QSpinBox)returnwidget.widget.value()defcustom_setter(widget:"CustomWidget",val):widget.widget.setValue(val)ui_handle=qt_gui_from_click(foo,{BasedIntParamType:(QSpinBox,custom_getter,custom_setter)})This can be referenced externally via an option before the arguments:clickqtfy --custom-gui [GUI] ENTRYPOINTclickqtfy --custom-gui [GUI] ENTRYPOINT FUNCNAMEGUI in this case can be an entrypoint, created as described inWrapper with Entrypointor it is the ui_handle you used to create this entrypoint.
With this you can map your own click types to specific QtWidgets of your choice if this is your choice.SupportClickQt also supports the click extension to structure options of click commands in option groups (https://click-option-group.readthedocs.io/en/latest/).
This extension is supported by generating collapsible sections for the option groups to see the structuring of the options.LimitationsCurrently clickqt only supports the built-in features from click.
This means that any user defined behaviour (e.g., custom ParamTypes / Commands / Contexts) will propably not work as expected.
Furthermore, clickqt handles envvar options diffently from click.
In particular clickqt always splits the envvar whereas click does this dependent on the ParamType.
Future releases will take these issues into account. In the current stage of clickQt the special cases of option groups are not supported i.e MutuallyExclusiveOptionGroup (https://click-option-group.readthedocs.io/en/latest/tutorial.html#behavior-and-relationship-among-options).AcknowledgmentsThis repository was set up using theSSC Cookiecutter for Python Packages.