Releases: Tim-ats-d/Visual-dialog
Quality life update
Quality life update
Major changes
DialogBox
constructor now accept an argumentglobal_win
. It allows defining acurses
window where to write by default. As a result, thewin
parameter ofchar_by_char
andword_by_word
methods has become optional and is now accepted as a second argument.
This feature is useful when dealing with manyDialogBox
methods calls.
API changes
-
PanicError
now inherits ofKeyboardInterrupt
exception. -
An error
ValueNotInBound
(which inherits ofValueError
) is now raised if inconsistent values are passed toDialogBox
during instantiation (see related documentation). -
Current window is now passed to second argument of callbacks during
char_by_char
andword_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.
- For
-
char_by_char
andword_by_word
now returnstext
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 fromDialogBox
was set on60
(insteed600
) - Since their introduction,
DialogBox.positions
andDialogBox.dimension
returns erroneous values. This is fixed.
Callbacks update
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
andword_by_word
.
callback
argument must now be an iterable of callables (argument has been renamedcallbacks
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.
- the instance of the class used (
- For
word_by_word
method:- the instance of the class used (
self
) and word written.
- the instance of the class used (
- For
See the implementation for more details.
API changes
- The unit of the duration parameters (
delay
,downtime_chars_delay
, andrandom_delay
) is now milliseconds
due to the use ofcurses.napms
instead oftime.sleep
. Therefore, the values passed to these parameters
must now be of typeint
and no longer ofUnion[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 ofcurses
.
Renaming
In BaseTextBox
and DialogBox
:
-
Instance variable:
confirm_dialog_key
toconfirm_dialog_keys
.panic_key
topanic_keys
.key_detection_mode
tokey_detection
.
-
Method parameters:
cut_char
parameter toword_delimiter
inchar_by_char
andword_by_word
.callback
parameter tocallback
inchar_by_char
andword_by_word
.
-
Method name:
BaseTextBox.getkey
method toBaseTextBox.get_input
.
In submodules:
-
visualdialog.utils
TextAttributes
context manager toTextAttr
.
-
visualdialog.type
CursesKeyConstant
andCursesKeyConstants
toCursesKey
andCursesKeys
.
Bug fix
- Fixed the bug that occurred when several key presses were recorded while scrolling the text in a dialog box.
Ifn
keystrokes had been registered,n
text scrolling was passed without waiting for an input.
Low verbosity update
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 to0
by default (0
corresponding to the white on black color pair initialized by default bycurses
). -
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.04
s instead of0.05
s forchar_by_char
method.
Renaming
-
Renaming class
TextBox
toBaseTextBox
. -
Renaming parameter
stdscr
towin
. -
Renaming parameter
length
toheight
. -
Renaming parameter
text_attributes
totext_attr
for methodschar_by_char
andword_by_word
. -
Renaming parameter
box_width
towidth
andbox_length
tolength
. -
color_pair_nb
parameter now optional inchar_by_char
andword_by_word
methods (set by default to0
). -
Renaming parameter
title_text_attributes
totitle_text_attr
. -
Renaming parameter
end_dialog_indicator
toend_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
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
andword_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
Majors changes :
- Added the possibility to pass a callback to
char_by_char
andword_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
andword_by_word
methods (via the parametercargs
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.