Gooey v1.0.7 Release Notes

Release Date: 2020-11-29 // about 1 year ago
  • ๐Ÿš€ Gooey 1.0.7 Released!

    ๐Ÿš€ Lots of new stuff this release! We've got 3 new widget types, new gooey_options, as well as some quality of Life improvements for using Gooey Options.

    ๐Ÿ†• New Widgets: IntegerField, DecimalField, and Slider

    ๐Ÿš€

    Gooey now has 3 inputs specifically geared towards accepting numeric inputs. Previously, all Gooey had were text fields which you could add validators to in order to enforce only numbers were entered, but now we have top level widgets which do all of that out of the box!

    Important Usage Note: since these numeric inputs don't allow any non-numeric characters to be entered, they do not give you the ability to blank them out. Unlike a TextField which can be left empty and thus have its value not passed to your program, the numeric inputs will always send a value. Thus, you have to have sane handling in user-land.

    ๐Ÿ“„ Checkout the Options docs for more details.

    ๐Ÿ†• New Gooey Options: placeholder

    ๐Ÿš€

    Widgets with text inputs now all accept a placeholder Gooey option.

    add\_argument('--foo', widget='TextField', gooey\_options=options.TextField( placeholder='Type some text here!')# or without the options helper add\_argument('--foo', widget='TextField', gooey\_options={ 'placeholder': 'Type some text here!'})
    

    ๐Ÿ†• New Validator option: RegexValidator

    add\_argument('--foo', widget='TextField', gooey\_options=options.TextField( placeholder='Type some text here!', validator=options.RegexValidator( test='\d{4}', message='Must be exactly 4 digits long!' ) )# or without the options helper add\_argument('--foo', widget='TextField', gooey\_options={ 'placeholder': 'Type some text here!', 'validator': { 'type': 'RegexValidator', 'test': '\d{4}', 'message': 'Must be exactly 4 digits long!' } })
    

    ๐Ÿ†• New feature: Options helpers

    Gooey now has a top-level options module which can be imported. Previously, Gooey Options have been an opaque map. While great for openness / extensibility, it's pretty terrible from a discoverability / "what does this actually take again..?" perspective. The new options module aims to make using gooey_options easier and more discoverable.

    from gooey import options
    

    ๐Ÿ“„ The goal is to enable IDE's to provide better auto-completion help as well as more REPL driven usefulness via help() and docstrings.

    from gooey import optionsparser.add\_argument( '--foo', help='Some foo thing', widget='FilterableDropdown', gooey\_options=options.FilterableDropdown( placeholder='Search for a Foo', search\_strategy=options.PrefixSearchStrategy( ignore\_case=True ) ))
    

    Note that these are just helpers for generating the right data shapes. They're still generating plain data behind the scenes and thus all existing gooey_options code remains 100% compatible.

    ๐Ÿ‘ Better Docs:

    Which is to say, documentation which actually exists rather than not exist. You can inspect the docs live in the REPL or by hopping to the symbol in editors which support such things.

    >>> from gooey import options 
    >>> help(options.RadioGroup) 
    Help on function FileChooser in module __main__ :
    
    FileChooser(wildcard=None, default_dir=None, default_file=None, message=None, **layout_options)
        :param wildcard: Sets the wildcard, which can contain multiple file types, for 
                         example: "BMP files (.bmp)|.bmp|GIF files (.gif)|.gif"
        :param message: Sets the message that will be displayed on the dialog.
        :param default_dir: The default directory selected when the dialog spawns 
        :param default_file: The default filename used in the dialog
    
        Layout Options:
        ---------------
    
        Color options can be passed either as a hex string ('#ff0000') or as
        a collection of RGB values (e.g. `[255, 0, 0]` or `(255, 0, 0)`)
    
        :param label_color: The foreground color of the label text
        :param label_bg_color: The background color of the label text.
        :param help_color: The foreground color of the help text.
        :param help_bg_color: The background color of the help text.
        :param error_color: The foreground color of the error text (when visible).
        :param error_bg_color: The background color of the error text (when visible).
        :param show_label: Toggles whether or not to display the label text
        :param show_help: Toggles whether or not to display the help text
        :param visible: Hides the entire widget when False. Note: the widget
                               is still present in the UI and will still send along any
                               default values that have been provided in code. This option
                               is here for when you want to hide certain advanced / dangerous
                               inputs from your GUI users.
        :param full_width: This is a layout hint for this widget. When True the widget
                               will fill the entire available space within a given row.
                               Otherwise, it will be sized based on the column rules
                               provided elsewhere. 
    

    Ideally, and eventually, we'll be able to completely type these options to increase visibility / usability even more. However, for backwards compatibility reasons, Gooey will continue to be sans anything more than the most basic of type hinting for the time being.

    ๐Ÿ’ฅ Breaking Changes

    No breaking API changes from 1.0.6 to 1.0.7. However, the strictness of existing Gooey Options has been increased, which could result in issues when upgrading from 1.0.6. In an attempt to be helpful, Gooey now throws an exception if invalid Gooey Options are supplied. This is to catch things like invalid types or ill-formed data. If you were passing bad data in 1.0.6, it will now be flagged as such in 1.0.7.

    ๐Ÿ‘ Thank you to the current Patreon supporters!

    • Sponsors:
      • Qteal
    • Individuals:
      • Joseph Rhodes
      • Nicholas

Previous changes from v1.0.6

  • ๐Ÿš€ Gooey 1.0.6 Released!

    ๐Ÿš€ This is a minor release beefing up the new FilterableDropdown's search capabilities and performance. In the previous release, the dropdown was backed by WX's ListBox widget. 1.0.6 replaces this for a fully virtualized version which allows Gooey to operate on massive datasets without taking a hit to UI performance. Additionally, how Gooey internally filters for matches has also been updated. Choice are now backed by a trie for super fast lookup even against large data sets. Tokenization and match strategies can be customized to support just about any lookup style.

    โšก๏ธ Head over to the Examples Repo to see the updated demo which now uses a datset consisting of about 25k unique items.

    ๐Ÿ†• New Gooey Options:

    FilterableDropdown now takes a search_strategy in its gooey_options.

    from gooey import Gooey, GooeyParser, PrefixTokenizersgooey\_options={ 'label\_color': (255, 100, 100), 'placeholder': 'Start typing to view suggestions', 'search\_strategy': { 'type': 'PrefixFilter', 'choice\_tokenizer': PrefixTokenizers.ENTIRE\_PHRASE, 'input\_tokenizer': PrefixTokenizers.REGEX('\s'), 'ignore\_case': True, 'operator': 'AND', 'index\_suffix': False } })
    

    This gives control over how the choices and user input get tokenized, as well as how those tokenized matches get treated (ANDed together vs ORd). Want to match on any part of any word? Enable the index_suffix option to index all of your candidate words by their individual parts. e.g.

    Word: 'Banana' 
    Suffixes: ['Banana', 'anana', 'nana', 'ana']
    

    These all get loaded into a trie for super fast lookup. Combine this with the WORDs tokenizer, and you get really fine grained search though your options!

    ๐Ÿ‘ Thank you to the current Patreon supporters!

    • Qteal
    • Joseph Rhodes

    ๐Ÿ’ฅ Breaking Changes

    No breaking changes from 1.0.5.