API reference

Introduction

First, a few remarks to the code documentation. Classes start with an upper case letter and are written in CamelCase. Underscores show inheritance (not always, e.g. controllers). Functions are all lowercase, with underscores seperating words. Variables start with a lowercase letter (except for one-letter variables). They can contain underscores (like functions) or continie with camelCase.

Controller classes start with letter ‘C’ View classes start with letter ‘V’

Core functionality

List operations

tagit.fst(lst)
tagit.snd(lst)
tagit.head(lst)
tagit.tail(lst)
tagit.unique(lst)
tagit.union(*args)
tagit.intersection(*args)[source]
tagit.difference(lstA, lstB)
tagit.split(callback, lst)[source]

Split the list lst via boolean return value of callback. True is returned first.

tagit.truncate_dir(path, cutoff=3)[source]

Remove path up to last cutoff directories

tagit.dict_update(aggregate, candidate)[source]

Update a dict recursively.

class tagit.thread_pool.ThreadPool(pool_size=1)[source]
add_task(task, *args, **kwargs)[source]

Add a callable task to the queue. The callback is executed as soon as there’s a free worker in the pool. Until then, the call to add_task is blocking. Additional arguments are passed to the task.

get_active()[source]

Return the number of active workers.

get_pool_size()[source]

Return the pool size.

Settings

class tagit.Settings[source]

Less strict dictionary for missing settings.

Return None instead of raising KeyError if a key is not in the settings dictionary.

The settings dictionary looks like this:

{
    "section" : {
        "config" : value,
        ...
    },
    ...
}

This class makes the dictionary keys “section” and “config” optional.

trace(*args)[source]

Traverse the settings dictionary and subdict’s args are (section, [<more dicts>,] key, default value)

tagit.get_config(settings, *args)[source]

Traverse the settings dictionary and subdict’s args are (section, [<more dicts>,] key, default value)

class tagit.bindings.Binding[source]

Handle keybindings.

A keybinding is a set of three constraints: * Key code * Inclusive modifiers * Exclusive modifiers

Inclusive modifiers must be present, exclusive ones must not be present. Modifiers occuring in neither of the two lists are ignored.

Modifiers are always lowercase strings. Additionally to SHIFT, CTRL and ALT, the modifiers “all” and “rest” can be used. “all” is a shortcut for all of the modifiers known. “rest” means all modifiers not consumed by the other list yet. “rest” can therefore only occur in at most one of the lists.

Usage example:

>>> # From settings, with PGUP w/o modifiers as default
>>> Binding.check(evt, self.settings.trace("bindings", "browser", "page_prev", Binding.simple(Binding.PGUP, None, Binding.ALL)))
>>> # ESC or CTRL + SHIFT + a
>>> Binding.check(evt, Binding.multi((Binding.ESC, ), (97, (Binding.CTRL, Binding.SHIFT), Binding.REST))))
static check(((code, scankey), modifiers), constraint)[source]

Return True if evt matches the constraint.

static multi(*args)[source]

Return binding for multiple constraints.

static simple(code, inclusive=None, exclusive=None)[source]

Create a binding constraint.

Console

class tagit.Console(verbose)[source]

Status Line. Create lines like so:

fixed_size_part variable_size_part [STAT]

The variable_size_part is truncated such that the line fits CONSOLE_WIDTH characters.

If not verbose, only failure states are printed

fail()[source]

Write FAIL result.

ignored()[source]

Write IGNORED result.

ok()[source]

Write OK result.

title(variable, fixed='')[source]

Write the text part of the status line.

class tagit.Colors[source]

Console colors.

Debugging

tagit.debug.debug(local, abort=False)[source]

Enter a debug shell.

In your code, place the following statement

>>> debug(locals())

to enter the debug shell at that point. You’ll have all local variables available, plus some extra modules (see below).

To get the current stack trace, call tr.print_stack().

Extra modules: code, traceback (tr), os, sys, itertools, copy, time.

tagit.debug.doDebug(loc)[source]

Start an interactive debug shell.

