Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to viewer config #69

Merged
merged 26 commits into from
Sep 2, 2022
Merged

Improvements to viewer config #69

merged 26 commits into from
Sep 2, 2022

Conversation

AnonymouX47
Copy link
Owner

@AnonymouX47 AnonymouX47 commented Aug 22, 2022

Resolving AnonymouX47/termvisage#2

  • Implements support for partial configs
  • Implements support for XDG Base Directories Specification
  • Fixes and improves updating of TUI keybindings
  • Fixes and improves "log file" validation
  • Adds an upper limit of 5 for the "max notifications" option
  • User config is now initialized after CL arguments have been parsed
  • Incorporates the logging and notification systems into the config system
  • Adds --config and --no-config CL options
  • Updates config notification messages
  • Adds sample config file with all defaults
  • Renames "no multi" to "multi"

- Add: User config files may now specify only the options or context actions to be modified.
- Change: Fields omitted at the top-level of the user config are no longer reported as "missing".
- Change: Removed the "version" field.
  - Won't work with (user-created) partial configs.
- Change: Removed `.config.update_config()`.
  - Won't work without a config version.
  - Won't work with partial configs.
- Add: `$XDG_CONFIG_HOME` and `$XDG_CONFIG_DIRS` are now searched for user config files.
- Add: Added `load_xdg_config()`, `xdg_config_file` and `user_config_file` in `.config`.
- Change: Config files are no longer written into or searched for in `$HOME/.term_image/`.

Refs: #63
- Fix: Context actions having their old keys the same as a new key for a navigation action are no longer wronger detected as context navigation actions.
  - Though the issue didn't have any visible consequences till now, it will in the near future.
- Add: Added `.config._context_navs` for identification of context navigation actions.
- Change: Renamed and updated `update_context_nav_keys()` -> `update_context_nav()` in `.config`.
- Fix: Now detects conflicting fallback key when an action's properties are in an incorrect format.
- Fix: Conflicts between updated global or navigation action keys and unupdated context action keys are now detected and resolved.
- Fix: In `try_fallback()`, the fallback or default key is now added to the set of assigned keys instead of the conflicting key.
- Fix: Updating context navigation actions is now explicitly disallowed with an error indicating which navigation action should be updated instead.
- Add: Implemented Support for multiple/recurrent/consecutive/incremental updates.
  - Heavily refactored/updated `.config.update_context()`.
- Change: When resolving conflicts, if the old key is already assigned, the default key is also tried, provided the old key is not the default.
- Change: Navigation action keys are only considered as conflicting with a context action key when the navigation action is used in a that context.
  - Normal context action keys can now use the same keys used by navigation actions not present in the context.
- Change: The global context is now updated first and is not checked for conflicts against any other context during its own update.
- Change: Better detailed info and error messages.
- Fix: Swapping keys between navigation actions no longer messes up the command map update.
- Change: Unused commands are now removed from the command map.
- Add: Added `ConfigOptions` and `Option` classes in `.config`.
- Change: Improved organization of and access to config options.
  - Now storing config options (with all properties) as `Option` objects, all in a `ConfigOptions` object.
- Change: Minor changes to some CL option descriptions.
- Change: Implemented support for partial configs.
  - Only modified options and context actions are now included.
- Change: Removed `--reset-config` CL option.
  - Incompatible with partial configs.
@AnonymouX47 AnonymouX47 added documentation Improvements or additions to documentation cli Related to the image viewer's CLI (Not to be used anymore) tui Related to the image viewer's TUI (Not to be used anymore) config Related to the viewer configuration (Not to be used anymore) fix Fixes a bug new New feature implementation improvement Implementation of improvement to an existing feature labels Aug 22, 2022
@AnonymouX47 AnonymouX47 added this to the 0.5.0 milestone Aug 22, 2022
- Change: Updated default value and validation of CL options with corresponding config options.
  - CL options with corresponding config options now have default values of `None`.
  - `None` will later be replaced with config option value.
