naturtag.settings module#
Basic utilities for reading and writing settings from config files
- class naturtag.settings.Settings(dark_mode=False, window_size=(1500, 1024), log_level='INFO', log_level_external='INFO', logfile=PosixPath('/home/docs/.local/share/Naturtag/naturtag.log'), show_logs=False, all_ranks=False, casual_observations=True, locale='en', preferred_place_id=1, username='', common_names=True, hierarchical=True, sidecar=True, exif=True, iptc=True, xmp=True, default_image_dir=PosixPath('/home/docs'), use_last_dir=True, recent_image_dirs=NOTHING, favorite_image_dirs=NOTHING, debug=False, setup_complete=False)#
Bases:
naturtag.settings.YamlMixin
- add_favorite_dir(image_dir)#
- add_recent_dir(path)#
Add a directory to the list of recent image directories
- all_ranks: bool#
- casual_observations: bool#
- common_names: bool#
- dark_mode: bool#
- debug: bool#
- default_image_dir: pathlib.Path#
- exif: bool#
- favorite_image_dirs: list[pathlib.Path]#
- hierarchical: bool#
- iptc: bool#
- locale: str#
- log_level: str#
- log_level_external: str#
- logfile: pathlib.Path#
- path: pathlib.Path = PosixPath('/home/docs/.local/share/Naturtag/settings.yml')#
- preferred_place_id: int#
- recent_image_dirs: list[pathlib.Path]#
- remove_favorite_dir(image_dir)#
- remove_recent_dir(image_dir)#
- setup_complete: bool#
- show_logs: bool#
- sidecar: bool#
- property start_image_dir: pathlib.Path#
Get the starting directory for image selection, depeding on settings
- Return type
Path
- use_last_dir: bool#
- username: str#
- window_size: tuple[int, int]#
- xmp: bool#
- class naturtag.settings.UserTaxa(history=NOTHING, starred=NOTHING, observed=NOTHING)#
Bases:
naturtag.settings.YamlMixin
Relevant taxon IDs stored for the current user
- property display_ids: set[int]#
Return top history, frequent, observed, and starred taxa combined. Returns only unique IDs, since a given taxon may appear in more than one list.
- Return type
set
[int
]
- frequent: collections.Counter[int] = None#
- frequent_idx(taxon_id)#
Return the position of a taxon in the frequent list, if it’s in the top
MAX_DISPLAY_HISTORY
taxa.- Return type
Optional
[int
]
- history: list[int]#
- observed: dict[int, int]#
- path: pathlib.Path = PosixPath('/home/docs/.local/share/Naturtag/stored_taxa.yml')#
- starred: list[int]#
- property top_frequent: list[int]#
Get the most frequently viewed taxa
- Return type
list
[int
]
- property top_history: list[int]#
Get the most recently viewed unique taxa
- Return type
list
[int
]
- property top_observed: list[int]#
Get the most commonly observed taxa
- Return type
list
[int
]
- update_history(taxon_id)#
Update history and frequent with a new or existing taxon ID
- update_observed(taxon_counts)#
- view_count(taxon_id)#
Return the number of times this taxon has been viewed
- Return type
int
- class naturtag.settings.YamlMixin#
Bases:
object
Attrs class mixin that converts to and from a YAML file
- path: pathlib.Path#
- write()#
Write settings to config file
- naturtag.settings.doc_field(doc='', **kwargs)#
Create a field for an attrs class that is documented in the class docstring.
- naturtag.settings.make_converter()#
- Return type
Converter
- naturtag.settings.setup(settings)#
Run any first-time setup steps, if needed: * Extract packaged full text search database to user data directory * Create database tables