>>> from debug import doDebug
>>> doDebug(locals())

Whenever you do this, you’ll be dropped into a shell for debugging. Exit the shell with ctrl+d You’ll have your local variables and many debugging helpers readily imported.

Model

class tagit.model.DataModel(settings, path=None, meta_adapter=None)[source]

Open a database from the file path or memory (if None, the default, or empty). If a path is given but does not exist, a new database will be created. Version constraints on existing databases may apply.

get_creation_date(image)[source]

Return the creation date of an image.

get_image(image, resolution=None)[source]

Return an openable image from image.

get_instance_infos()[source]

Return sender id and name as tuple.

get_metadata(image)[source]

Return all data of image.

get_version()[source]

Return the database version.

has_changes()[source]

Return True if the database has unsaved changes.

has_file_connection()[source]

Return True if the database is stored in a file. As opposed to in-memory database.

index_dir(path, recursive=False, sync_method='set', insert_only=False, update_only=False)[source]

Index or reindex files in path. The database will not be saved!

index_file(path, sync_method='set', insert_only=False, update_only=False)[source]

Index or reindex path. The database will not be saved!

index_files(files, sync_method='set', insert_only=False, update_only=False, common_root=None)[source]

Index or reindex may files. The database will not be saved.

load(path=None)[source]

Open a database and re-initialize the instance.

load_database(path=None)[source]

Load a database from path. If path is None, the database is created in the memory. If path does not exist, a new database is created.

merge(other, sync_method='union')[source]

Merge this database into other. The other database will be changed, not this instance. Changes are not commited. Indexed images are merged. If an image is indexed in both, the basic information is taken from the later one. Tags are always merged according to sync_method. SYNC_SET then means to use the information of this database.

num_images()[source]

Return the total number of images.

query(tokens=None)[source]

Return all images which satisfy all constraining tokens. Tokens is a list of tags (exact match).

remove_dead(path, recursive=False)[source]

Remove inexistent files from the database.

remove_dir(path, recursive=False)[source]

Remove images in path from the database. Traverses subdirectories if recursive is set. path has to be a directory.

remove_image(image)[source]

Remove image from the database.

remove_images(images)[source]

Remove images from the database.

rollback()[source]

Undo changes since the last save.

save(path=None)[source]

Save changes to the database.

If path is set, creates a new database with the current content at that location. The new database is returned, the old one is neither changed (i.e. reverted) nor saved.

If path is not set, changes to the database are commited.

If ‘write-through’ is True the changes are saved to the file as well (-> update_files(sync_method=SYNC_SET))

sync_dir(path, recursive)[source]

Synchronize all files in path with the database. Creates an UNION of file and database and writes to both. Files will be changed, database not saved!

sync_file(path)[source]

Synchronize file path with the database. Creates an UNION of file and database and writes to both. Files will be changed, database not saved!

sync_files(files)[source]

Synchronize all files in files with the database. Creates an UNION of file and database and writes to both. Files will be changed, database not saved!

update_dir(path, recursive=False, sync_method='set')[source]

Update all files in path with information from the database. If path is a directory, all files in that directory are updated. If path is a directory and recursive is true, all subdirectories will be changed as well. Files will be changed.

update_file(path, sync_method='set')[source]

Update all files in path with information from the database. Files will be changed.

update_files(files, sync_method='set', common_root=None)[source]

Update all files in path with information from the database. Files will be changed.

class tagit.model.db_path.DBpath(settings, database)[source]

Path operations on database entries.

exists(path)[source]

Return whether path exists in the database. path should be a file. For directories, the result is always False because directories are not mapped in the database.

getdir(path)[source]

List contents of directory path. path must be a directory. Files and directories are listed, without ‘.’ and ‘..’

is_dir(path)[source]

Check if path is a directory.

is_file(path)[source]

Check if path is a file.

is_prefix(prefix, path)[source]

Return True if path is a subdirectory of prefix or a file within prefix.

is_temp(path)[source]

Return True if path is within a temporary location.

join(*parts)[source]

Join parts of a path.

listdir(path)[source]

List contents of directory path. path must be a directory. Files and directories are listed, without ‘.’ and ‘..’

listfiles(path)[source]

List files of directory path. path must be a directory.

walk(top)[source]

Recursively walk through directory structure from a top directory.

Example:

>>> for root, files, dirs in walk(top):
>>>     print root, files, dirs
>>>     # root is the base directory
>>>     # files is a list of file names in root
>>>     # dirs is a list of directory names in root

Tags

class tagit.model.tags.Tags[source]

The Tags baseclass and interface.

Tags are keywords which can be attached to images. Tags can be retrieved (get) and modified (add, set, remove). Other actions may be available.

add(images, tags)[source]

Add all tags to each of images.

cleanup()[source]

Search and remove tags without images.

get(image)[source]

Return tags of image.

get_all()[source]

Return all tags in the database.

query(tags)[source]

Return all images which satisfy all constraining tags.

remove(images, tags)[source]

Remove all of tags from all of images.

remove_all(images)[source]

Remove all tags from each of images.

rename(old, new)[source]

Rename from old tags to new.

set(images, tags)[source]

Set tags of images to be exactly tags.

class tagit.model.tags.Tags_SQLite(conn)[source]

Bases: object

Tag operations based on a SQLite database.

The database link is to be passed as conn. Database changes are not saved. It’s assumed that the basic scheme is present (i.e. image table).

add(images, tags)[source]

Add all tags to each of images. images is a list of images (path). If an image is not in the database, it is ignored. tags is a list of strings. If a tag is not in the database, it is added.

cleanup()[source]

Search and remove tags without images. This operation may take some time.

histogram(include=None, exclude=None)[source]

Return a dict with frequency of each tag. Tags are keys, values are the number of occurrences. If include is not None, only images of this list are considered. If exclude is not None, images of this list are not considered.

query(tags)[source]

Return all images which satisfy all constraining tags.

rename(source, target)[source]

Rename a tag from source to target. source and target are the tag names. If target exists, the tags will be merged.

class tagit.model.tags.Tags_Exif(adapter)[source]

Bases: tagit.model.tags.Tags

Tags-like interface to EXIF/IPTC metadata.

A meta_adapter is required to do the IPTC operations. Some operations are not meaningful and return dummy values.

MetaAdapter

class tagit.model.meta_adapter.MetaAdapter[source]

Handle IPTC/EXIF reads and writes to files.

add(path, tags)[source]

Add tags to IPTC of image path. path has to be a writeable file (not checked). Image data is written. tags is added to the existing tags.

get(path)[source]

Read IPTC keywords from path. Return a list of tags. path has to be a readable file (not checked).

get_author(path)[source]

Return the image author.

get_date(path)[source]

Return the image date.

get_dimensions(path)[source]

Return width, height and orientation of path.

get_metrics(path)[source]

Return the image metrics.

get_thumbnail(path)[source]

Return the thumbnail embedded in image path. path has to be a readable file.

set(path, tags)[source]

Write tags to IPTC of image path. path has to be a writeable file (not checked). Image data is written. Existing tags are overwritten.

set_thumbnail(path, image)[source]

Write thumbnail image into path. path has to be a writeable file (not checked). Image data is written. image is written as thumbnail.

class tagit.model.meta_adapter.MetaAdapter_PyExiv2[source]

Bases: tagit.model.meta_adapter.MetaAdapter

Makes use of the pyexiv2 library to manipulate files.

Extractor

class tagit.model.extractor.Extractor[source]
tags(image, settings, meta_adapter)[source]

Return a list of automatically extracted tags from image.

class tagit.model.extractor.Extractor_Constant[source]

Bases: tagit.model.extractor.Extractor

Constant information, user-provided.

class tagit.model.extractor.Extractor_Date[source]

Bases: tagit.model.extractor.Extractor

Date information: * Year : Year (4 digit) * Day : Day of month * Month : Month (int 1-12 or name Jan-Dec) * Weekday : Weekday (int 1-7 (iso) or name Mon-Sun) * Hour : Hour (int) * Minute : Minute (int) * Day/Night : day or night

class tagit.model.extractor.Extractor_Photometrics[source]

Bases: tagit.model.extractor.Extractor

Image and camera metrics: * Resolution : Image resolution (width, height) * Exposure : Exposure time (float, seconds, inverted) * Focal length : Reported focal length or 35mm equivalent (float, mm) * Aperture : Aperture (‘F’ + float) * ISO : ISO level (int)

class tagit.model.extractor.Extractor_Path[source]

Bases: tagit.model.extractor.Extractor

Path information: * mime : Mime type (image/jpeg, ...) * extension : File extension (jpg, png, ...) * dir_after : Folder after specified path * dir_last : Image’s parent directory * dir_after_call: Folder after search root

strip_date: Remove leading or trailing date information

class tagit.model.extractor.Extractor_Aggregator(children=None)[source]

Bases: tagit.model.extractor.Extractor

Combine multiple Extractor instances into one.

add_child(child)[source]

Add another Extractor instance.

class tagit.model.extractor.Extractor_Aggregator_all(children=None)[source]

Bases: tagit.model.extractor.Extractor_Aggregator

Aggregate all known Extractors.

Attributes

class tagit.model.attributes.Attributes[source]
class tagit.model.attributes.Attributes_SQLite(meta_adapter, conn)[source]

Bases: tagit.model.attributes.Attributes

query(attributes=None, values=None)[source]
set_from_path(db_id, path)[source]

Get attributes from EXIF and write them into the database.

Thumbnailer

class tagit.model.thumbnail.Thumbnailer[source]

Interface for thumbnail operations.

Thumbnailer defines an interface for any thumbnail handling method. It implements creation but remains abstract for get and set.

create(image, resolution=(400, 400))[source]

Create a thumbnail of image and return the Image object.

get(image, resolution=(400, 400))[source]

Search for a thumbnail of image. Return the path (file-based) or object (embedded) image. Return None if no thumbnail was found.

has(image)[source]

Search for a thumbnail of image. Return success status as boolean.

remove(image, resolution=None)[source]

Remove thumbnail at resolution of image. None for resolution means all.

set(image, thumb)[source]

Write the thumbnail thumb to image.

class tagit.model.thumbnail.Thumbnailer_Chain(*args)[source]

Bases: tagit.model.thumbnail.Thumbnailer

Link several Thumbnailers together.

get: The first match is returned. set: Applied on all childs.

class tagit.model.thumbnail.Thumbnailer_FS(root)[source]

Bases: tagit.model.thumbnail.Thumbnailer

Read and write thumbnails from/to the file system. Clones the original file structure within a root directory.

class tagit.model.thumbnail.Thumbnailer_FS_Flat(conn, root)[source]

Bases: tagit.model.thumbnail.Thumbnailer

Read and write thumbnails from/to the file system. All thumbnails go to the same directory, with a generic file name. The database links the image and its thumb file.

class tagit.model.thumbnail.Thumbnailer_Exif(meta_adapter)[source]

Bases: tagit.model.thumbnail.Thumbnailer

Read and write the exif thumbnail

remove(image, resolution=None)[source]

Remove thumbnail at resolution of image. None for resolution means all.

class tagit.model.thumbnail.Thumbnailer_Database(conn)[source]

Bases: tagit.model.thumbnail.Thumbnailer

Read and write thumbnails from/to the database.

tagit.model.resize.resize(img, box, fit=False)[source]

Downsample the image. @param img: Image - an Image-object @param box: tuple(x, y) - the bounding box of the result image (i.e. resolution) @param fit: boolean - crop the image to fill the box (False = keep aspect ratio)

Token

class tagit.token.Token[source]

Bases: object

display()[source]

Display name (abbreviation).

edit()[source]

Return editable text.

static from_string(string)[source]

Build from string.

get()[source]

Return raw value.

static match(obj)[source]

Compare type.

update(string)[source]

Update from a string. Returns self.

tagit.token.token_factory(type_)[source]

Program