- Fix: Bare file names (i.e relative paths without "./" or "../") are no longer taken to be invalid.
- Fix: Corrected error message.
- Change: Renamed `_context_navs` -> `context_navs` in `.config`.
  - Eliminates confusion since the object doesn't exactly store default data because there can never be a non-default form of the data.
- Add: Added `_navi` and `navi` to `.config`.
- Change: Improved time complexity of navigation key identification when a key is pressed while the menu (item list) is in focus.
- Fix: Changed default value of CL options corresponding to **boolean** config options to `None`.
  - `--multi` & `--no-multi`
  - `--swap-win-size` & `--no-swap-win-size`
  - In order for their values to be overriden by the corresponding config value when not specified.
  - Was Broken in commit b10a594.
- Change: Deferred computation of auto value for "checkers" till after `--checkers` has been processed.
- Change: Updated some CL option descriptions.
- Change: Updated "max notifications" validation.
  - Added an upper limit of 5.
  - Updated the error message.
- Add: Added `.config.reconfigure_tui()` to update aspect of the TUI using config options and keybindings.
  - Improved urwid command map update.
  - Opens the door to more functionalities like reloading user config.
- Add: Added `.keys.change_key()`.
- Change: User config is now initialized after CL arguments have been parsed.
  - Eliminates restrictions to module loading order.
  - Opens the door to more functionalities like user-specified config file, no config, etc.
- Change: Modified the following aspects of the TUI to conform with reconfiguration.
  - Notifications
  - Image grid widget
- Change: Updated the command map for `.widgets.NoSwitchColumns`.
- Change: Updated doctrings and typehints.
- Fix: Validation now fails for an unwritable file in writable directory.
- Add: Added tilde expansion support.
- Add: Added `.utils.is_writable()`.
- Change: Now accepts non-existent paths that require creating [multiple] parent directories.
  - Implicitly fixes creation of default log file for the first time i.e when the parent diretory
    does not exist, was broken in ea88da0.
- Fix: Unupdated navigation keys are now checked when the "navigation" context is not updated, for conflicts with global keys.
- Change: Config file loading now recovers from unresolvable key conflicts.
  - All context updates already performed are simply reverted with an error notification accompanying and the program continues.
- Change: Removed `CONFIG_ERROR` exit code.
- Change: Changed `NO_VALID_SOURCE` exit code to 4.
- Change: Updated `--quiet` CL option description.
Conflicts:
	src/term_image/cli.py
	src/term_image/notify.py
	src/term_image/tui/__init__.py
- Add: Incoporated logging into the config system.
- Change: Now using the notification system (`.notify`) instead of `print()` statements for config messages.
- Change: Changed passive errors to warnings.
  - i.e those error conditions for which nothing can be done by the program to remediate but don't affect the program's execution.
- Change: Updated some notifications.
- Change: Reworded almost all notification messages in `.config.update_context()`.
- Change: All INFO-level config notifications are now verbose.
- Add: Added `--config` and `--no-config` CL options.
  - Adds support for user-specified config file.
- Change: Config value representations now use "null" in place of "None" in notifications.
- Change: Updated config load failed error message.
- Change: Renamed the config option.
- Change: Changed the default value to `True`.
- Change: Changed CL option target to `multi`.
- Change: Updated `.logging.log_init()`.
- Change: Updated sample default config file.
@AnonymouX47 AnonymouX47 merged commit 500b046 into main Sep 2, 2022
@AnonymouX47 AnonymouX47 deleted the config-update branch September 2, 2022 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the image viewer's CLI (Not to be used anymore) config Related to the viewer configuration (Not to be used anymore) documentation Improvements or additions to documentation fix Fixes a bug improvement Implementation of improvement to an existing feature new New feature implementation tui Related to the image viewer's TUI (Not to be used anymore)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant