From: Florent R. <f.r...@fr...> - 2013-10-14 22:31:19
|
Hello, I am pleased to announce the release of pythondialog 3.0.0. You can read a summary of the changes in this version at: http://pythondialog.sourceforge.net/#news-3.0 For your convenience, here is a text dump of this summary: Main changes in version 3.0.0 The major version number has been increased because this version is not completely backward-compatible with version 2. However, the backward-incompatible changes are small and unlikely to affect many people, if any (see below). The main changes in version 3.0.0 are: * Full help support for all widgets You can now use the keyword arguments (“dialog common options”) help_button, help_label, item_help, help_tags and help_status with any widget to provide help facilities to the user (as long as the dialog backend supports the corresponding options). Please refer to the Dialog class docstring in the [10]documentation for details. demo.py has a number of examples showing how to implement help support in user code. The API extends what was already present for help support in the 'menu' widget. Backward-compatibility is only affected for people who used to parse the dialog output after the Help button has been pressed, because this is now automatically done by pythondialog in order to return ready to use, structured data. If you only check the Dialog exit code, you are not affected. pythondialog should now offer access to all help facilities provided by the dialog backend. * Nicer exit codes for widget-producing methods The old, low-level exit codes d.DIALOG_OK, d.DIALOG_CANCEL, d.DIALOG_ESC, d.DIALOG_HELP, d.DIALOG_ITEM_HELP and d.DIALOG_EXTRA are deprecated (where d is a Dialog instance). They still work, but trigger a DeprecationWarning (see README.rst or [11]its HTML rendering for instructions on how to enable deprecation warnings). You should now use d.OK, d.CANCEL, d.ESC, d.HELP and d.EXTRA, or equivalently Dialog.OK, Dialog.CANCEL, Dialog.ESC, Dialog.HELP and Dialog.EXTRA (attributes of the Dialog class). These are called the high-level exit codes, or Dialog exit codes, and defined as strings: "ok", "cancel", "esc", "help" and "extra". You should use the == operator when comparing to these codes. Notes: + There is no ITEM_HELP in the high-level exit codes: the DIALOG_HELP and DIALOG_ITEM_HELP low-level codes are both translated into Dialog.HELP. Indeed, the program that has to interpret the code already knows whether it used item_help=True in the widget call or not. Both cases correspond to the same user action: the Help button being pressed. Therefore, the distinction is not useful to user code. + As said, the values of the high-level exit codes are strings: "ok", "cancel", "esc", "help" and "extra". You may use the string literals directly in your code, instead of d.OK or Dialog.OK, d.CANCEL or Dialog.CANCEL, etc. With proper syntax highlighting, this produces good-looking code, but offers no protection against typos, contrary to the Dialog class attributes Dialog.OK and friends. Apart from that, it is mostly a matter of taste. + Backward-compatibility should only be affected for code that relies on the nature of d.DIALOG_OK, d.DIALOG_CANCEL, d.DIALOG_ESC, d.DIALOG_HELP, d.DIALOG_ITEM_HELP and d.DIALOG_EXTRA, which were integers in pythondialog 2 and are now strings (the deprecated attributes are mapped to the high-level exit codes, so that the vast majority of old user code still works without modification, despite the changes). * Better Extra button support + A few widgets, when the Extra button was pressed, used to return None instead of the expected value corresponding to user input. This is fixed. + Similarly to help support, pythondialog now automatically parses the dialog output when the Extra button has been pressed, in order to return ready to use, structured data (normally: the same as if OK had been pressed). This is backward-incompatible. Extra button support should now be as good as in the dialog backend. See the Dialog class docstring for details. * 'buildlist' widget support * New retval_is_code decorator that sets the attribute of the same name on its argument. This attribute allows to reliably detect if a widget-producing method returns a Dialog exit code or a sequence whose first element is a Dialog exit code. This is used in the demo, and was necessary since the new exit codes from widget-producing methods are strings, and thus sequences. -- Florent |