Skip to content

Releases: Tim-ats-d/Visual-dialog

Quality life update

09 Aug 18:00
09b01de
Compare
Choose a tag to compare

Quality life update

Major changes

  • DialogBox constructor now accept an argument global_win. It allows defining a curses window where to write by default. As a result, the win parameter of char_by_char and word_by_word methods has become optional and is now accepted as a second argument.
    This feature is useful when dealing with many DialogBox methods calls.

API changes

  • PanicError now inherits of KeyboardInterrupt exception.

  • An error ValueNotInBound (which inherits of ValueError) is now raised if inconsistent values are passed to DialogBox during instantiation (see related documentation).

  • Current window is now passed to second argument of callbacks during char_by_char and word_by_word execution.

  • Arguments are now passed to callbacks:

    • For char_by_char method:
      • the instance of the class used (self), current curses window, character written and index of the character in the current word being written.
    • For word_by_word method:
      • the instance of the class used (self), current curses window and word written.
  • char_by_char and word_by_word now returns text argument that are passed to them at the end of their scrolling.

  • Improve documentation.

Bug fix

  • Fix a bug introduced in previous version: default value of downtime_chars_delay
    parameter from DialogBox was set on 60 (insteed 600)
  • Since their introduction, DialogBox.positions and DialogBox.dimension returns erroneous values. This is fixed.

Callbacks update

27 Apr 18:20
Compare
Choose a tag to compare

Callbacks update

Major changes

  • Python 3.8+ is now required to use Visual-dialog (due to improvements in typing hinting).

New features

Callback

Callback support has been completely redesigned.

  • Passing arguments via cargs to the callback is no longer possible.
  • Added the possibility to pass several callbacks to char_by_char and word_by_word.
    callback argument must now be an iterable of callables (argument has been renamed callbacks accordingly).
    It defaults to an empty tuple.
  • Several arguments are now passed to callbacks when they are executed:
    • For char_by_char method:
      • the instance of the class used (self), character written and index of the character in the current word being written.
    • For word_by_word method:
      • the instance of the class used (self) and word written.

See the implementation for more details.

API changes

  • The unit of the duration parameters (delay, downtime_chars_delay, and random_delay) is now milliseconds
    due to the use of curses.napms instead of time.sleep. Therefore, the values passed to these parameters
    must now be of type int and no longer of Union[int, float].
  • The error message of the PanicError exception is now more precise.
  • Import of all of each submodule when importing visualdialog.
  • BaseTextBox.confirm_dialog_keys is now defaults on [" "].
  • BaseTextBox.key_detection now accepts only a string. It can be "getkey", "getch", or "get_wch".
    These strings represent the name of the input capture methods of curses.

Renaming

In BaseTextBox and DialogBox:
  • Instance variable:

    • confirm_dialog_key to confirm_dialog_keys.
    • panic_key to panic_keys.
    • key_detection_mode to key_detection.
  • Method parameters:

    • cut_char parameter to word_delimiter in char_by_char and word_by_word.
    • callback parameter to callback in char_by_char and word_by_word.
  • Method name:

    • BaseTextBox.getkey method to BaseTextBox.get_input.
In submodules:
  • visualdialog.utils

    • TextAttributes context manager to TextAttr.
  • visualdialog.type

    • CursesKeyConstant and CursesKeyConstants to CursesKey and CursesKeys.

Bug fix

  • Fixed the bug that occurred when several key presses were recorded while scrolling the text in a dialog box.
    If n keystrokes had been registered, n text scrolling was passed without waiting for an input.

Low verbosity update

29 Mar 18:52
b9d50b5
Compare
Choose a tag to compare

Efforts have been made to reduce verbosity of Visual-dialog.
Fewer parameters are now required at instantiation of text boxes
for example.

Also, API has undergone many changes. Code written with visualdialog v0.6 will have little chance to be compatible with v0.7 (mainly because of change of name of many variables).

Before this update, version numbering followed a rather chaotic order.
This will no longer be the case from this update.

Major changes

  • Adding and improving examples.

  • Rewriting of the documentation in reStructuredText and new way to generate it (via Sphinx).

New features

  • A single textual attribute curses can now be passed instead of a tuple containing several in parameters finishing by _attr.

The following changes apply to the DialogBox class:

  • Added two new properties:
    • DialogBox.position which returns the x;y position of the dialog box.
    • DialogBox.dimensions which returns the height;width dimensions of the dialog box.

API changes

  • title parameter is no longer required at instantiation.
    It is now set to an empty string by default.

  • title_colors_pair_nb parameter is no longer required at instantiation.
    It is now set to 0 by default (0 corresponding to the white on black color pair initialized by default by curses).

  • When an empty string is passed to title parameter, the title of dialog box is not displayed.

  • The delay between the writing of each character is now 0.04s instead of 0.05s for char_by_char method.

Renaming

  • Renaming class TextBox to BaseTextBox.

  • Renaming parameter stdscr to win.

  • Renaming parameter length to height.

  • Renaming parameter text_attributes to text_attr for methods char_by_char and word_by_word.

  • Renaming parameter box_width to width and box_length to length.

  • color_pair_nb parameter now optional in char_by_char and word_by_word methods (set by default to0).

  • Renaming parameter title_text_attributes to title_text_attr.

  • Renaming parameter end_dialog_indicator to end_indicator.

Minor changes

  • Fixed a bug that displayed text boxes two characters below when DialogBox.title was empty.
  • Improvement of examples.
  • Improvement of type hinting.

v0.6

30 Nov 18:26
Compare
Choose a tag to compare

Major changes:

  • The delay between the writing of each word in word_by_word method is changed from 0.05s to 0.15s by default.
  • The text passed to the char_by_char and word_by_word methods is now split so that it does not exceed dialog boxes
    not exit the dialog box (see example).
  • Added the possibility to pass curses attributes to texts in the methods.
    char_by_char, word_by_word and in the dialog title (see this example).
  • The title of the dialog box is now bold by default.
  • Added an example file (text_attributes.py).
  • Complete rewrite of the code documentation.

Minor changes:

  • Optimized the getkey method.
  • Addition and improvement of comments in the source code.
  • Reformatting the source code and examples (by yapf).
  • Improvement of the examples.

v0.4

28 Nov 12:34
Compare
Choose a tag to compare

Majors changes :

  • Added the possibility to pass a callback to char_by_char and word_by_word methods. The callback being executed after the delay between each character and word respectively.
  • Added the possibility to pass arguments to callback passed to char_by_char and word_by_word methods (via the parameter cargs which accept an infinite number of arguments).
  • DialogBox class is now context manager (see this example for more information).

Minors changes :

  • Added some comments in the source code.