Core#

tagit provides a number of submodules that are

Windows#

A window arranges several UI elements into a consistent view, optimized for a specific platform. Currently, the only window instance (tagit.window.desktop) that exists is tuned for desktop environments.

Widgets#

tagit defines three main widgets:

  • tagit.widgets.browser.Browser

  • tagit.widgets.filter.Filter

  • tagit.widgets.session.Session

Each of those widgets can be used as context, whereas the widget updates if its state was changed when the context expires. Clients (e.g. Actions, Tiles) can thus safely access and modify the widgets directly.

Additionally, there exists widgets for key bindings (tagit.widgets.bindings.Binding), a status bar (tagit.widgets.status.Status), and docks for Actions and Tiles (taigt.widgets.dock). These widgets are mostly used internally to arrange UI elements, or to provide additional input methods to the user.

config#

tagit comes with an intricate configuration system. The core idea is to provide a means to define config keys and defaults in the code files where they are used, but also have the ability to check a config file’s validity upon application startup, and to provide reasonable and meaningful documentation for each config item.

Configuration items are declared and documented in the source file that typically uses them:

from tagit import config

config.declare(('ui', 'standalone', 'browser', 'cols'), config.Unsigned(), 3,
    __name__, 'Browser columns', 'Default number of columns in the browser.')

config.declare(('ui', 'standalone', 'browser', 'rows'), config.Unsigned(), 3,
    __name__, 'Browser rows', 'Default number of rows in the grid view.')

def n_items(cfg):
    """Return the number of items shown on one page."""
    # config values are automatically converted to integers
    cols = cfg('ui', 'standalone', 'browser', 'cols')
    rows = cfg('ui', 'standalone', 'browser', 'rows')
    return cols * rows

With config.declare, you specify the config key((‘ui’, ‘standalone’, ‘browser’, ‘cols’)), a type (config.Unsigned()), the default value (3), and some documentation arguments (module name, abstract, description).

On application-level, loading (and type checking) a config file is as simple as calling:

from tagit.config import Settings
cfg = Settings.Open(path)

The user can the write a config file in json, yaml, or another structured file format:

ui:
    standalone:
        browser:
            cols: 4
            rows: 3