class tagit.program.program.Program(notification_clbk=None)[source]

Program State-Machine:

States: * uninitialized * initialized * running * paused * stopped

Transitions: * uninitialized -> initialized (init) * {initialized, stopped} -> uninitialized (unload) * {initialized, stopped} -> running (start) * {running, paused} -> stopped (stop) * running -> paused (pause) * paused -> running (resume)

load(path)[source]

Load a program state from path.

save(path)[source]

Save the current state to path.

class tagit.program.bfs.Pgm_BFS(notification_clbk=None)[source]

Bases: tagit.program.tree_walker.Pgm_TreeWalker

User interface

Controller

class tagit.controller.controller.Controller(widget, settings, parent=None, **kwargs)[source]

Controller base class. Any controller receives a dict with the settings, a data model and a parent.

The parent being None implies that the object is the root controller.

The controller supports a simple event meachanism. You can bind callbacks on events on a controller object and later dispatch the event. Note that dispatching an event only affects callback bound to the same controller instance.

Similar to the event mechanism, data can be requested from controllers, announced via the rbind function.

>>> def callback_fu(arg1, arg2):
    pass
>>>
>>> c = Controller()
>>> c.bind(event_name=callback_fu)
>>> c.dispatch('event_name', arg1, arg2)
>>> c.rbind(request_name=callback_fu)
>>> c.request('request_name', arg1, arg2) # Returns []
>>> Controller().dispatch('event_name', arg1, args2) # Doesn't do anything
>>> Controller().request('request_name', arg1, args2) # Returns []
add_child(cls, wx, **kwargs)[source]

Create and add a child controller.

dispatch(event, *args, **kwargs)[source]

Dispatch an event. Extra arguments after the event will be passed to the event handler>

get_root()[source]

Return the top element in the controller tree. Return the root of the tree the instance is currently attached to. If the controller is created but not attached to a real controller tree, the result may be unusable.

request(req, *args, **kwargs)[source]

Send a request. Return a list of answers. The list may be empty. Extra arguments after the req will be passed to the event handler>

class tagit.controller.controller.DataController(widget, model, settings, parent=None, **kwargs)[source]

Bases: tagit.controller.controller.Controller

A controller with access to a model.

View

tagit.view.basics.get_root()[source]

Return the main window.

tagit.view.basics.colorize(text, color)[source]
tagit.view.basics.fontize(text, font)[source]

Kivy widgets will be extended by the following three functions. They allow easy creation of the Controller instances.

tagit.view.wx_adapter.on_parent(obj, self, parent)[source]

Default behaviour if the parent of a widget is changed. Calls on_parent of all childs, even though the direct parent has not changed. This behaviour is usefull to pass down widget tree changes to lower widgets.

tagit.view.wx_adapter.get_root(self)[source]

Traverse the widget tree upwards until the root is found. Note that this is not the same as basics.get_root (or app.root from a debug shell) unless the calling widget is attached to the main widget tree. Specifically, if a widget or any of its parents is created but not yet attached.

tagit.view.wx_adapter.get_controller(self, cls=None, wx=None, **kwargs)[source]

Search and return the nearest controller. Create and return an instance of type cls, unless cls is None. Returns None if no controller was found.

Main

class tagit.controller.main.CMainWindow(widget, settings, parent=None, **kwargs)[source]

Bases: tagit.controller.controller.Controller

MainWindow controller.

Receives the key events and passes them on.

class tagit.controller.main.CMainWidget(widget, model, settings, parent=None, **kwargs)[source]

Bases: tagit.controller.controller.DataController

Browser

class tagit.controller.browser.CBrowser(widget, model, settings, parent=None, **kwargs)[source]

Bases: tagit.controller.controller.DataController

add_tag(text)[source]

Add tags to images. text is a string of tags, split at TAGS_SEPERATOR.

cursor_down()[source]

Down Cursor: One row down View: If cursor was at bottom row, jump by one row

cursor_left()[source]

Left Cursor: One column left View: No change

cursor_right()[source]

Right Cursor: One column right View: No change

cursor_up()[source]

Down Cursor: One row down View: If cursor was at bottom row, jump by one row

delete()[source]

Delete selected images from the database. Not to be confused with the ‘exclusive’ filter / remove selected.

edit_tag(original, modified)[source]

Remove tags from images. Original and modified are strings, split at TAGS_SEPERATOR. Tags are added and removed with respect to the difference between those two variables.

on_key_down(wx, (code, key), modifiers)[source]

Watch out for those modifiers.

on_key_up(wx, (code, key))[source]

Watch out for those modifiers. Can receive some ups when modifier pressed at app start

on_keyboard(wx, evt)[source]

The CBrowser portion of key press handling.

on_results_changed(filter_, images, frame)[source]

Called when the set of images to be displayed was changed.

redraw()[source]

Update the widget.

select(image, input_method='mouse')[source]

Set the selection. image is the selected (clicked) image.

zoom_in()[source]

Decrease grid size.

zoom_out()[source]

Increase grid size.

class tagit.view.browser.VBrowser(**kwargs)[source]

Bases: kivy.uix.boxlayout.BoxLayout

Image browser.

Guaranteed childs (needed for Sideboxes): * cursor Current image (VImage instance) * selection Selected images * get_displayed Displayed images

displayed_images()[source]

Return the images currently displayed.

on_parent(*args)[source]

Set the controller factory. Reinitializes parts of the browser.

on_touch_down(touch)[source]

Scroll in browser.

redraw(images, offset, n_results, page_size)[source]

Update the displayed images.

redraw_cursor(cursor)[source]

Redraw cursor decoration.

redraw_selection(selected_images)[source]

Redraw selection decoration.

set_grid_size(num_cols, num_rows)[source]

Set the grid size (cols and rows) according to proposed values.

Filter

class tagit.controller.filter.CFilter(widget, model, settings, parent=None, **kwargs)[source]

Bases: tagit.controller.controller.DataController

add_token(token)[source]

Add a token text.

add_token_tag(text)[source]

Add a token for tag text.

add_variable_token(text)[source]

Add a token and allow its type to be specified.

apply()[source]

Run the filter.

edit_token(token, data)[source]

Change token to text.

go_back(nSteps=1)[source]

Remove the last nSteps tokens.

go_forth(nSteps=1)[source]

Re-add the next nSteps tokens.

load(path)[source]

Load the filter from path.

on_keyboard(wx, evt)[source]

Handle filter keyboard events.

redraw()[source]

Update the widget.

remove_token(token)[source]

Remove a token from the token list.

request_add_token()[source]

Add a token.

request_apply()[source]

Apply the filter.

request_edit_token(token, newtext='')[source]

Change token. If newtext is empty, a dialogue will be requested. Otherwise, token is changed to newtext.

request_remove_token(token)[source]

Remove token token.

save(path)[source]

Save the current filter to path.

class tagit.view.filter.VFilter(**kwargs)[source]

Bases: kivy.uix.boxlayout.BoxLayout

A row of filter tokens (i.e. some filter text) and its management.

A filter is used to search in the image database. The filter consists of several tokens. Each token adds a search constraint.

Tokens can be added, changed and removed. The filter can be applied to an image source. This has effects on other parts of the UI, namely the Browser.

error(text)[source]

Display an error dialogue.

on_parent(*args)[source]

Set the controller.

redraw(tokens, cutoff)[source]

Redraw the tokens.

request_add_token()[source]

Ask the controller to add a token.

request_apply()[source]

Ask the controller to apply the filter.

token_dialogue(text, clbk)[source]

Show a dialogue for modifying tokens.

Sideboxes

class tagit.view.sidebar.VSidebar(*args, **kwargs)[source]

Bases: kivy.uix.gridlayout.GridLayout

Load configured sideboxes, present them stacked.

on_parent(*args)[source]

Set the controller factory. Reinitializes parts of the browser.

on_widget_change(instance, widget)[source]

Re-initialize the Sideboxes to a new mainWidget.

class tagit.controller.sidebox.db_management.CSidebox_DB_Management(widget, model, settings, parent=None)[source]

Bases: tagit.controller.controller.DataController

A set of functions to manage the model.

on_keyboard(wx, evt)[source]

Handle keypresses.

request_index()[source]

On index button click.

request_load()[source]

On load button click.

request_new()[source]

On new button click.

request_reload()[source]

On reload button click.

request_save()[source]

On save button click.

request_save_as()[source]

On save as button click.

class tagit.view.sidebox.db_management.VSidebox_DB_Management(**kwargs)[source]

Bases: kivy.uix.gridlayout.GridLayout, tagit.view.sidebox.sidebox.VSidebox

A bunch of buttons to control the database.

class tagit.controller.sidebox.tags.CSidebox_Tags(widget, model, settings, parent=None, **kwargs)[source]

Bases: tagit.controller.controller.DataController

Base class for tag-oriented sideboxes.

class tagit.controller.sidebox.tags_suggested.CSidebox_Tags_Suggested(widget, model, settings, parent=None)[source]

Bases: tagit.controller.sidebox.tags.CSidebox_Tags

Give a recommendation which tags to include next in the filter.

update(filter_, images, frame)[source]

Update the sidebox.

class tagit.view.sidebox.tags_suggested.VSidebox_Tags_Suggested(*args, **kwargs)[source]

Bases: kivy.uix.label.Label, tagit.view.sidebox.sidebox.VSidebox

Show tags to include next in the filter.

class tagit.controller.sidebox.tags_browser.CSidebox_Tags_Browser(widget, model, settings, parent=None)[source]

Bases: tagit.controller.sidebox.tags.CSidebox_Tags

Show tags if images displayed. Highlight tags of selected images and the cursor.

update()[source]

Update the sidebox widget.

class tagit.view.sidebox.tags_browser.VSidebox_Tags_Browser(*args, **kwargs)[source]

Bases: kivy.uix.label.Label, tagit.view.sidebox.sidebox.VSidebox

Show tags if images displayed. Highlight tags of selected images and the cursor.

class tagit.controller.sidebox.tags_selection.CSidebox_Tags_Selection(widget, model, settings, parent=None)[source]

Bases: tagit.controller.controller.DataController

List tags of selected images.

update(browser, selection)[source]

Update the sidebox widget.

class tagit.view.sidebox.tags_selection.VSidebox_Tags_Selection(**kwargs)[source]

Bases: kivy.uix.label.Label, tagit.view.sidebox.sidebox.VSidebox

List tags of selected images.

class tagit.controller.sidebox.tags_cursor.CSidebox_Tags_Cursor(widget, model, settings, parent=None)[source]

Bases: tagit.controller.controller.DataController

List tags of the image under the cursor.

update(browser, cursor)[source]

Update the sidebox widget.

class tagit.view.sidebox.tags_cursor.VSidebox_Tags_Cursor(**kwargs)[source]

Bases: kivy.uix.label.Label, tagit.view.sidebox.sidebox.VSidebox

List tags of the image under the cursor.

class tagit.controller.sidebox.pgm.CSidebox_Program_Control(widget, model, settings, parent=None, main_widget=None)[source]

Bases: tagit.controller.controller.DataController

A set of functions to manage the model.

class tagit.view.sidebox.pgm.VSidebox_Program_Control(*args, **kwargs)[source]

Bases: kivy.uix.boxlayout.BoxLayout, tagit.view.sidebox.sidebox.VSidebox

A bunch of buttons to control the database.

load()[source]

Load a program state.

select(*args)[source]

Select a program.

Dialogues

class tagit.view.dialogues.dialogue.Dialogue(**kwargs)[source]

Bases: kivy.uix.popup.Popup

Popup dialogue with OK and Cancel buttons.

Use like below:

>>> dlg = Dialogue()
>>> dlg.bind(on_ok=....)
>>> dlg.bind(on_cancel=...)
>>> dlg.open()
cancel()[source]

User pressed the Cancel button.

ok()[source]

User pressed the OK button.

on_cancel()[source]

