Releases: Tim-ats-d/Visual-dialog
Quality life update
Quality life update
Major changes
DialogBoxconstructor now accept an argumentglobal_win. It allows defining acurseswindow where to write by default. As a result, thewinparameter ofchar_by_charandword_by_wordmethods has become optional and is now accepted as a second argument.
This feature is useful when dealing with manyDialogBoxmethods calls.
API changes
-
PanicErrornow inherits ofKeyboardInterruptexception. -
An error
ValueNotInBound(which inherits ofValueError) is now raised if inconsistent values are passed toDialogBoxduring instantiation (see related documentation). -
Current window is now passed to second argument of callbacks during
char_by_charandword_by_wordexecution. -
Arguments are now passed to callbacks:
- For
char_by_charmethod:- 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_wordmethod:- the instance of the class used (self), current curses window and word written.
- For
-
char_by_charandword_by_wordnow returnstextargument 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 fromDialogBoxwas set on60(insteed600) - Since their introduction,
DialogBox.positionsandDialogBox.dimensionreturns 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
cargsto the callback is no longer possible. - Added the possibility to pass several callbacks to
char_by_charandword_by_word.
callbackargument must now be an iterable of callables (argument has been renamedcallbacksaccordingly).
It defaults to an empty tuple. - Several arguments are now passed to callbacks when they are executed:
- For
char_by_charmethod:- 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_wordmethod:- 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.napmsinstead oftime.sleep. Therefore, the values passed to these parameters
must now be of typeintand no longer ofUnion[int, float]. - The error message of the
PanicErrorexception is now more precise. - Import of all of each submodule when importing visualdialog.
BaseTextBox.confirm_dialog_keysis now defaults on[" "].BaseTextBox.key_detectionnow 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_keytoconfirm_dialog_keys.panic_keytopanic_keys.key_detection_modetokey_detection.
-
Method parameters:
cut_charparameter toword_delimiterinchar_by_charandword_by_word.callbackparameter tocallbackinchar_by_charandword_by_word.
-
Method name:
BaseTextBox.getkeymethod toBaseTextBox.get_input.
In submodules:
-
visualdialog.utilsTextAttributescontext manager toTextAttr.
-
visualdialog.typeCursesKeyConstantandCursesKeyConstantstoCursesKeyandCursesKeys.
Bug fix
- Fixed the bug that occurred when several key presses were recorded while scrolling the text in a dialog box.
Ifnkeystrokes had been registered,ntext 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
cursescan 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.positionwhich returns the x;y position of the dialog box.DialogBox.dimensionswhich returns the height;width dimensions of the dialog box.
API changes
-
titleparameter is no longer required at instantiation.
It is now set to an empty string by default. -
title_colors_pair_nbparameter is no longer required at instantiation.
It is now set to0by default (0corresponding to the white on black color pair initialized by default bycurses). -
When an empty string is passed to
titleparameter, the title of dialog box is not displayed. -
The delay between the writing of each character is now
0.04s instead of0.05s forchar_by_charmethod.
Renaming
-
Renaming class
TextBoxtoBaseTextBox. -
Renaming parameter
stdscrtowin. -
Renaming parameter
lengthtoheight. -
Renaming parameter
text_attributestotext_attrfor methodschar_by_charandword_by_word. -
Renaming parameter
box_widthtowidthandbox_lengthtolength. -
color_pair_nbparameter now optional inchar_by_charandword_by_wordmethods (set by default to0). -
Renaming parameter
title_text_attributestotitle_text_attr. -
Renaming parameter
end_dialog_indicatortoend_indicator.
Minor changes
- Fixed a bug that displayed text boxes two characters below when
DialogBox.titlewas empty. - Improvement of examples.
- Improvement of type hinting.
v0.6
Major changes:
- The delay between the writing of each word in
word_by_wordmethod is changed from 0.05s to 0.15s by default. - The text passed to the
char_by_charandword_by_wordmethods is now split so that it does not exceed dialog boxes
not exit the dialog box (see example). - Added the possibility to pass
cursesattributes to texts in the methods.
char_by_char,word_by_wordand 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
getkeymethod. - 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_charandword_by_wordmethods. 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_charandword_by_wordmethods (via the parametercargswhich accept an infinite number of arguments). DialogBoxclass is now context manager (see this example for more information).
Minors changes :
- Added some comments in the source code.