Event prototype.

on_ok()[source]

Event prototype.

class tagit.view.dialogues.TextInputDialogue(**kwargs)[source]

Bases: tagit.view.dialogues.dialogue.Dialogue

Dialogue with a single line text input field.

keyboard_ctrl is an object supporting request_exclusive_keyboard and release_exclusive_keyboard for exclusive keyboard access. Usually the root_widget.

Pass the default text as text.

>>> TextInputDialogue(text='Hello world', keyboard_ctrl=root_widget).open()

In case of touch events, they need to be inhibited to change the focus.

>>> FocusBehavior.ignored_touch.append(touch)
class tagit.view.dialogues.LabelDialogue(**kwargs)[source]

Bases: tagit.view.dialogues.dialogue.Dialogue

Dialogue with some text.

Set the default text as text.

>>> LabelDialogue(text='Hello world').open()
class tagit.view.dialogues.FilePickerDialogue(**kwargs)[source]

Bases: tagit.view.dialogues.dialogue.Dialogue

Dialogue with a file browser to select a file.

Pass the default text as text.

>>> FilePickerDialogue(text='Hello world').open()
class tagit.view.dialogues.DirPickerDialogue(**kwargs)[source]

Bases: tagit.view.dialogues.dialogue.Dialogue

Dialogue with a file browser to select a directory.

Pass the default text as text.

>>> DirPickerDialogue(text='Hello world').open()
class tagit.view.dialogues.FileCreatorDialogue(**kwargs)[source]

Bases: tagit.view.dialogues.dialogue.Dialogue

Dialogue with a file browser to select a file.

Pass the default text as text.

>>> FileCreatorDialogue(text='Hello world').open()
class tagit.view.dialogues.ErrorDialogue(**kwargs)[source]

Bases: tagit.view.dialogues.dialogue.Dialogue

Dialogue with some text.

Set the default text as text.

>>> try:
>>>     ...
>>> except Exception, e:
>>>     ErrorDialogue(text=e.message).open()
class tagit.view.dialogues.BindingsDialogue(bindings, *args, **kwargs)[source]

Bases: tagit.view.dialogues.dialogue.Dialogue

Dialogue with some text.

Set the default text as text.

Externals

class tagit.external.spellcheck.Spellcheck(lang='en')[source]
class tagit.external.memoize.memoized(func)[source]

Decorator. Caches a function’s return value each time it is called. If called later with the same arguments, the cached value is returned (not reevaluated).

Tools

tagit.metrics.tags_similarity(tags)[source]
  • Similar case
  • Similar word (typo: common errors, change of two letters)
  • Synonym
  • Prefix (one word is subset of the other)
  • Similar results
  • One is a subset of the other (w.r.t images)
tagit.metrics.stat_per_tag(model)[source]
tagit.metrics.stat_per_image(model)[source]
tagit.tools.tags_histogram(model)[source]
tagit.tools.tags_stats(model)[source]
Tag statistics:
  • Tag Histogram
  • correlation btw. tags (matrix, top-N list)
tagit.tools.tags_collect(model)[source]

Goes through all tags and queries the user if it should be merged with a similar one.

The user can choose the following actions for each pair of tags: * l Merge to the left; Keeps the left tag, removes the right one * r Merge to the right; Keeps the right tag, removes the left one * n Don’t merge, keep both tags * s Skip this pair, ask later * q Quit

tagit.tools.images_export(images, target, method=None, keep_structure=False, simulate=False, verbose=False, overwrite=False)[source]

Export images to a target directory.

Method can be either of: * symlink Create symlinks in the target directory * hardlink Create hardlinks in the target directory * copy Copy the images to the target directory

If keep_structure is True, the original directory structure is recreated starting after the shared prefix of images. Otherwise, the images will be exported to the target folder directly. If so, naming conflicts are handled by adding a sequence number to the image name. E.g. /foo/image.jpg, /bar/image.jpg -> export/image.jpg, export/image-1.jpg

If simulate is True, path translations are returned (src, trg) but no action is actually taken.